diff --git a/Ast/src/Parser.cpp b/Ast/src/Parser.cpp index 6a0edd77..b86409cc 100644 --- a/Ast/src/Parser.cpp +++ b/Ast/src/Parser.cpp @@ -2213,6 +2213,11 @@ AstExpr* Parser::parseSimpleExpr() nextLexeme(); return reportExprError(start, {}, ERROR_INVALID_INTERP_DOUBLE_BRACE); } + else if (lexer.current().type == Lexeme::BrokenInterpNoFormat) + { + nextLexeme(); + return reportExprError(start, {}, "Interpolated strings must contain expressions, and cannot be constant"); + } else if (lexer.current().type == Lexeme::Dot3) { if (functionStack.back().vararg) diff --git a/tests/Parser.test.cpp b/tests/Parser.test.cpp index e0fe1d0f..d112d80a 100644 --- a/tests/Parser.test.cpp +++ b/tests/Parser.test.cpp @@ -1075,7 +1075,7 @@ TEST_CASE_FIXTURE(Fixture, "parse_interpolated_string_without_format") } catch (const ParseErrors& e) { - CHECK_EQ("Expected identifier when parsing expression, got interpolated string with no formatting", e.getErrors().front().getMessage()); + CHECK_EQ("Interpolated strings must contain expressions, and cannot be constant", e.getErrors().front().getMessage()); } }