mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
When checking whether a particular protocol conformance satisfies all of the protocol's requirements, we were suppressing substitution failures. In some cases, this would mean that we marked a conformance "invalid" without ever emitting a diagnostic, which would lead to downstream crashes. Instead, treat substitution failures somewhat more lazily. If we encounter one while performing the checking, put the conformance into a "delayed" list rather than failing immediately. Teach the top-level type checking loop to re-check these conformances, emitting a diagnostic if they fail the second time around. Fixes rdar://problem/35082483 and likely other issues that slipped through the type checker or blew up in unpredictable ways.
21 lines
358 B
Swift
21 lines
358 B
Swift
// RUN: not %target-swift-frontend %s -typecheck
|
|
|
|
struct S : Sequence {
|
|
struct Iterator : IteratorProtocol {
|
|
mutating func next() -> Int? {
|
|
fatalError()
|
|
}
|
|
}
|
|
|
|
func makeIterator() -> Iterator {
|
|
fatalError()
|
|
}
|
|
}
|
|
|
|
extension S : Collection {
|
|
typealias Index = Int
|
|
|
|
var startIndex: Int { return 0 }
|
|
var endIndex: Int { return 1 }
|
|
}
|