From 4ec376b67d605910cb7757dc2e15a28a942f59ca Mon Sep 17 00:00:00 2001 From: Mel Date: Thu, 28 May 2026 04:24:51 +0200 Subject: Correct type modifier combinations and grouping Signed-off-by: Mel --- boot/tests/parse/type_modifiers.cskt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 boot/tests/parse/type_modifiers.cskt (limited to 'boot/tests') 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))))) -- cgit 1.4.1