kiss-interpolated string literals should type as String

This commit is contained in:
2021-10-29 13:46:55 -04:00
parent 6e3d030a74
commit a45f91b5a4

View File

@@ -304,9 +304,10 @@ class Reader {
stream.dropChars(1); stream.dropChars(1);
} }
var interpExpression = assertRead(stream, k); var interpExpression = assertRead(stream, k);
interpExpression = CallExp(Symbol("Std.string").withPos(pos), [interpExpression]).withPos(pos); var b = interpExpression.expBuilder();
interpExpression = b.callSymbol("Std.string", [interpExpression]);
if (wrapInIf) { if (wrapInIf) {
interpExpression = CallExp(Symbol("if").withPos(pos), [interpExpression, interpExpression, StrExp("").withPos(pos)]).withPos(pos); interpExpression = b.callSymbol("if", [interpExpression, interpExpression, b.str("")]);
} }
stringParts.push(interpExpression); stringParts.push(interpExpression);
case '\\': case '\\':
@@ -333,7 +334,8 @@ class Reader {
return if (stringParts.length == 1) { return if (stringParts.length == 1) {
stringParts[0].def; stringParts[0].def;
} else { } else {
CallExp(Symbol("+").withPos(pos), stringParts); var b = stringParts[0].expBuilder();
b.the(b.symbol("String"), b.callSymbol("+", stringParts)).def;
}; };
default: default:
currentStringPart += next; currentStringPart += next;