Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0136-rdar35082483.swift
Doug Gregor d9095b1079 [Conformance checking] Don't suppress substitution failures during checking.
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.
2017-12-18 16:43:59 -08:00

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 }
}