File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -358,6 +358,12 @@ class TypeMatcher {
358
358
Type secondType,
359
359
Type sugaredFirstType) {
360
360
if (auto secondProtocolComposition = secondType->getAs <ProtocolCompositionType>()) {
361
+ if (firstProtocolComposition->hasExplicitAnyObject () !=
362
+ secondProtocolComposition->hasExplicitAnyObject ()) {
363
+ return mismatch (firstProtocolComposition.getPointer (), secondType,
364
+ sugaredFirstType);
365
+ }
366
+
361
367
auto firstMembers = firstProtocolComposition->getMembers ();
362
368
auto secondMembers = secondProtocolComposition->getMembers ();
363
369
Original file line number Diff line number Diff line change
1
+ // RUN: %target-typecheck-verify-swift
2
+
3
+ protocol B {
4
+ typealias A = Any
5
+ }
6
+
7
+ protocol D : B {
8
+ // expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Any' and 'Self.A == AnyObject'}}
9
+ // expected-error@-2 {{no type for 'Self.A' can satisfy both 'Self.A : AnyObject' and 'Self.A == Any'}}
10
+ typealias A = AnyObject
11
+ }
You can’t perform that action at this time.
0 commit comments