mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-19 01:18:40 +03:00
Update structty scoring to handle ConcreteNameTy
This commit is contained in:
parent
5bc08f200c
commit
e1b1a74861
32
'
Normal file
32
'
Normal file
@ -0,0 +1,32 @@
|
||||
;; Generic tests on sumtypes.
|
||||
|
||||
(load "Test.carp")
|
||||
(use Test)
|
||||
|
||||
(deftype A (F [(Fn [] Int)]))
|
||||
(deftype (Nest a) (Nested [a]))
|
||||
|
||||
(def nest (Nest.Nested (Nest.Nested (Nest.Nested 123))))
|
||||
|
||||
(defn m [a]
|
||||
(match a
|
||||
(A.F f) (f)))
|
||||
|
||||
(deftest test
|
||||
(assert-equal test
|
||||
123
|
||||
(m (A.F (fn [] 123)))
|
||||
"match adds lhs bindings to inner environments")
|
||||
(assert-equal test
|
||||
123
|
||||
(match nest
|
||||
(Nest.Nested (Nest.Nested (Nest.Nested _)))
|
||||
123)
|
||||
"Match matches nested sumtype constructors with underscores")
|
||||
(assert-equal test
|
||||
123
|
||||
(match nest
|
||||
(Nest.Nested (Nest.Nested (Nest.Nested x)))
|
||||
x)
|
||||
"Match matches nested sumtype constructors with variables")
|
||||
)
|
BIN
src/.Scoring.hs.swp
Normal file
BIN
src/.Scoring.hs.swp
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user