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