Skip to content

Commit 6a6a583

Browse files
committed
Add more cases to type identifier test
1 parent 6427bda commit 6a6a583

File tree

2 files changed

+725
-15
lines changed

2 files changed

+725
-15
lines changed

parser/src/parser.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,21 @@ type X[T: (int, str), *Ts, **P] = (T, Ts, P)
888888
#[cfg(feature = "all-nodes-with-ranges")]
889889
fn test_type_as_identifier() {
890890
let source = r#"\
891+
type *a + b, c # ((type * a) + b), c
892+
type *(a + b), c # (type * (a + b)), c
893+
type (*a + b, c) # type ((*(a + b)), c)
894+
type -a * b + c # (type - (a * b)) + c
895+
type -(a * b) + c # (type - (a * b)) + c
896+
type (-a) * b + c # (type (-(a * b))) + c
897+
type ().a # (type()).a
898+
type (()).a # (type(())).a
899+
type ((),).a # (type(())).a
900+
type [a].b # (type[a]).b
901+
type [a,].b # (type[(a,)]).b (not (type[a]).b)
902+
type [(a,)].b # (type[(a,)]).b
903+
type()[a:
904+
b] # (type())[a: b]
905+
if type := 1: pass
891906
type = lambda query: query == event
892907
print(type(12))
893908
"#;

0 commit comments

Comments
 (0)