mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Better error for constant
This commit is contained in:
parent
8e409efde8
commit
12ca7c5bb0
2 changed files with 6 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue