Skip to content

Commit d04c741

Browse files
committed
Move soft keyword cases to proper test
1 parent 71fd0bd commit d04c741

3 files changed

+87
-100
lines changed

parser/src/parser.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,11 @@ type X[T] = list[T] | set[T]
880880
type X[T, *Ts, **P] = (T, Ts, P)
881881
type X[T: int, *Ts, **P] = (T, Ts, P)
882882
type X[T: (int, str), *Ts, **P] = (T, Ts, P)
883+
884+
# soft keyword as alias name
885+
type type = int
886+
type match = int
887+
type case = int
883888
"#;
884889
insta::assert_debug_snapshot!(ast::Suite::parse(source, "<test>").unwrap());
885890
}
@@ -904,11 +909,8 @@ type()[a:
904909
b] # (type())[a: b]
905910
if type := 1: pass
906911
type = lambda query: query == event
907-
type type = int | str
908912
print(type(12))
909913
type(type)
910-
type match = int # other soft keyword
911-
type case = int
912914
"#;
913915
insta::assert_debug_snapshot!(ast::Suite::parse(source, "<test>").unwrap());
914916
}

parser/src/snapshots/rustpython_parser__parser__tests__parse_type_declaration.snap

Lines changed: 72 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

parser/src/snapshots/rustpython_parser__parser__tests__type_as_identifier.snap

Lines changed: 10 additions & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)