diff options
| author | Mel <mel@rnrd.eu> | 2026-05-28 04:24:51 +0200 |
|---|---|---|
| committer | Mel <mel@rnrd.eu> | 2026-05-28 04:24:51 +0200 |
| commit | 4ec376b67d605910cb7757dc2e15a28a942f59ca (patch) | |
| tree | 4e98614792e5a00175fa29e705142850993d68f6 /boot/tests/parse | |
| parent | a5b24e3eedc8bd48de99cfb90abb3bececa5d29f (diff) | |
| download | catskill-4ec376b67d605910cb7757dc2e15a28a942f59ca.tar.zst catskill-4ec376b67d605910cb7757dc2e15a28a942f59ca.zip | |
Correct type modifier combinations and grouping
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'boot/tests/parse')
| -rw-r--r-- | boot/tests/parse/type_modifiers.cskt | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/boot/tests/parse/type_modifiers.cskt b/boot/tests/parse/type_modifiers.cskt new file mode 100644 index 0000000..3c639b3 --- /dev/null +++ b/boot/tests/parse/type_modifiers.cskt @@ -0,0 +1,22 @@ +checks for various type modifier combinations. +&...? should always combine into an optional reference to a type. +1-tuples should always decay into their inner element type, +allowing for usage as a group. + +<<< + +var a &int? = nil +var b &(int?) = nil +var c (int) = 0 +var d (int, bool) = nil +var e &&int = nil +var f &&int? = nil + +>>> + +(variable (declaration a (type maybe (type reference to (type name int))) (initializer (expr (name nil))))) +(variable (declaration b (type reference to (type maybe (type name int))) (initializer (expr (name nil))))) +(variable (declaration c (type name int) (initializer (expr 0)))) +(variable (declaration d (type tuple (type name int) (type name bool)) (initializer (expr (name nil))))) +(variable (declaration e (type reference to (type reference to (type name int))) (initializer (expr (name nil))))) +(variable (declaration f (type maybe (type reference to (type reference to (type name int)))) (initializer (expr (name nil))))) |
