projects
/
scheme.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add case statement codegen and singleton ADTs
[scheme.git]
/
tests.scm
diff --git
a/tests.scm
b/tests.scm
index 49fc2c4bc861b13de41f454a7aa2b6e6b103d8d9..0c11e89714b89d309cae775cc7f47d3d800e752f 100644
(file)
--- a/
tests.scm
+++ b/
tests.scm
@@
-169,6
+169,19
@@
y)))
'Int)
y)))
'Int)
+ ; case statements
+(test-types
+ (typecheck '((data A (foo B))
+ (data B (bar Int))
+ (case (foo (bar 32))
+ [(foo x) x])))
+ 'B)
+
+(test-types
+ (typecheck '((case 42
+ [23 (= 1 2)]
+ [x (= x 1)])))
+ 'Bool)
; type annotations
; type annotations
@@
-282,8
+295,8
@@
(test-prog '((data Foo [a] [b] [c])
(let ([x b])
(case x
(test-prog '((data Foo [a] [b] [c])
(let ([x b])
(case x
- [a
1
]
+ [a
3
]
[b 2]
[b 2]
- [c
3
])))
+ [c
1
])))
2)
2)