diff options
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))))) |
