From 21bc5292291cfebda08e9ecc3aef34d34cfa0f49 Mon Sep 17 00:00:00 2001 From: Parker Schuh Date: Tue, 7 May 2019 11:24:32 -0700 Subject: [PATCH] Fix CSApply bug for keyword-based dynamic callable. 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. --- lib/Sema/CSApply.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Sema/CSApply.cpp b/lib/Sema/CSApply.cpp index af494476bd3b3..fc4007df2917f 100644 --- a/lib/Sema/CSApply.cpp +++ b/lib/Sema/CSApply.cpp @@ -2066,10 +2066,11 @@ namespace { } Expr *handleStringLiteralExpr(LiteralExpr *expr) { - if (cs.getType(expr) && !cs.getType(expr)->hasTypeVariable()) + auto stringLiteral = dyn_cast(expr); + if (cs.getType(expr) && !cs.getType(expr)->hasTypeVariable() + && stringLiteral->getBuiltinInitializer()) return expr; - auto stringLiteral = dyn_cast(expr); auto magicLiteral = dyn_cast(expr); assert(bool(stringLiteral) != bool(magicLiteral) && "literal must be either a string literal or a magic literal");