Basic string type

This commit is contained in:
Kampfkarren 2022-07-26 20:50:46 -07:00
parent 36b0037145
commit 477cfc4d0d
2 changed files with 11 additions and 0 deletions

View file

@ -1803,6 +1803,8 @@ WithPredicate<TypeId> TypeChecker::checkExpr(const ScopePtr& scope, const AstExp
result = checkExpr(scope, *a);
else if (auto a = expr.as<AstExprIfElse>())
result = checkExpr(scope, *a, expectedType);
else if (auto a = expr.as<AstExprInterpString>())
result = {stringType};
else
ice("Unhandled AstExpr?");

View file

@ -813,6 +813,15 @@ end
LUAU_REQUIRE_NO_ERRORS(result);
}
TEST_CASE_FIXTURE(Fixture, "tc_interpolated_string_basic")
{
CheckResult result = check(R"(
local foo: string = `hello {"world"}`
)");
LUAU_REQUIRE_NO_ERRORS(result);
}
/*
* If it wasn't instantly obvious, we have the fuzzer to thank for this gem of a test.
*