@@ -1469,10 +1469,8 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
14691469 " Operand is of an ArchetypeType that does not exist in the "
14701470 " Caller's generic param list." );
14711471 if (auto OpenedA = getOpenedArchetypeOf (A)) {
1472- const auto root =
1473- cast<OpenedArchetypeType>(CanType (OpenedA->getRoot ()));
14741472 auto *openingInst =
1475- F->getModule ().getRootOpenedArchetypeDefInst (root , F);
1473+ F->getModule ().getRootOpenedArchetypeDefInst (OpenedA. getRoot () , F);
14761474 require (I == nullptr || openingInst == I ||
14771475 properlyDominates (openingInst, I),
14781476 " Use of an opened archetype should be dominated by a "
@@ -1605,7 +1603,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
16051603 require (isArchetypeValidInFunction (A, AI->getFunction ()),
16061604 " Archetype to be substituted must be valid in function." );
16071605
1608- const auto root = cast<OpenedArchetypeType>( CanType (A-> getRoot ()) );
1606+ const auto root = A. getRoot ();
16091607
16101608 // Collect all root opened archetypes used in the substitutions list.
16111609 FoundRootOpenedArchetypes.insert (root);
@@ -4074,10 +4072,8 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
40744072 Ty.visit ([&](CanType t) {
40754073 SILValue Def;
40764074 if (const auto archetypeTy = dyn_cast<OpenedArchetypeType>(t)) {
4077- const auto root =
4078- cast<OpenedArchetypeType>(CanType (archetypeTy->getRoot ()));
4079- Def = I->getModule ().getRootOpenedArchetypeDefInst (root,
4080- I->getFunction ());
4075+ Def = I->getModule ().getRootOpenedArchetypeDefInst (
4076+ archetypeTy.getRoot (), I->getFunction ());
40814077 require (Def, " Root opened archetype should be registered in SILModule" );
40824078 } else if (t->hasDynamicSelfType ()) {
40834079 require (I->getFunction ()->hasSelfParam () ||
0 commit comments