@@ -46,12 +46,13 @@ TypeConverter::getAbstractionPattern(AbstractStorageDecl *decl,
46
46
47
47
AbstractionPattern
48
48
TypeConverter::getAbstractionPattern (SubscriptDecl *decl, bool isNonObjC) {
49
+ auto type = decl->getElementInterfaceType ()->getCanonicalType ();
49
50
CanGenericSignature genericSig;
50
- if (auto sig = decl->getGenericSignatureOfContext ())
51
+ if (auto sig = decl->getGenericSignatureOfContext ()) {
51
52
genericSig = sig.getCanonicalSignature ();
52
- return AbstractionPattern (genericSig,
53
- decl-> getElementInterfaceType ()
54
- -> getCanonicalType () );
53
+ type = sig-> getCanonicalTypeInContext (type);
54
+ }
55
+ return AbstractionPattern (genericSig, type );
55
56
}
56
57
57
58
static const clang::Type *getClangType (const clang::Decl *decl) {
@@ -76,13 +77,15 @@ static Bridgeability getClangDeclBridgeability(const clang::Decl *decl) {
76
77
77
78
AbstractionPattern
78
79
TypeConverter::getAbstractionPattern (VarDecl *var, bool isNonObjC) {
79
- CanGenericSignature genericSig;
80
- if (auto sig = var->getDeclContext ()->getGenericSignatureOfContext ())
81
- genericSig = sig.getCanonicalSignature ();
82
-
83
80
CanType swiftType = var->getInterfaceType ()
84
81
->getCanonicalType ();
85
82
83
+ CanGenericSignature genericSig;
84
+ if (auto sig = var->getDeclContext ()->getGenericSignatureOfContext ()) {
85
+ genericSig = sig.getCanonicalSignature ();
86
+ swiftType = genericSig->getCanonicalTypeInContext (swiftType);
87
+ }
88
+
86
89
if (isNonObjC)
87
90
return AbstractionPattern (genericSig, swiftType);
88
91
@@ -109,12 +112,15 @@ AbstractionPattern TypeConverter::getAbstractionPattern(EnumElementDecl *decl) {
109
112
" Optional.Some does not have a unique abstraction pattern because "
110
113
" optionals are re-abstracted" );
111
114
115
+ CanType type = decl->getArgumentInterfaceType ()->getCanonicalType ();
116
+
112
117
CanGenericSignature genericSig;
113
- if (auto sig = decl->getParentEnum ()->getGenericSignatureOfContext ())
118
+ if (auto sig = decl->getParentEnum ()->getGenericSignatureOfContext ()) {
114
119
genericSig = sig.getCanonicalSignature ();
115
- return AbstractionPattern (genericSig,
116
- decl->getArgumentInterfaceType ()
117
- ->getCanonicalType ());
120
+ type = genericSig->getCanonicalTypeInContext (type);
121
+ }
122
+
123
+ return AbstractionPattern (genericSig, type);
118
124
}
119
125
120
126
AbstractionPattern::EncodedForeignErrorInfo
0 commit comments