Fix misspelling in parser.cpp (#1330)

Fixes the mispelling of instead
This commit is contained in:
Kalrnlo 2024-07-22 18:36:17 -04:00 committed by GitHub
parent a7299c3f0f
commit 39d2c295e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 15 deletions

View File

@ -797,7 +797,7 @@ AstStat* Parser::parseAttributeStat()
} }
default: default:
return reportStatError(lexer.current().location, {}, {}, return reportStatError(lexer.current().location, {}, {},
"Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got %s intead", "Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got %s instead",
lexer.current().toString().c_str()); lexer.current().toString().c_str());
} }
} }
@ -836,7 +836,7 @@ AstStat* Parser::parseLocal(const AstArray<AstAttr*>& attributes)
{ {
if (FFlag::LuauAttributeSyntax && attributes.size != 0) if (FFlag::LuauAttributeSyntax && attributes.size != 0)
{ {
return reportStatError(lexer.current().location, {}, {}, "Expected 'function' after local declaration with attribute, but got %s intead", return reportStatError(lexer.current().location, {}, {}, "Expected 'function' after local declaration with attribute, but got %s instead",
lexer.current().toString().c_str()); lexer.current().toString().c_str());
} }
@ -981,7 +981,7 @@ AstStat* Parser::parseDeclaration(const Location& start, const AstArray<AstAttr*
// `declare` token is already parsed at this point // `declare` token is already parsed at this point
if (FFlag::LuauAttributeSyntax && (attributes.size != 0) && (lexer.current().type != Lexeme::ReservedFunction)) if (FFlag::LuauAttributeSyntax && (attributes.size != 0) && (lexer.current().type != Lexeme::ReservedFunction))
return reportStatError(lexer.current().location, {}, {}, "Expected a function type declaration after attribute, but got %s intead", return reportStatError(lexer.current().location, {}, {}, "Expected a function type declaration after attribute, but got %s instead",
lexer.current().toString().c_str()); lexer.current().toString().c_str());
if (lexer.current().type == Lexeme::ReservedFunction) if (lexer.current().type == Lexeme::ReservedFunction)
@ -2438,7 +2438,7 @@ AstExpr* Parser::parseSimpleExpr()
if (lexer.current().type != Lexeme::ReservedFunction) if (lexer.current().type != Lexeme::ReservedFunction)
{ {
return reportExprError( return reportExprError(
start, {}, "Expected 'function' declaration after attribute, but got %s intead", lexer.current().toString().c_str()); start, {}, "Expected 'function' declaration after attribute, but got %s instead", lexer.current().toString().c_str());
} }
} }

View File

@ -3334,7 +3334,7 @@ TEST_CASE_FIXTURE(Fixture, "dont_parse_attributes_on_non_function_stat")
@checked @checked
if a<0 then a = 0 end)"); if a<0 then a = 0 end)");
checkFirstErrorForAttributes(pr1.errors, 1, Location(Position(2, 0), Position(2, 2)), checkFirstErrorForAttributes(pr1.errors, 1, Location(Position(2, 0), Position(2, 2)),
"Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got 'if' intead"); "Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got 'if' instead");
ParseResult pr2 = tryParse(R"( ParseResult pr2 = tryParse(R"(
local i = 1 local i = 1
@ -3344,7 +3344,7 @@ while a[i] do
i = i + 1 i = i + 1
end)"); end)");
checkFirstErrorForAttributes(pr2.errors, 1, Location(Position(3, 0), Position(3, 5)), checkFirstErrorForAttributes(pr2.errors, 1, Location(Position(3, 0), Position(3, 5)),
"Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got 'while' intead"); "Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got 'while' instead");
ParseResult pr3 = tryParse(R"( ParseResult pr3 = tryParse(R"(
@checked @checked
@ -3355,14 +3355,14 @@ do
x2 = (-b - d)/a2 x2 = (-b - d)/a2
end)"); end)");
checkFirstErrorForAttributes(pr3.errors, 1, Location(Position(2, 0), Position(2, 2)), checkFirstErrorForAttributes(pr3.errors, 1, Location(Position(2, 0), Position(2, 2)),
"Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got 'do' intead"); "Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got 'do' instead");
ParseResult pr4 = tryParse(R"( ParseResult pr4 = tryParse(R"(
@checked @checked
for i=1,10 do print(i) end for i=1,10 do print(i) end
)"); )");
checkFirstErrorForAttributes(pr4.errors, 1, Location(Position(2, 0), Position(2, 3)), checkFirstErrorForAttributes(pr4.errors, 1, Location(Position(2, 0), Position(2, 3)),
"Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got 'for' intead"); "Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got 'for' instead");
ParseResult pr5 = tryParse(R"( ParseResult pr5 = tryParse(R"(
@checked @checked
@ -3371,7 +3371,7 @@ repeat
until line ~= "" until line ~= ""
)"); )");
checkFirstErrorForAttributes(pr5.errors, 1, Location(Position(2, 0), Position(2, 6)), checkFirstErrorForAttributes(pr5.errors, 1, Location(Position(2, 0), Position(2, 6)),
"Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got 'repeat' intead"); "Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got 'repeat' instead");
ParseResult pr6 = tryParse(R"( ParseResult pr6 = tryParse(R"(
@ -3379,7 +3379,7 @@ until line ~= ""
local x = 10 local x = 10
)"); )");
checkFirstErrorForAttributes( checkFirstErrorForAttributes(
pr6.errors, 1, Location(Position(2, 6), Position(2, 7)), "Expected 'function' after local declaration with attribute, but got 'x' intead"); pr6.errors, 1, Location(Position(2, 6), Position(2, 7)), "Expected 'function' after local declaration with attribute, but got 'x' instead");
ParseResult pr7 = tryParse(R"( ParseResult pr7 = tryParse(R"(
local i = 1 local i = 1
@ -3389,14 +3389,14 @@ while a[i] do
end end
)"); )");
checkFirstErrorForAttributes(pr7.errors, 1, Location(Position(3, 31), Position(3, 36)), checkFirstErrorForAttributes(pr7.errors, 1, Location(Position(3, 31), Position(3, 36)),
"Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got 'break' intead"); "Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got 'break' instead");
ParseResult pr8 = tryParse(R"( ParseResult pr8 = tryParse(R"(
function foo1 () @checked return 'a' end function foo1 () @checked return 'a' end
)"); )");
checkFirstErrorForAttributes(pr8.errors, 1, Location(Position(1, 26), Position(1, 32)), checkFirstErrorForAttributes(pr8.errors, 1, Location(Position(1, 26), Position(1, 32)),
"Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got 'return' intead"); "Expected 'function', 'local function', 'declare function' or a function type declaration after attribute, but got 'return' instead");
} }
TEST_CASE_FIXTURE(Fixture, "dont_parse_attribute_on_argument_non_function") TEST_CASE_FIXTURE(Fixture, "dont_parse_attribute_on_argument_non_function")
@ -3412,7 +3412,7 @@ invoker(function(x) return (x + 2) end, @checked 1)
)"); )");
checkFirstErrorForAttributes( checkFirstErrorForAttributes(
pr.errors, 1, Location(Position(5, 40), Position(5, 48)), "Expected 'function' declaration after attribute, but got '1' intead"); pr.errors, 1, Location(Position(5, 40), Position(5, 48)), "Expected 'function' declaration after attribute, but got '1' instead");
} }
TEST_CASE_FIXTURE(Fixture, "parse_attribute_on_function_type_declaration") TEST_CASE_FIXTURE(Fixture, "parse_attribute_on_function_type_declaration")
@ -3493,7 +3493,7 @@ TEST_CASE_FIXTURE(Fixture, "dont_parse_attributes_on_non_function_type_declarati
opts); opts);
checkFirstErrorForAttributes( checkFirstErrorForAttributes(
pr1.errors, 1, Location(Position(1, 17), Position(1, 20)), "Expected a function type declaration after attribute, but got 'foo' intead"); pr1.errors, 1, Location(Position(1, 17), Position(1, 20)), "Expected a function type declaration after attribute, but got 'foo' instead");
ParseResult pr2 = tryParse(R"( ParseResult pr2 = tryParse(R"(
@checked declare class Foo @checked declare class Foo
@ -3503,7 +3503,7 @@ end)",
opts); opts);
checkFirstErrorForAttributes( checkFirstErrorForAttributes(
pr2.errors, 1, Location(Position(1, 17), Position(1, 22)), "Expected a function type declaration after attribute, but got 'class' intead"); pr2.errors, 1, Location(Position(1, 17), Position(1, 22)), "Expected a function type declaration after attribute, but got 'class' instead");
ParseResult pr3 = tryParse(R"( ParseResult pr3 = tryParse(R"(
declare bit32: { declare bit32: {