Skip to content

Commit 21def03

Browse files
committed
Revert "AST: Temporarily remove calls to TypeBase::getMinimalCanonicalType()"
This reverts commit 0b612a4.
1 parent b7bdb91 commit 21def03

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5234,7 +5234,7 @@ ASTContext::getOpenedArchetypeSignature(Type type, GenericSignature parentSig) {
52345234
CanGenericSignature canGenericSig(genericSig);
52355235

52365236
auto result = getImpl().ExistentialSignatures.insert(
5237-
std::make_pair(std::make_pair(constraint, canParentSig.getPointer()), canGenericSig));
5237+
std::make_pair(key, canGenericSig));
52385238
assert(result.second);
52395239
(void) result;
52405240

lib/AST/Decl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2926,7 +2926,7 @@ CanType ValueDecl::getOverloadSignatureType() const {
29262926
/*topLevelFunction=*/true, isMethod,
29272927
/*isInitializer=*/isa<ConstructorDecl>(afd),
29282928
getNumCurryLevels())
2929-
->getCanonicalType();
2929+
->getMinimalCanonicalType(afd);
29302930
}
29312931

29322932
if (isa<AbstractStorageDecl>(this)) {
@@ -2942,7 +2942,7 @@ CanType ValueDecl::getOverloadSignatureType() const {
29422942
/*topLevelFunction=*/true,
29432943
/*isMethod=*/false,
29442944
/*isInitializer=*/false, getNumCurryLevels())
2945-
->getCanonicalType();
2945+
->getMinimalCanonicalType(cast<SubscriptDecl>(this));
29462946
}
29472947

29482948
// We want to curry the default signature type with the 'self' type of the
@@ -2957,7 +2957,7 @@ CanType ValueDecl::getOverloadSignatureType() const {
29572957
auto mappedType = mapSignatureFunctionType(
29582958
getASTContext(), getInterfaceType(), /*topLevelFunction=*/false,
29592959
/*isMethod=*/false, /*isInitializer=*/false, getNumCurryLevels());
2960-
return mappedType->getCanonicalType();
2960+
return mappedType->getMinimalCanonicalType(getDeclContext());
29612961
}
29622962

29632963
// Note: If you add more cases to this function, you should update the

test/type/subclass_composition.swift

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,29 @@ struct Unrelated {}
4646

4747
//
4848
// If a class conforms to a protocol concretely, the resulting protocol
49-
// composition type should be equivalent to the class type.
50-
//
51-
// FIXME: Disabled for now.
49+
// composition type should be equivalent to the class type for redeclaration
50+
// checking purposes.
5251
//
5352

54-
func alreadyConforms<T>(_: Base<T>) {} // expected-note {{'alreadyConforms' previously declared here}}
55-
func alreadyConforms<T>(_: Base<T> & P1) {} // FIXME e/xpected-error {{invalid redeclaration of 'alreadyConforms'}} expected-note {{'alreadyConforms' previously declared here}}
53+
func alreadyConforms<T>(_: Base<T>) {} // expected-note 3 {{'alreadyConforms' previously declared here}}
54+
func alreadyConforms<T>(_: Base<T> & P1) {} // expected-error {{invalid redeclaration of 'alreadyConforms'}}
5655
func alreadyConforms<T>(_: Base<T> & AnyObject) {} // expected-error {{invalid redeclaration of 'alreadyConforms'}}
5756
func alreadyConforms<T>(_: Base<T> & P1 & AnyObject) {} // expected-error {{invalid redeclaration of 'alreadyConforms'}}
5857

59-
func alreadyConformsMeta<T>(_: Base<T>.Type) {} // expected-note {{'alreadyConformsMeta' previously declared here}}
60-
func alreadyConformsMeta<T>(_: (Base<T> & P1).Type) {} // FIXME e/xpected-error {{invalid redeclaration of 'alreadyConformsMeta'}} expected-note {{'alreadyConformsMeta' previously declared here}}
61-
func alreadyConformsMeta<T>(_: (Base<T> & P1).Protocol) {} // FIXME e/xpected-error {{invalid redeclaration of 'alreadyConformsMeta'}} expected-note 3 {{'alreadyConformsMeta' previously declared here}}
58+
func alreadyConformsMeta<T>(_: Base<T>.Type) {} // expected-note 7 {{'alreadyConformsMeta' previously declared here}}
59+
func alreadyConformsMeta<T>(_: (Base<T> & P1).Type) {} // expected-error {{invalid redeclaration of 'alreadyConformsMeta'}}
60+
func alreadyConformsMeta<T>(_: (Base<T> & P1).Protocol) {} // expected-error {{invalid redeclaration of 'alreadyConformsMeta'}}
6261
func alreadyConformsMeta<T>(_: (any Base<T> & P1).Type) {} // expected-error {{invalid redeclaration of 'alreadyConformsMeta'}}
6362
func alreadyConformsMeta<T>(_: (Base<T> & AnyObject).Type) {} // expected-error {{invalid redeclaration of 'alreadyConformsMeta'}}
6463
func alreadyConformsMeta<T>(_: (Base<T> & P1 & AnyObject).Type) {} // expected-error {{invalid redeclaration of 'alreadyConformsMeta'}}
6564
func alreadyConformsMeta<T>(_: (Base<T> & P1 & AnyObject).Protocol) {} // expected-error {{invalid redeclaration of 'alreadyConformsMeta'}}
6665
func alreadyConformsMeta<T>(_: (any Base<T> & P1 & AnyObject).Type) {} // expected-error {{invalid redeclaration of 'alreadyConformsMeta'}}
6766

68-
func alreadyConforms(_: P3) {} // e/xpected-note {{'alreadyConforms' previously declared here}}
69-
func alreadyConforms(_: P3 & AnyObject) {} // FIXME e/xpected-error {{invalid redeclaration of 'alreadyConforms'}}
67+
func alreadyConforms(_: P3) {} // expected-note {{'alreadyConforms' previously declared here}}
68+
func alreadyConforms(_: P3 & AnyObject) {} // expected-error {{invalid redeclaration of 'alreadyConforms'}}
7069

71-
func alreadyConformsMeta(_: P3.Type) {} // FIXME e/xpected-note {{'alreadyConformsMeta' previously declared here}}
72-
func alreadyConformsMeta(_: (P3 & AnyObject).Type) {} // FIXME ex/pected-error {{invalid redeclaration of 'alreadyConformsMeta'}}
70+
func alreadyConformsMeta(_: P3.Type) {} // expected-note {{'alreadyConformsMeta' previously declared here}}
71+
func alreadyConformsMeta(_: (P3 & AnyObject).Type) {} // expected-error {{invalid redeclaration of 'alreadyConformsMeta'}}
7372

7473
// SE-0156 stipulates that a composition can contain multiple classes, as long
7574
// as they are all the same.

0 commit comments

Comments
 (0)