-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix including trivia in check for typeof identifier (#317)
- Loading branch information
1 parent
674154d
commit 8893c44
Showing
4 changed files
with
351 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
190 changes: 190 additions & 0 deletions
190
full-moon/tests/roblox_cases/pass/multiline_typeof_regression/ast.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
--- | ||
source: full-moon/tests/pass_cases.rs | ||
expression: ast.nodes() | ||
input_file: full-moon/tests/roblox_cases/pass/multiline_typeof_regression | ||
--- | ||
stmts: | ||
- - TypeDeclaration: | ||
type_token: | ||
leading_trivia: [] | ||
token: | ||
start_position: | ||
bytes: 0 | ||
line: 1 | ||
character: 1 | ||
end_position: | ||
bytes: 4 | ||
line: 1 | ||
character: 5 | ||
token_type: | ||
type: Identifier | ||
identifier: type | ||
trailing_trivia: | ||
- start_position: | ||
bytes: 4 | ||
line: 1 | ||
character: 5 | ||
end_position: | ||
bytes: 5 | ||
line: 1 | ||
character: 6 | ||
token_type: | ||
type: Whitespace | ||
characters: " " | ||
base: | ||
leading_trivia: [] | ||
token: | ||
start_position: | ||
bytes: 5 | ||
line: 1 | ||
character: 6 | ||
end_position: | ||
bytes: 11 | ||
line: 1 | ||
character: 12 | ||
token_type: | ||
type: Identifier | ||
identifier: TypeOf | ||
trailing_trivia: | ||
- start_position: | ||
bytes: 11 | ||
line: 1 | ||
character: 12 | ||
end_position: | ||
bytes: 12 | ||
line: 1 | ||
character: 13 | ||
token_type: | ||
type: Whitespace | ||
characters: " " | ||
generics: ~ | ||
equal_token: | ||
leading_trivia: [] | ||
token: | ||
start_position: | ||
bytes: 12 | ||
line: 1 | ||
character: 13 | ||
end_position: | ||
bytes: 13 | ||
line: 1 | ||
character: 14 | ||
token_type: | ||
type: Symbol | ||
symbol: "=" | ||
trailing_trivia: | ||
- start_position: | ||
bytes: 13 | ||
line: 1 | ||
character: 14 | ||
end_position: | ||
bytes: 14 | ||
line: 1 | ||
character: 14 | ||
token_type: | ||
type: Whitespace | ||
characters: "\n" | ||
declare_as: | ||
Typeof: | ||
typeof_token: | ||
leading_trivia: | ||
- start_position: | ||
bytes: 14 | ||
line: 2 | ||
character: 1 | ||
end_position: | ||
bytes: 18 | ||
line: 2 | ||
character: 5 | ||
token_type: | ||
type: Whitespace | ||
characters: " " | ||
token: | ||
start_position: | ||
bytes: 18 | ||
line: 2 | ||
character: 5 | ||
end_position: | ||
bytes: 24 | ||
line: 2 | ||
character: 11 | ||
token_type: | ||
type: Identifier | ||
identifier: typeof | ||
trailing_trivia: [] | ||
parentheses: | ||
tokens: | ||
- leading_trivia: [] | ||
token: | ||
start_position: | ||
bytes: 24 | ||
line: 2 | ||
character: 11 | ||
end_position: | ||
bytes: 25 | ||
line: 2 | ||
character: 12 | ||
token_type: | ||
type: Symbol | ||
symbol: ( | ||
trailing_trivia: [] | ||
- leading_trivia: [] | ||
token: | ||
start_position: | ||
bytes: 27 | ||
line: 2 | ||
character: 14 | ||
end_position: | ||
bytes: 28 | ||
line: 2 | ||
character: 15 | ||
token_type: | ||
type: Symbol | ||
symbol: ) | ||
trailing_trivia: | ||
- start_position: | ||
bytes: 28 | ||
line: 2 | ||
character: 15 | ||
end_position: | ||
bytes: 29 | ||
line: 2 | ||
character: 15 | ||
token_type: | ||
type: Whitespace | ||
characters: "\n" | ||
inner: | ||
TableConstructor: | ||
braces: | ||
tokens: | ||
- leading_trivia: [] | ||
token: | ||
start_position: | ||
bytes: 25 | ||
line: 2 | ||
character: 12 | ||
end_position: | ||
bytes: 26 | ||
line: 2 | ||
character: 13 | ||
token_type: | ||
type: Symbol | ||
symbol: "{" | ||
trailing_trivia: [] | ||
- leading_trivia: [] | ||
token: | ||
start_position: | ||
bytes: 26 | ||
line: 2 | ||
character: 13 | ||
end_position: | ||
bytes: 27 | ||
line: 2 | ||
character: 14 | ||
token_type: | ||
type: Symbol | ||
symbol: "}" | ||
trailing_trivia: [] | ||
fields: | ||
pairs: [] | ||
- ~ |
2 changes: 2 additions & 0 deletions
2
full-moon/tests/roblox_cases/pass/multiline_typeof_regression/source.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
type TypeOf = | ||
typeof({}) |
158 changes: 158 additions & 0 deletions
158
full-moon/tests/roblox_cases/pass/multiline_typeof_regression/tokens.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
--- | ||
source: full-moon/tests/pass_cases.rs | ||
expression: tokens | ||
input_file: full-moon/tests/roblox_cases/pass/multiline_typeof_regression | ||
--- | ||
- start_position: | ||
bytes: 0 | ||
line: 1 | ||
character: 1 | ||
end_position: | ||
bytes: 4 | ||
line: 1 | ||
character: 5 | ||
token_type: | ||
type: Identifier | ||
identifier: type | ||
- start_position: | ||
bytes: 4 | ||
line: 1 | ||
character: 5 | ||
end_position: | ||
bytes: 5 | ||
line: 1 | ||
character: 6 | ||
token_type: | ||
type: Whitespace | ||
characters: " " | ||
- start_position: | ||
bytes: 5 | ||
line: 1 | ||
character: 6 | ||
end_position: | ||
bytes: 11 | ||
line: 1 | ||
character: 12 | ||
token_type: | ||
type: Identifier | ||
identifier: TypeOf | ||
- start_position: | ||
bytes: 11 | ||
line: 1 | ||
character: 12 | ||
end_position: | ||
bytes: 12 | ||
line: 1 | ||
character: 13 | ||
token_type: | ||
type: Whitespace | ||
characters: " " | ||
- start_position: | ||
bytes: 12 | ||
line: 1 | ||
character: 13 | ||
end_position: | ||
bytes: 13 | ||
line: 1 | ||
character: 14 | ||
token_type: | ||
type: Symbol | ||
symbol: "=" | ||
- start_position: | ||
bytes: 13 | ||
line: 1 | ||
character: 14 | ||
end_position: | ||
bytes: 14 | ||
line: 1 | ||
character: 14 | ||
token_type: | ||
type: Whitespace | ||
characters: "\n" | ||
- start_position: | ||
bytes: 14 | ||
line: 2 | ||
character: 1 | ||
end_position: | ||
bytes: 18 | ||
line: 2 | ||
character: 5 | ||
token_type: | ||
type: Whitespace | ||
characters: " " | ||
- start_position: | ||
bytes: 18 | ||
line: 2 | ||
character: 5 | ||
end_position: | ||
bytes: 24 | ||
line: 2 | ||
character: 11 | ||
token_type: | ||
type: Identifier | ||
identifier: typeof | ||
- start_position: | ||
bytes: 24 | ||
line: 2 | ||
character: 11 | ||
end_position: | ||
bytes: 25 | ||
line: 2 | ||
character: 12 | ||
token_type: | ||
type: Symbol | ||
symbol: ( | ||
- start_position: | ||
bytes: 25 | ||
line: 2 | ||
character: 12 | ||
end_position: | ||
bytes: 26 | ||
line: 2 | ||
character: 13 | ||
token_type: | ||
type: Symbol | ||
symbol: "{" | ||
- start_position: | ||
bytes: 26 | ||
line: 2 | ||
character: 13 | ||
end_position: | ||
bytes: 27 | ||
line: 2 | ||
character: 14 | ||
token_type: | ||
type: Symbol | ||
symbol: "}" | ||
- start_position: | ||
bytes: 27 | ||
line: 2 | ||
character: 14 | ||
end_position: | ||
bytes: 28 | ||
line: 2 | ||
character: 15 | ||
token_type: | ||
type: Symbol | ||
symbol: ) | ||
- start_position: | ||
bytes: 28 | ||
line: 2 | ||
character: 15 | ||
end_position: | ||
bytes: 29 | ||
line: 2 | ||
character: 15 | ||
token_type: | ||
type: Whitespace | ||
characters: "\n" | ||
- start_position: | ||
bytes: 29 | ||
line: 3 | ||
character: 1 | ||
end_position: | ||
bytes: 29 | ||
line: 3 | ||
character: 1 | ||
token_type: | ||
type: Eof |