File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
test/AssociatedTypeInference Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -2496,7 +2496,11 @@ AssociatedTypeInference::computeFailureTypeWitness(
24962496 if (!isAsyncIteratorProtocolNext (witness.first ))
24972497 continue ;
24982498
2499- if (!witness.second || witness.second ->getDeclContext () != dc)
2499+ // Different extensions of the same nominal are OK, but if the witness is in
2500+ // a protocol extension or a superclass or something, give up.
2501+ if (!witness.second ||
2502+ witness.second ->getDeclContext ()->getSelfNominalTypeDecl ()
2503+ != dc->getSelfNominalTypeDecl ())
25002504 continue ;
25012505
25022506 if (auto witnessFunc = dyn_cast<AbstractFunctionDecl>(witness.second )) {
Original file line number Diff line number Diff line change 1+ // RUN: %target-typecheck-verify-swift
2+
3+ // https://github.com/swiftlang/swift/issues/79367
4+
5+ // 'Failure' type witness inference should still take place when
6+ // the 'next()' witness is in a different extension than the
7+ // conformance.
8+
9+ struct AsyncIteratorImpl < Element> : AsyncIteratorProtocol { }
10+
11+ extension AsyncIteratorImpl {
12+ func next( ) async throws -> Element ? {
13+ fatalError ( )
14+ }
15+ }
You can’t perform that action at this time.
0 commit comments