aboutsummaryrefslogtreecommitdiff
path: root/stdlib/test
diff options
context:
space:
mode:
authorEduardo Julian2018-05-05 20:42:41 -0400
committerEduardo Julian2018-05-05 20:42:41 -0400
commit3c93d7a3aabaa49c67f9a498bc0d70f0af7f09d0 (patch)
tree33aea74291323d5084ff70797337150b947962a8 /stdlib/test
parent88e2aee41d91deed941acc1ef650ccd3dd0334a2 (diff)
- Removed Void and Unit as kinds of types.
- Changed the value of "unit" in the old LuxC to match the one in new-luxc.
Diffstat (limited to '')
-rw-r--r--stdlib/test/test/lux/concurrency/frp.lux2
-rw-r--r--stdlib/test/test/lux/control/parser.lux2
-rw-r--r--stdlib/test/test/lux/control/region.lux2
-rw-r--r--stdlib/test/test/lux/data/format/json.lux4
-rw-r--r--stdlib/test/test/lux/lang/type.lux6
-rw-r--r--stdlib/test/test/lux/lang/type/check.lux22
-rw-r--r--stdlib/test/test/lux/macro/poly/eq.lux4
-rw-r--r--stdlib/test/test/lux/type/implicit.lux1
-rw-r--r--stdlib/test/test/lux/type/object/interface.lux4
-rw-r--r--stdlib/test/test/lux/type/object/protocol.lux24
10 files changed, 31 insertions, 40 deletions
diff --git a/stdlib/test/test/lux/concurrency/frp.lux b/stdlib/test/test/lux/concurrency/frp.lux
index e41f947fe..9630016e4 100644
--- a/stdlib/test/test/lux/concurrency/frp.lux
+++ b/stdlib/test/test/lux/concurrency/frp.lux
@@ -11,7 +11,7 @@
lux/test)
(def: (write! values channel)
- (All [a] (-> (List a) (Channel a) (IO Unit)))
+ (All [a] (-> (List a) (Channel a) (IO Top)))
(do io.Monad<IO>
[_ (monad.map @ (frp.publish channel) values)]
(wrap [])))
diff --git a/stdlib/test/test/lux/control/parser.lux b/stdlib/test/test/lux/control/parser.lux
index ae69d8ec9..c295463cf 100644
--- a/stdlib/test/test/lux/control/parser.lux
+++ b/stdlib/test/test/lux/control/parser.lux
@@ -25,7 +25,7 @@
_ false))
(def: (enforced? parser input)
- (All [s] (-> (&.Parser s Unit) s Bool))
+ (All [s] (-> (&.Parser s Top) s Bool))
(case (&.run input parser)
(#E.Success [_ []])
true
diff --git a/stdlib/test/test/lux/control/region.lux b/stdlib/test/test/lux/control/region.lux
index fc1eb7edf..429359057 100644
--- a/stdlib/test/test/lux/control/region.lux
+++ b/stdlib/test/test/lux/control/region.lux
@@ -73,7 +73,7 @@
count-clean-up (function (_ value)
(do @
[_ (thread.update n/inc clean-up-counter)]
- (wrap (: (Error Unit) (ex.throw oops [])))))]
+ (wrap (: (Error Top) (ex.throw oops [])))))]
outcome (/.run @
(do (/.Monad<Region> @)
[_ (monad.map @ (/.acquire @@ count-clean-up)
diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux
index 9e1930f3f..e2781d2a5 100644
--- a/stdlib/test/test/lux/data/format/json.lux
+++ b/stdlib/test/test/lux/data/format/json.lux
@@ -76,8 +76,7 @@
(#Addition Frac Recursive))
(type: Record
- {#unit Unit
- #bool Bool
+ {#bool Bool
#frac Frac
#text Text
#maybe (Maybe Frac)
@@ -109,7 +108,6 @@
(do r.Monad<Random>
[size (:: @ map (n/% +2) r.nat)]
($_ r.seq
- (:: @ wrap [])
r.bool
r.frac
(r.text size)
diff --git a/stdlib/test/test/lux/lang/type.lux b/stdlib/test/test/lux/lang/type.lux
index 113d279ee..0c7fa84be 100644
--- a/stdlib/test/test/lux/lang/type.lux
+++ b/stdlib/test/test/lux/lang/type.lux
@@ -29,8 +29,6 @@
(r.rec (function (_ gen-type)
($_ r.alt
(r.seq gen-name (R/wrap (list)))
- (R/wrap [])
- (R/wrap [])
(r.seq gen-type gen-type)
(r.seq gen-type gen-type)
(r.seq gen-type gen-type)
@@ -104,8 +102,8 @@
(and (L/= (list) members)
(L/= (list <unit>) flat)))))]
- ["variant" &.variant &.flatten-variant Void]
- ["tuple" &.tuple &.flatten-tuple Unit]
+ ["variant" &.variant &.flatten-variant Bottom]
+ ["tuple" &.tuple &.flatten-tuple Top]
)]
($_ seq
<struct-tests>
diff --git a/stdlib/test/test/lux/lang/type/check.lux b/stdlib/test/test/lux/lang/type/check.lux
index 48a3f35cb..e10ac5514 100644
--- a/stdlib/test/test/lux/lang/type/check.lux
+++ b/stdlib/test/test/lux/lang/type/check.lux
@@ -32,8 +32,6 @@
(r.rec (function (_ gen-type)
($_ r.alt
(r.seq gen-name (r/wrap (list)))
- (r/wrap [])
- (r/wrap [])
(r.seq gen-type gen-type)
(r.seq gen-type gen-type)
(r.seq gen-type gen-type)
@@ -52,7 +50,7 @@
(#.Primitive name params)
(list.every? valid-type? params)
- (^or #.Void #.Unit (#.Ex id))
+ (#.Ex id)
true
(^template [<tag>]
@@ -90,9 +88,9 @@
(context: "Simple type-checking."
($_ seq
- (test "Unit and Void match themselves."
- (and (@.checks? Void Void)
- (@.checks? Unit Unit)))
+ (test "Top and Bottom match themselves."
+ (and (@.checks? Bottom Bottom)
+ (@.checks? Top Top)))
(test "Existential types only match with themselves."
(and (type-checks? (do @.Monad<Check>
@@ -166,28 +164,28 @@
(test "Can bind unbound type-vars by type-checking against them."
(and (type-checks? (do @.Monad<Check>
[[id var] @.var]
- (@.check var #.Unit)))
+ (@.check var .Top)))
(type-checks? (do @.Monad<Check>
[[id var] @.var]
- (@.check #.Unit var)))))
+ (@.check .Top var)))))
(test "Cannot rebind already bound type-vars."
(not (type-checks? (do @.Monad<Check>
[[id var] @.var
- _ (@.check var #.Unit)]
- (@.check var #.Void)))))
+ _ (@.check var .Bool)]
+ (@.check var .Nat)))))
(test "If the type bound to a var is a super-type to another, then the var is also a super-type."
(type-checks? (do @.Monad<Check>
[[id var] @.var
_ (@.check var Top)]
- (@.check var #.Unit))))
+ (@.check var .Bool))))
(test "If the type bound to a var is a sub-type of another, then the var is also a sub-type."
(type-checks? (do @.Monad<Check>
[[id var] @.var
_ (@.check var Bottom)]
- (@.check #.Unit var))))
+ (@.check .Bool var))))
))
(def: (build-ring num-connections)
diff --git a/stdlib/test/test/lux/macro/poly/eq.lux b/stdlib/test/test/lux/macro/poly/eq.lux
index 4605de5d2..d22475b11 100644
--- a/stdlib/test/test/lux/macro/poly/eq.lux
+++ b/stdlib/test/test/lux/macro/poly/eq.lux
@@ -26,8 +26,7 @@
(#Addition Frac Recursive))
(type: Record
- {#unit Unit
- #bool Bool
+ {#bool Bool
#int Int
#frac Frac
#text Text
@@ -49,7 +48,6 @@
[size (:: @ map (n/% +2) r.nat)
#let [gen-int (|> r.int (:: @ map (|>> int/abs (i/% 1_000_000))))]]
($_ r.seq
- (:: @ wrap [])
r.bool
gen-int
r.frac
diff --git a/stdlib/test/test/lux/type/implicit.lux b/stdlib/test/test/lux/type/implicit.lux
index a4dee260e..2ae01ed1b 100644
--- a/stdlib/test/test/lux/type/implicit.lux
+++ b/stdlib/test/test/lux/type/implicit.lux
@@ -6,7 +6,6 @@
[eq])
(data [number]
[bool "bool/" Eq<Bool>]
- maybe
(coll [list]))
["r" math/random]
(type implicit))
diff --git a/stdlib/test/test/lux/type/object/interface.lux b/stdlib/test/test/lux/type/object/interface.lux
index a296d9558..7def3113a 100644
--- a/stdlib/test/test/lux/type/object/interface.lux
+++ b/stdlib/test/test/lux/type/object/interface.lux
@@ -23,7 +23,7 @@
(class: NatRC Resettable-Counter
#super NatC
- Unit
+ Top
(def: reset
(set@Counter +0)))
@@ -48,7 +48,7 @@
(class: (ListI a) (Iterable a)
#super (ListC a)
- Unit
+ Top
(def: enumerate
get@Collection))
diff --git a/stdlib/test/test/lux/type/object/protocol.lux b/stdlib/test/test/lux/type/object/protocol.lux
index d6596950b..e5a8dda4b 100644
--- a/stdlib/test/test/lux/type/object/protocol.lux
+++ b/stdlib/test/test/lux/type/object/protocol.lux
@@ -3,10 +3,10 @@
(lux (data text/format)
(type (object protocol))))
-(type: Counter (Object (Method Unit Nat)))
+(type: Counter (Object (Method Top Nat)))
(def: (count [tick return] state)
- (Class Nat (Method Unit Nat))
+ (Class Nat (Method Top Nat))
(let [state' (n/inc state)]
[(return state') state']))
@@ -48,20 +48,20 @@
(read [] a))
(def: (readM [tick return] state)
- (All [s] (Class s (Method Unit s)))
+ (All [s] (Class s (Method Top s)))
[(return state) state])
(protocol: (Add n)
- (+ n Unit)
- (- n Unit))
+ (+ n Top)
+ (- n Top))
(protocol: (Mul n)
- (* n Unit)
- (/ n Unit))
+ (* n Top)
+ (/ n Top))
(do-template [<name> <op>]
[(def: (<name> [diff return] state)
- (Class Nat (Method Nat Unit))
+ (Class Nat (Method Nat Top))
[(return []) (<op> diff state)])]
[+M n/+]
@@ -108,11 +108,11 @@
(numberO (+0 (read []))))
(def: _test3
- [Unit NatO]
+ [Top NatO]
(numberO (+1 (+0 (+ +123)))))
(def: _test4
- [Unit NatO]
+ [Top NatO]
(numberO (+1 (+1 (* +123)))))
## TODO: Fix when new-luxc is the official compiler.
@@ -121,9 +121,9 @@
## (numberO (^read (read []))))
## (def: _test3
-## [Unit NatO]
+## [Top NatO]
## (numberO (^add (+ +123))))
## (def: _test4
-## [Unit NatO]
+## [Top NatO]
## (numberO (^mul (* +123))))