@@ -7348,24 +7348,39 @@ void SILFunction::verifySILUndefMap() const {
7348
7348
}
7349
7349
}
7350
7350
7351
+ CanType SILProperty::getBaseType () const {
7352
+ auto *decl = getDecl ();
7353
+ auto *dc = decl->getInnermostDeclContext ();
7354
+
7355
+ // TODO: base type for global descriptors
7356
+ auto sig = dc->getGenericSignatureOfContext ();
7357
+ auto baseTy =
7358
+ dc->getInnermostTypeContext ()->getSelfInterfaceType ()->getReducedType (
7359
+ sig);
7360
+ if (decl->isStatic ())
7361
+ baseTy = CanMetatypeType::get (baseTy);
7362
+
7363
+ if (sig) {
7364
+ auto env = dc->getGenericEnvironmentOfContext ();
7365
+ baseTy = env->mapTypeIntoContext (baseTy)->getCanonicalType ();
7366
+ }
7367
+
7368
+ return baseTy;
7369
+ }
7370
+
7351
7371
// / Verify that a property descriptor follows invariants.
7352
7372
void SILProperty::verify (const SILModule &M) const {
7353
7373
if (!verificationEnabled (M))
7354
7374
return ;
7355
7375
7356
7376
auto *decl = getDecl ();
7357
- auto *dc = decl->getInnermostDeclContext ();
7358
-
7359
- // TODO: base type for global/static descriptors
7360
- auto sig = dc->getGenericSignatureOfContext ();
7361
- auto baseTy = dc->getInnermostTypeContext ()->getSelfInterfaceType ()
7362
- ->getReducedType (sig);
7377
+ auto sig = decl->getInnermostDeclContext ()->getGenericSignatureOfContext ();
7363
7378
auto leafTy = decl->getValueInterfaceType ()->getReducedType (sig);
7364
7379
SubstitutionMap subs;
7365
7380
if (sig) {
7366
- auto env = dc->getGenericEnvironmentOfContext ();
7381
+ auto env =
7382
+ decl->getInnermostDeclContext ()->getGenericEnvironmentOfContext ();
7367
7383
subs = env->getForwardingSubstitutionMap ();
7368
- baseTy = env->mapTypeIntoContext (baseTy)->getCanonicalType ();
7369
7384
leafTy = env->mapTypeIntoContext (leafTy)->getCanonicalType ();
7370
7385
}
7371
7386
bool hasIndices = false ;
@@ -7386,6 +7401,7 @@ void SILProperty::verify(const SILModule &M) const {
7386
7401
auto typeExpansionContext =
7387
7402
TypeExpansionContext::noOpaqueTypeArchetypesSubstitution (
7388
7403
ResilienceExpansion::Maximal);
7404
+ auto baseTy = getBaseType ();
7389
7405
verifyKeyPathComponent (const_cast <SILModule&>(M),
7390
7406
typeExpansionContext,
7391
7407
getSerializedKind (),
0 commit comments