From 477cfc4d0d12c0b54806a3c4b2e95baf8512d512 Mon Sep 17 00:00:00 2001 From: Kampfkarren Date: Tue, 26 Jul 2022 20:50:46 -0700 Subject: [PATCH] Basic string type --- Analysis/src/TypeInfer.cpp | 2 ++ tests/TypeInfer.test.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/Analysis/src/TypeInfer.cpp b/Analysis/src/TypeInfer.cpp index d460160c..9b00842d 100644 --- a/Analysis/src/TypeInfer.cpp +++ b/Analysis/src/TypeInfer.cpp @@ -1803,6 +1803,8 @@ WithPredicate TypeChecker::checkExpr(const ScopePtr& scope, const AstExp result = checkExpr(scope, *a); else if (auto a = expr.as()) result = checkExpr(scope, *a, expectedType); + else if (auto a = expr.as()) + result = {stringType}; else ice("Unhandled AstExpr?"); diff --git a/tests/TypeInfer.test.cpp b/tests/TypeInfer.test.cpp index 858e8ac0..4c6c2feb 100644 --- a/tests/TypeInfer.test.cpp +++ b/tests/TypeInfer.test.cpp @@ -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. *