Skip to content

Commit cfc1e8b

Browse files
authored
Fix CSApply bug for keyword-based dynamic callable. (#24580)
The type set by cs.setType() in the dynamic callable application did not have type-variables, so it was considering this string literal already checked. This made it to SILGen with a nullptr keyword argument.
1 parent fb033b7 commit cfc1e8b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/Sema/CSApply.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,10 +2066,11 @@ namespace {
20662066
}
20672067

20682068
Expr *handleStringLiteralExpr(LiteralExpr *expr) {
2069-
if (cs.getType(expr) && !cs.getType(expr)->hasTypeVariable())
2069+
auto stringLiteral = dyn_cast<StringLiteralExpr>(expr);
2070+
if (cs.getType(expr) && !cs.getType(expr)->hasTypeVariable()
2071+
&& stringLiteral->getBuiltinInitializer())
20702072
return expr;
20712073

2072-
auto stringLiteral = dyn_cast<StringLiteralExpr>(expr);
20732074
auto magicLiteral = dyn_cast<MagicIdentifierLiteralExpr>(expr);
20742075
assert(bool(stringLiteral) != bool(magicLiteral) &&
20752076
"literal must be either a string literal or a magic literal");

0 commit comments

Comments
 (0)