aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/type/variance.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-06-12 01:32:40 -0400
committerEduardo Julian2021-06-12 01:32:40 -0400
commitaf3e6e2cb011dc2ad9204440990731a2f272716d (patch)
tree3521c74b05fc5b3ddddbe901d32ace87dbb6c018 /stdlib/source/test/lux/type/variance.lux
parent8f575da5095e3b259d4eb6b6f13d3e37ef1d38e4 (diff)
Constraining the year of the snapshot time in Aedifex.
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/type/variance.lux34
1 files changed, 34 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/type/variance.lux b/stdlib/source/test/lux/type/variance.lux
new file mode 100644
index 000000000..83927d03c
--- /dev/null
+++ b/stdlib/source/test/lux/type/variance.lux
@@ -0,0 +1,34 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]]
+ [math
+ ["." random (#+ Random)]]]
+ {1
+ ["." /
+ ["/#" // #_
+ ["#." check]]]})
+
+(type: Super
+ (Ex [sub] [Text sub]))
+
+(type: Sub
+ (Super Bit))
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ ($_ _.and
+ (_.cover [/.Co]
+ (and (//check.checks? (type (/.Co Super)) (type (/.Co Sub)))
+ (not (//check.checks? (type (/.Co Sub)) (type (/.Co Super))))))
+ (_.cover [/.Contra]
+ (and (//check.checks? (type (/.Contra Sub)) (type (/.Contra Super)))
+ (not (//check.checks? (type (/.Contra Super)) (type (/.Contra Sub))))))
+ (_.cover [/.In]
+ (and (//check.checks? (type (/.In Super)) (type (/.In Super)))
+ (//check.checks? (type (/.In Sub)) (type (/.In Sub)))
+ (not (//check.checks? (type (/.In Sub)) (type (/.In Super))))
+ (not (//check.checks? (type (/.In Super)) (type (/.In Sub))))))
+ )))