Skip to content

Commit 1ddcdc7

Browse files
committed
Sema: Convert conditional into an assert
1 parent 250e3fd commit 1ddcdc7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

lib/Sema/CSApply.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,20 +1814,20 @@ namespace {
18141814
// This can occur in code that does something like: 'type(of: x).a' where
18151815
// 'a' is the static value generic member.
18161816
if (auto gp = dyn_cast<GenericTypeParamDecl>(member)) {
1817-
if (gp->isValue()) {
1818-
auto refType = adjustedOpenedType;
1819-
auto ref = TypeValueExpr::createForDecl(memberLoc, gp, dc);
1820-
cs.setType(ref, refType);
1821-
1822-
auto gpTy = gp->getDeclaredInterfaceType();
1823-
auto subs = baseTy->getContextSubstitutionMap();
1824-
ref->setParamType(gpTy.subst(subs));
1825-
1826-
auto result = new (ctx) DotSyntaxBaseIgnoredExpr(base, dotLoc, ref,
1827-
refType);
1828-
cs.setType(result, refType);
1829-
return result;
1830-
}
1817+
ASSERT(gp->isValue());
1818+
1819+
auto refType = adjustedOpenedType;
1820+
auto ref = TypeValueExpr::createForDecl(memberLoc, gp, dc);
1821+
cs.setType(ref, refType);
1822+
1823+
auto gpTy = gp->getDeclaredInterfaceType();
1824+
auto subs = baseTy->getContextSubstitutionMap();
1825+
ref->setParamType(gpTy.subst(subs));
1826+
1827+
auto result = new (ctx) DotSyntaxBaseIgnoredExpr(base, dotLoc, ref,
1828+
refType);
1829+
cs.setType(result, refType);
1830+
return result;
18311831
}
18321832

18331833
// If we're referring to a member type, it's just a type

0 commit comments

Comments
 (0)