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(
2496
2496
if (!isAsyncIteratorProtocolNext (witness.first ))
2497
2497
continue ;
2498
2498
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 ())
2500
2504
continue ;
2501
2505
2502
2506
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