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 @@ -2497,7 +2497,11 @@ AssociatedTypeInference::computeFailureTypeWitness(
24972497 if (!isAsyncIteratorProtocolNext (witness.first ))
24982498 continue ;
24992499
2500- if (!witness.second || witness.second ->getDeclContext () != dc)
2500+ // Different extensions of the same nominal are OK, but if the witness is in
2501+ // a protocol extension or a superclass or something, give up.
2502+ if (!witness.second ||
2503+ witness.second ->getDeclContext ()->getSelfNominalTypeDecl ()
2504+ != dc->getSelfNominalTypeDecl ())
25012505 continue ;
25022506
25032507 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