@@ -7180,24 +7180,39 @@ void SILFunction::verifySILUndefMap() const {
7180
7180
}
7181
7181
}
7182
7182
7183
+ CanType SILProperty::getBaseType () const {
7184
+ auto *decl = getDecl ();
7185
+ auto *dc = decl->getInnermostDeclContext ();
7186
+
7187
+ // TODO: base type for global descriptors
7188
+ auto sig = dc->getGenericSignatureOfContext ();
7189
+ auto baseTy =
7190
+ dc->getInnermostTypeContext ()->getSelfInterfaceType ()->getReducedType (
7191
+ sig);
7192
+ if (decl->isStatic ())
7193
+ baseTy = CanMetatypeType::get (baseTy);
7194
+
7195
+ if (sig) {
7196
+ auto env = dc->getGenericEnvironmentOfContext ();
7197
+ baseTy = env->mapTypeIntoContext (baseTy)->getCanonicalType ();
7198
+ }
7199
+
7200
+ return baseTy;
7201
+ }
7202
+
7183
7203
// / Verify that a property descriptor follows invariants.
7184
7204
void SILProperty::verify (const SILModule &M) const {
7185
7205
if (!verificationEnabled (M))
7186
7206
return ;
7187
7207
7188
7208
auto *decl = getDecl ();
7189
- auto *dc = decl->getInnermostDeclContext ();
7190
-
7191
- // TODO: base type for global/static descriptors
7192
- auto sig = dc->getGenericSignatureOfContext ();
7193
- auto baseTy = dc->getInnermostTypeContext ()->getSelfInterfaceType ()
7194
- ->getReducedType (sig);
7209
+ auto sig = decl->getInnermostDeclContext ()->getGenericSignatureOfContext ();
7195
7210
auto leafTy = decl->getValueInterfaceType ()->getReducedType (sig);
7196
7211
SubstitutionMap subs;
7197
7212
if (sig) {
7198
- auto env = dc->getGenericEnvironmentOfContext ();
7213
+ auto env =
7214
+ decl->getInnermostDeclContext ()->getGenericEnvironmentOfContext ();
7199
7215
subs = env->getForwardingSubstitutionMap ();
7200
- baseTy = env->mapTypeIntoContext (baseTy)->getCanonicalType ();
7201
7216
leafTy = env->mapTypeIntoContext (leafTy)->getCanonicalType ();
7202
7217
}
7203
7218
bool hasIndices = false ;
@@ -7218,6 +7233,7 @@ void SILProperty::verify(const SILModule &M) const {
7218
7233
auto typeExpansionContext =
7219
7234
TypeExpansionContext::noOpaqueTypeArchetypesSubstitution (
7220
7235
ResilienceExpansion::Maximal);
7236
+ auto baseTy = getBaseType ();
7221
7237
verifyKeyPathComponent (const_cast <SILModule&>(M),
7222
7238
typeExpansionContext,
7223
7239
require,
0 commit comments