Experimental typeCase macro

This commit is contained in:
2022-12-16 02:35:46 +00:00
parent 60880215fd
commit 249d9fc787
3 changed files with 78 additions and 1 deletions

View File

@@ -757,4 +757,17 @@ From:[(assert false (+ \"false \" \"should \" \"have \" \"been \" \"true\"))]" m
(let [u "good"]
(localVar v "bad")
(printLocalNulls))
(Assert.pass))
(Assert.pass))
(function :Void _testTypeCase []
(typeCase ["a"]
([:String a]
(Assert.equals "a" a)))
(typeCase ["a" 1]
(never [:String a :String one])
([:String a :Int one]
(Assert.equals "a1" "${a}${one}")))
(typeCase ["a" 5 5.5 true]
([:String a :Int five :Float fivePointFive :Bool tt]
(Assert.equals "a55.5true" "${a}${five}${fivePointFive}${tt}"))
(never otherwise)))