-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #16770 - roife:fix-issue-16278, r=Veykril
fix: panic when using float numbers without dots in chain calls Fix #16278. This PR fixes the panic caused by using floating-point numbers without a dot (such as `1e2`) in chain calls. ------------- Although this syntax is very odd 🤣, r-a should not panic.
- Loading branch information
Showing
3 changed files
with
109 additions
and
2 deletions.
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
88 changes: 88 additions & 0 deletions
88
crates/parser/test_data/parser/err/0054_float_split_scientific_notation.rast
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,88 @@ | ||
SOURCE_FILE | ||
STRUCT | ||
STRUCT_KW "struct" | ||
WHITESPACE " " | ||
NAME | ||
IDENT "S" | ||
TUPLE_FIELD_LIST | ||
L_PAREN "(" | ||
TUPLE_FIELD | ||
PATH_TYPE | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "i32" | ||
COMMA "," | ||
WHITESPACE " " | ||
TUPLE_FIELD | ||
PATH_TYPE | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "i32" | ||
R_PAREN ")" | ||
SEMICOLON ";" | ||
WHITESPACE "\n" | ||
FN | ||
FN_KW "fn" | ||
WHITESPACE " " | ||
NAME | ||
IDENT "f" | ||
PARAM_LIST | ||
L_PAREN "(" | ||
R_PAREN ")" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
WHITESPACE "\n " | ||
LET_STMT | ||
LET_KW "let" | ||
WHITESPACE " " | ||
IDENT_PAT | ||
NAME | ||
IDENT "s" | ||
WHITESPACE " " | ||
EQ "=" | ||
WHITESPACE " " | ||
CALL_EXPR | ||
PATH_EXPR | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "S" | ||
ARG_LIST | ||
L_PAREN "(" | ||
LITERAL | ||
INT_NUMBER "1" | ||
COMMA "," | ||
WHITESPACE " " | ||
LITERAL | ||
INT_NUMBER "2" | ||
R_PAREN ")" | ||
SEMICOLON ";" | ||
WHITESPACE "\n " | ||
LET_STMT | ||
LET_KW "let" | ||
WHITESPACE " " | ||
IDENT_PAT | ||
NAME | ||
IDENT "a" | ||
WHITESPACE " " | ||
EQ "=" | ||
WHITESPACE " " | ||
FIELD_EXPR | ||
FIELD_EXPR | ||
PATH_EXPR | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "s" | ||
DOT "." | ||
ERROR | ||
FLOAT_NUMBER "1e0" | ||
SEMICOLON ";" | ||
WHITESPACE "\n" | ||
R_CURLY "}" | ||
WHITESPACE "\n" | ||
error 42: illegal float literal |
5 changes: 5 additions & 0 deletions
5
crates/parser/test_data/parser/err/0054_float_split_scientific_notation.rs
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,5 @@ | ||
struct S(i32, i32); | ||
fn f() { | ||
let s = S(1, 2); | ||
let a = s.1e0; | ||
} |