mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: Don't forget to check ProtocolCompositionType::hasExplicitAnyObject() in TypeMatcher
This commit is contained in:
@@ -358,6 +358,12 @@ class TypeMatcher {
|
||||
Type secondType,
|
||||
Type sugaredFirstType) {
|
||||
if (auto secondProtocolComposition = secondType->getAs<ProtocolCompositionType>()) {
|
||||
if (firstProtocolComposition->hasExplicitAnyObject() !=
|
||||
secondProtocolComposition->hasExplicitAnyObject()) {
|
||||
return mismatch(firstProtocolComposition.getPointer(), secondType,
|
||||
sugaredFirstType);
|
||||
}
|
||||
|
||||
auto firstMembers = firstProtocolComposition->getMembers();
|
||||
auto secondMembers = secondProtocolComposition->getMembers();
|
||||
|
||||
|
||||
11
test/Generics/issue-49200.swift
Normal file
11
test/Generics/issue-49200.swift
Normal file
@@ -0,0 +1,11 @@
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
|
||||
protocol B {
|
||||
typealias A = Any
|
||||
}
|
||||
|
||||
protocol D : B {
|
||||
// expected-error@-1 {{no type for 'Self.A' can satisfy both 'Self.A == Any' and 'Self.A == AnyObject'}}
|
||||
// expected-error@-2 {{no type for 'Self.A' can satisfy both 'Self.A : AnyObject' and 'Self.A == Any'}}
|
||||
typealias A = AnyObject
|
||||
}
|
||||
Reference in New Issue
Block a user