aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/target/jvm/type.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/target/jvm/type.lux')
-rw-r--r--stdlib/source/lux/target/jvm/type.lux46
1 files changed, 28 insertions, 18 deletions
diff --git a/stdlib/source/lux/target/jvm/type.lux b/stdlib/source/lux/target/jvm/type.lux
index e5190429b..e5c7304ee 100644
--- a/stdlib/source/lux/target/jvm/type.lux
+++ b/stdlib/source/lux/target/jvm/type.lux
@@ -16,7 +16,7 @@
[encoding
["#." name (#+ External)]]]
["." / #_
- [category (#+ Void Value Return Method Primitive Object Class Array Var Parameter Declaration)]
+ [category (#+ Void Value' Value Return' Return Method Primitive Object Class Array Var Parameter Declaration)]
["#." signature (#+ Signature)]
["#." descriptor (#+ Descriptor)]
["#." reflection (#+ Reflection)]])
@@ -45,9 +45,15 @@
[signature Signature]
[descriptor Descriptor]
- [reflection Reflection]
)
+ (def: #export (reflection type)
+ (All [category]
+ (-> (Type (<| Return' Value' category))
+ (Reflection (<| Return' Value' category))))
+ (let [[signature descriptor reflection] (:representation type)]
+ reflection))
+
(template [<category> <name> <signature> <descriptor> <reflection>]
[(def: #export <name>
(Type <category>)
@@ -88,9 +94,10 @@
(def: #export (as-class type)
(-> (Type Declaration) (Type Class))
(:abstraction
- [(/signature.as-class (..signature type))
- (/descriptor.as-class (..descriptor type))
- (/reflection.as-class (..reflection type))]))
+ (let [[signature descriptor reflection] (:representation type)]
+ [(/signature.as-class signature)
+ (/descriptor.as-class descriptor)
+ (/reflection.as-class reflection)])))
(def: #export wildcard
(Type Parameter)
@@ -109,28 +116,31 @@
(def: #export (lower bound)
(-> (Type Class) (Type Parameter))
(:abstraction
- [(/signature.lower (..signature bound))
- (/descriptor.lower (..descriptor bound))
- (/reflection.lower (..reflection bound))]))
+ (let [[signature descriptor reflection] (:representation bound)]
+ [(/signature.lower signature)
+ (/descriptor.lower descriptor)
+ (/reflection.lower reflection)])))
(def: #export (upper bound)
(-> (Type Class) (Type Parameter))
(:abstraction
- [(/signature.upper (..signature bound))
- (/descriptor.upper (..descriptor bound))
- (/reflection.upper (..reflection bound))]))
+ (let [[signature descriptor reflection] (:representation bound)]
+ [(/signature.upper signature)
+ (/descriptor.upper descriptor)
+ (/reflection.upper reflection)])))
(def: #export (method [inputs output exceptions])
(-> [(List (Type Value))
(Type Return)
(List (Type Class))]
- [(Signature Method)
- (Descriptor Method)])
- [(/signature.method [(list@map ..signature inputs)
- (..signature output)
- (list@map ..signature exceptions)])
- (/descriptor.method [(list@map ..descriptor inputs)
- (..descriptor output)])])
+ (Type Method))
+ (:abstraction
+ [(/signature.method [(list@map ..signature inputs)
+ (..signature output)
+ (list@map ..signature exceptions)])
+ (/descriptor.method [(list@map ..descriptor inputs)
+ (..descriptor output)])
+ (:assume ..void)]))
(structure: #export equivalence
(All [category] (Equivalence (Type category)))