aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Julian2019-05-16 23:17:07 -0400
committerEduardo Julian2019-05-16 23:17:07 -0400
commit9b59f66c8d8115a67d6eee1e7a38aa39823db222 (patch)
tree8bceefa49df4c01c304d68b0ff766c424cd6b538
parentea0cff44a5f003f8956ffbce9ea5f6957fdf4c92 (diff)
Some type casting/coercion automation.
-rw-r--r--documentation/research/database.md1
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux144
-rw-r--r--stdlib/source/lux/host.jvm.lux122
-rw-r--r--stdlib/source/lux/target/jvm/type.lux13
-rw-r--r--stdlib/source/lux/tool/compiler/phase/extension/analysis/jvm.lux59
5 files changed, 169 insertions, 170 deletions
diff --git a/documentation/research/database.md b/documentation/research/database.md
index 17a201ef5..4d3be85a6 100644
--- a/documentation/research/database.md
+++ b/documentation/research/database.md
@@ -168,6 +168,7 @@
1. https://www.slideshare.net/RoiLipman/graph-algebra
1. https://juxt.pro/crux/docs/index.html
1. https://github.com/juxt/crux
+1. [The Crux of Bitemporality - Jon Pither](https://www.youtube.com/watch?v=3Stja6YUB94)
## Column
diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux
index be2a0bace..e1e6b3c47 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux
@@ -181,7 +181,7 @@
[double::% _.DREM]
)
-(def: boolean-class (jvm.class "java.lang.Boolean" (list)))
+(def: boolean-class (jvm.class jvm.boolean-box (list)))
(def: falseI (_.GETSTATIC "java.lang.Boolean" "FALSE" boolean-class))
(def: trueI (_.GETSTATIC "java.lang.Boolean" "TRUE" boolean-class))
@@ -234,7 +234,7 @@
(def: int
Bundle
- (<| (bundle.prefix "int")
+ (<| (bundle.prefix jvm.int-reflection)
(|> (: Bundle bundle.empty)
(bundle.install "+" (binary int::+))
(bundle.install "-" (binary int::-))
@@ -253,7 +253,7 @@
(def: long
Bundle
- (<| (bundle.prefix "long")
+ (<| (bundle.prefix jvm.long-reflection)
(|> (: Bundle bundle.empty)
(bundle.install "+" (binary long::+))
(bundle.install "-" (binary long::-))
@@ -272,7 +272,7 @@
(def: float
Bundle
- (<| (bundle.prefix "float")
+ (<| (bundle.prefix jvm.float-reflection)
(|> (: Bundle bundle.empty)
(bundle.install "+" (binary float::+))
(bundle.install "-" (binary float::-))
@@ -285,7 +285,7 @@
(def: double
Bundle
- (<| (bundle.prefix "double")
+ (<| (bundle.prefix jvm.double-reflection)
(|> (: Bundle bundle.empty)
(bundle.install "+" (binary double::+))
(bundle.install "-" (binary double::-))
@@ -298,7 +298,7 @@
(def: char
Bundle
- (<| (bundle.prefix "char")
+ (<| (bundle.prefix jvm.char-reflection)
(|> (: Bundle bundle.empty)
(bundle.install "=" (binary char::=))
(bundle.install "<" (binary char::<))
@@ -308,14 +308,14 @@
(-> Nat Text Type)
(jvm.array nesting
(case elem-class
- "boolean" jvm.boolean
- "byte" jvm.byte
- "short" jvm.short
- "int" jvm.int
- "long" jvm.long
- "float" jvm.float
- "double" jvm.double
- "char" jvm.char
+ (^ (static jvm.boolean-reflection)) jvm.boolean
+ (^ (static jvm.byte-reflection)) jvm.byte
+ (^ (static jvm.short-reflection)) jvm.short
+ (^ (static jvm.int-reflection)) jvm.int
+ (^ (static jvm.long-reflection)) jvm.long
+ (^ (static jvm.float-reflection)) jvm.float
+ (^ (static jvm.double-reflection)) jvm.double
+ (^ (static jvm.char-reflection)) jvm.char
_ (jvm.class elem-class (list)))))
(def: (primitive-array-length-handler jvm-primitive)
@@ -451,47 +451,47 @@
(|> bundle.empty
(dictionary.merge (<| (bundle.prefix "length")
(|> bundle.empty
- (bundle.install "boolean" (primitive-array-length-handler jvm.boolean))
- (bundle.install "byte" (primitive-array-length-handler jvm.byte))
- (bundle.install "short" (primitive-array-length-handler jvm.short))
- (bundle.install "int" (primitive-array-length-handler jvm.int))
- (bundle.install "long" (primitive-array-length-handler jvm.long))
- (bundle.install "float" (primitive-array-length-handler jvm.float))
- (bundle.install "double" (primitive-array-length-handler jvm.double))
- (bundle.install "char" (primitive-array-length-handler jvm.char))
+ (bundle.install jvm.boolean-reflection (primitive-array-length-handler jvm.boolean))
+ (bundle.install jvm.byte-reflection (primitive-array-length-handler jvm.byte))
+ (bundle.install jvm.short-reflection (primitive-array-length-handler jvm.short))
+ (bundle.install jvm.int-reflection (primitive-array-length-handler jvm.int))
+ (bundle.install jvm.long-reflection (primitive-array-length-handler jvm.long))
+ (bundle.install jvm.float-reflection (primitive-array-length-handler jvm.float))
+ (bundle.install jvm.double-reflection (primitive-array-length-handler jvm.double))
+ (bundle.install jvm.char-reflection (primitive-array-length-handler jvm.char))
(bundle.install "object" array::length::object))))
(dictionary.merge (<| (bundle.prefix "new")
(|> bundle.empty
- (bundle.install "boolean" (new-primitive-array-handler jvm.boolean))
- (bundle.install "byte" (new-primitive-array-handler jvm.byte))
- (bundle.install "short" (new-primitive-array-handler jvm.short))
- (bundle.install "int" (new-primitive-array-handler jvm.int))
- (bundle.install "long" (new-primitive-array-handler jvm.long))
- (bundle.install "float" (new-primitive-array-handler jvm.float))
- (bundle.install "double" (new-primitive-array-handler jvm.double))
- (bundle.install "char" (new-primitive-array-handler jvm.char))
+ (bundle.install jvm.boolean-reflection (new-primitive-array-handler jvm.boolean))
+ (bundle.install jvm.byte-reflection (new-primitive-array-handler jvm.byte))
+ (bundle.install jvm.short-reflection (new-primitive-array-handler jvm.short))
+ (bundle.install jvm.int-reflection (new-primitive-array-handler jvm.int))
+ (bundle.install jvm.long-reflection (new-primitive-array-handler jvm.long))
+ (bundle.install jvm.float-reflection (new-primitive-array-handler jvm.float))
+ (bundle.install jvm.double-reflection (new-primitive-array-handler jvm.double))
+ (bundle.install jvm.char-reflection (new-primitive-array-handler jvm.char))
(bundle.install "object" array::new::object))))
(dictionary.merge (<| (bundle.prefix "read")
(|> bundle.empty
- (bundle.install "boolean" (read-primitive-array-handler jvm.boolean _.BALOAD))
- (bundle.install "byte" (read-primitive-array-handler jvm.byte _.BALOAD))
- (bundle.install "short" (read-primitive-array-handler jvm.short _.SALOAD))
- (bundle.install "int" (read-primitive-array-handler jvm.int _.IALOAD))
- (bundle.install "long" (read-primitive-array-handler jvm.long _.LALOAD))
- (bundle.install "float" (read-primitive-array-handler jvm.float _.FALOAD))
- (bundle.install "double" (read-primitive-array-handler jvm.double _.DALOAD))
- (bundle.install "char" (read-primitive-array-handler jvm.char _.CALOAD))
+ (bundle.install jvm.boolean-reflection (read-primitive-array-handler jvm.boolean _.BALOAD))
+ (bundle.install jvm.byte-reflection (read-primitive-array-handler jvm.byte _.BALOAD))
+ (bundle.install jvm.short-reflection (read-primitive-array-handler jvm.short _.SALOAD))
+ (bundle.install jvm.int-reflection (read-primitive-array-handler jvm.int _.IALOAD))
+ (bundle.install jvm.long-reflection (read-primitive-array-handler jvm.long _.LALOAD))
+ (bundle.install jvm.float-reflection (read-primitive-array-handler jvm.float _.FALOAD))
+ (bundle.install jvm.double-reflection (read-primitive-array-handler jvm.double _.DALOAD))
+ (bundle.install jvm.char-reflection (read-primitive-array-handler jvm.char _.CALOAD))
(bundle.install "object" array::read::object))))
(dictionary.merge (<| (bundle.prefix "write")
(|> bundle.empty
- (bundle.install "boolean" (write-primitive-array-handler jvm.boolean _.BASTORE))
- (bundle.install "byte" (write-primitive-array-handler jvm.byte _.BASTORE))
- (bundle.install "short" (write-primitive-array-handler jvm.short _.SASTORE))
- (bundle.install "int" (write-primitive-array-handler jvm.int _.IASTORE))
- (bundle.install "long" (write-primitive-array-handler jvm.long _.LASTORE))
- (bundle.install "float" (write-primitive-array-handler jvm.float _.FASTORE))
- (bundle.install "double" (write-primitive-array-handler jvm.double _.DASTORE))
- (bundle.install "char" (write-primitive-array-handler jvm.char _.CASTORE))
+ (bundle.install jvm.boolean-reflection (write-primitive-array-handler jvm.boolean _.BASTORE))
+ (bundle.install jvm.byte-reflection (write-primitive-array-handler jvm.byte _.BASTORE))
+ (bundle.install jvm.short-reflection (write-primitive-array-handler jvm.short _.SASTORE))
+ (bundle.install jvm.int-reflection (write-primitive-array-handler jvm.int _.IASTORE))
+ (bundle.install jvm.long-reflection (write-primitive-array-handler jvm.long _.LASTORE))
+ (bundle.install jvm.float-reflection (write-primitive-array-handler jvm.float _.FASTORE))
+ (bundle.install jvm.double-reflection (write-primitive-array-handler jvm.double _.DASTORE))
+ (bundle.install jvm.char-reflection (write-primitive-array-handler jvm.char _.CASTORE))
(bundle.install "object" array::write::object))))
)))
@@ -563,19 +563,19 @@
(case [from to]
## Wrap
(^template [<primitive> <object> <type>]
- [<primitive> <object>]
+ (^ [(static <primitive>) (static <object>)])
(wrap (|>> valueI (_.wrap <type>)))
- [<object> <primitive>]
+ (^ [(static <object>) (static <primitive>)])
(wrap (|>> valueI (_.unwrap <type>))))
- (["boolean" "java.lang.Boolean" #jvm.Boolean]
- ["byte" "java.lang.Byte" #jvm.Byte]
- ["short" "java.lang.Short" #jvm.Short]
- ["int" "java.lang.Integer" #jvm.Int]
- ["long" "java.lang.Long" #jvm.Long]
- ["float" "java.lang.Float" #jvm.Float]
- ["double" "java.lang.Double" #jvm.Double]
- ["char" "java.lang.Character" #jvm.Char])
+ ([jvm.boolean-reflection jvm.boolean-box #jvm.Boolean]
+ [jvm.byte-reflection jvm.byte-box #jvm.Byte]
+ [jvm.short-reflection jvm.short-box #jvm.Short]
+ [jvm.int-reflection jvm.int-box #jvm.Int]
+ [jvm.long-reflection jvm.long-box #jvm.Long]
+ [jvm.float-reflection jvm.float-box #jvm.Float]
+ [jvm.double-reflection jvm.double-box #jvm.Double]
+ [jvm.char-reflection jvm.char-box #jvm.Char])
_
(wrap valueI)))
@@ -598,14 +598,14 @@
(def: primitives
(Dictionary Text Primitive)
- (|> (list ["boolean" #jvm.Boolean]
- ["byte" #jvm.Byte]
- ["short" #jvm.Short]
- ["int" #jvm.Int]
- ["long" #jvm.Long]
- ["float" #jvm.Float]
- ["double" #jvm.Double]
- ["char" #jvm.Char])
+ (|> (list [jvm.boolean-reflection #jvm.Boolean]
+ [jvm.byte-reflection #jvm.Byte]
+ [jvm.short-reflection #jvm.Short]
+ [jvm.int-reflection #jvm.Int]
+ [jvm.long-reflection #jvm.Long]
+ [jvm.float-reflection #jvm.Float]
+ [jvm.double-reflection #jvm.Double]
+ [jvm.char-reflection #jvm.Char])
(dictionary.from-list text.hash)))
(def: (static::get extension-name generate inputs)
@@ -841,14 +841,14 @@
(def: primitive
(<s>.Parser Primitive)
($_ <>.or
- (<s>.constant! ["" "boolean"])
- (<s>.constant! ["" "byte"])
- (<s>.constant! ["" "short"])
- (<s>.constant! ["" "int"])
- (<s>.constant! ["" "long"])
- (<s>.constant! ["" "float"])
- (<s>.constant! ["" "double"])
- (<s>.constant! ["" "char"])
+ (<s>.constant! ["" jvm.boolean-reflection])
+ (<s>.constant! ["" jvm.byte-reflection])
+ (<s>.constant! ["" jvm.short-reflection])
+ (<s>.constant! ["" jvm.int-reflection])
+ (<s>.constant! ["" jvm.long-reflection])
+ (<s>.constant! ["" jvm.float-reflection])
+ (<s>.constant! ["" jvm.double-reflection])
+ (<s>.constant! ["" jvm.char-reflection])
))
(def: jvm-type
diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux
index 495d8a7ce..c8d413421 100644
--- a/stdlib/source/lux/host.jvm.lux
+++ b/stdlib/source/lux/host.jvm.lux
@@ -22,8 +22,9 @@
["." list ("#@." monad fold monoid)]
["." dictionary (#+ Dictionary)]]]
["." macro (#+ with-gensyms)
+ [syntax (#+ syntax:)]
["." code]
- [syntax (#+ syntax:)]]
+ ["." template]]
[target
["." jvm #_
["#" type (#+ Primitive Var Bound Class Generic Type Argument Return Typed)]]]])
@@ -1490,80 +1491,64 @@
(-> Var Code)
code.local-identifier)
-(template [<name> <unbox/box>
- <byte> <for-byte>
- <short> <for-short>
- <int> <for-int>
- <float> <for-float>]
+(template [<input?> <name> <unbox/box> <special+>]
[(def: (<name> mode [unboxed raw])
(-> Primitive-Mode [Text Code] Code)
- (let [[unboxed refined] (case mode
- #ManualPrM
- [unboxed raw]
-
- #AutoPrM
- (case unboxed
- (^ (static jvm.byte-descriptor))
- [<byte> (` (<for-byte> (~ raw)))]
-
- (^ (static jvm.short-descriptor))
- [<short> (` (<for-short> (~ raw)))]
-
- (^ (static jvm.int-descriptor))
- [<int> (` (<for-int> (~ raw)))]
-
- (^ (static jvm.float-descriptor))
- [<float> (` (<for-float> (~ raw)))]
-
- _
- [unboxed raw]))]
- (case (dictionary.get unboxed boxes)
- (#.Some boxed)
- (<unbox/box> unboxed boxed refined)
-
- #.None
- refined)))]
-
- [auto-convert-input ..unbox
- jvm.byte-descriptor ..long-to-byte
- jvm.short-descriptor ..long-to-short
- jvm.int-descriptor ..long-to-int
- jvm.float-descriptor ..double-to-float]
- [auto-convert-output ..box
- jvm.long-descriptor "jvm conversion byte-to-long"
- jvm.long-descriptor "jvm conversion short-to-long"
- jvm.long-descriptor "jvm conversion int-to-long"
- jvm.double-descriptor "jvm conversion float-to-double"]
+ (let [[unboxed refined post] (: [Text Code (List Code)]
+ (case mode
+ #ManualPrM
+ [unboxed raw (list)]
+
+ #AutoPrM
+ (`` (case unboxed
+ (^template [<old> <new> <pre> <post>]
+ (^ (static <old>))
+ (with-expansions [<post>' (template.splice <post>)]
+ [<new>
+ (` (.|> (~ raw) (~+ <pre>)))
+ (list <post>')]))
+ ((~~ (template.splice <special+>)))
+
+ _
+ [unboxed
+ (if <input?>
+ (` ("jvm object cast" (~ raw)))
+ raw)
+ (list)]))))
+ unboxed/boxed (case (dictionary.get unboxed boxes)
+ (#.Some boxed)
+ (<unbox/box> unboxed boxed refined)
+
+ #.None
+ refined)
+ post-processed (case post
+ #.Nil
+ unboxed/boxed
+
+ _
+ (` (.|> (~ unboxed/boxed) (~+ post))))]
+ post-processed))]
+
+ [#1 auto-convert-input ..unbox
+ [[jvm.byte-descriptor jvm.byte-descriptor (list (` (.: .Int)) (` (.:coerce (.primitive "java.lang.Long"))) (` ..long-to-byte)) []]
+ [jvm.short-descriptor jvm.short-descriptor (list (` (.: .Int)) (` (.:coerce (.primitive "java.lang.Long"))) (` ..long-to-short)) []]
+ [jvm.int-descriptor jvm.int-descriptor (list (` (.: .Int)) (` (.:coerce (.primitive "java.lang.Long"))) (` ..long-to-int)) []]
+ [jvm.long-descriptor jvm.long-descriptor (list (` (.: .Int)) (` (.:coerce (.primitive "java.lang.Long")))) []]
+ [jvm.float-descriptor jvm.float-descriptor (list (` (.: .Frac)) (` (.:coerce (.primitive "java.lang.Double"))) (` ..double-to-float)) []]
+ [jvm.double-descriptor jvm.double-descriptor (list (` (.: .Frac)) (` (.:coerce (.primitive "java.lang.Double")))) []]]]
+ [#0 auto-convert-output ..box
+ [[jvm.byte-descriptor jvm.long-descriptor (list (` "jvm conversion byte-to-long")) [(` (.: (.primitive "java.lang.Long"))) (` (.:coerce .Int))]]
+ [jvm.short-descriptor jvm.long-descriptor (list (` "jvm conversion short-to-long")) [(` (.: (.primitive "java.lang.Long"))) (` (.:coerce .Int))]]
+ [jvm.int-descriptor jvm.long-descriptor (list (` "jvm conversion int-to-long")) [(` (.: (.primitive "java.lang.Long"))) (` (.:coerce .Int))]]
+ [jvm.long-descriptor jvm.long-descriptor (list) [(` (.: (.primitive "java.lang.Long"))) (` (.:coerce .Int))]]
+ [jvm.float-descriptor jvm.double-descriptor (list (` "jvm conversion float-to-double")) [(` (.: (.primitive "java.lang.Double"))) (` (.:coerce .Frac))]]
+ [jvm.double-descriptor jvm.double-descriptor (list) [(` (.: (.primitive "java.lang.Double"))) (` (.:coerce .Frac))]]]]
)
(def: (un-quote quoted)
(-> Code Code)
(` ((~' ~) (~ quoted))))
-(def: (jvm-input [unboxed raw])
- (-> [Text Code] [Text Code])
- [unboxed (case unboxed
- (^ (static jvm.byte-descriptor))
- (` (.:coerce (.primitive "java.lang.Long") (.: .Int (~ raw))))
-
- (^ (static jvm.short-descriptor))
- (` (.:coerce (.primitive "java.lang.Long") (.: .Int (~ raw))))
-
- (^ (static jvm.int-descriptor))
- (` (.:coerce (.primitive "java.lang.Long") (.: .Int (~ raw))))
-
- (^ (static jvm.long-descriptor))
- (` (.:coerce (.primitive "java.lang.Long") (.: .Int (~ raw))))
-
- (^ (static jvm.float-descriptor))
- (` (.:coerce (.primitive "java.lang.Double") (.: .Frac (~ raw))))
-
- (^ (static jvm.double-descriptor))
- (` (.:coerce (.primitive "java.lang.Double") (.: .Frac (~ raw))))
-
- _
- (` ("jvm object cast" (~ raw))))])
-
(def: (jvm-invoke-inputs mode classes inputs)
(-> Primitive-Mode (List Text) (List [Bit Code]) (List Code))
(|> inputs
@@ -1572,7 +1557,7 @@
(` ((~! !!!) (~ (un-quote input))))
(un-quote input))))
(list.zip2 classes)
- (list@map (|>> jvm-input (auto-convert-input mode)))))
+ (list@map (auto-convert-input mode))))
(def: (with-class-type class expression)
(-> Text Code Code)
@@ -1695,7 +1680,6 @@
(` ((~ setter-name) (~ g!value)))
(` ((~ setter-name) (~ g!value) (~ g!obj))))
setter-value (|> [(jvm.signature import-field-type) (un-quote g!value)]
- ..jvm-input
(auto-convert-input import-field-mode))
setter-value (if import-field-maybe?
(` ((~! !!!) (~ setter-value)))
diff --git a/stdlib/source/lux/target/jvm/type.lux b/stdlib/source/lux/target/jvm/type.lux
index d8851d978..6e3269df5 100644
--- a/stdlib/source/lux/target/jvm/type.lux
+++ b/stdlib/source/lux/target/jvm/type.lux
@@ -39,6 +39,19 @@
[char-reflection "char"]
)
+(template [<name> <box>]
+ [(def: #export <name> <box>)]
+
+ [boolean-box "java.lang.Boolean"]
+ [byte-box "java.lang.Byte"]
+ [short-box "java.lang.Short"]
+ [int-box "java.lang.Integer"]
+ [long-box "java.lang.Long"]
+ [float-box "java.lang.Float"]
+ [double-box "java.lang.Double"]
+ [char-box "java.lang.Character"]
+ )
+
(def: #export array-prefix "[")
(def: object-prefix "L")
(def: var-prefix "T")
diff --git a/stdlib/source/lux/tool/compiler/phase/extension/analysis/jvm.lux b/stdlib/source/lux/tool/compiler/phase/extension/analysis/jvm.lux
index 947bbc69f..358c666c7 100644
--- a/stdlib/source/lux/tool/compiler/phase/extension/analysis/jvm.lux
+++ b/stdlib/source/lux/tool/compiler/phase/extension/analysis/jvm.lux
@@ -60,14 +60,14 @@
[(def: #export <name> .Type (#.Primitive <class> #.Nil))]
## Boxes
- [Boolean "java.lang.Boolean"]
- [Byte "java.lang.Byte"]
- [Short "java.lang.Short"]
- [Integer "java.lang.Integer"]
- [Long "java.lang.Long"]
- [Float "java.lang.Float"]
- [Double "java.lang.Double"]
- [Character "java.lang.Character"]
+ [Boolean jvm.boolean-box]
+ [Byte jvm.byte-box]
+ [Short jvm.short-box]
+ [Integer jvm.int-box]
+ [Long jvm.long-box]
+ [Float jvm.float-box]
+ [Double jvm.double-box]
+ [Character jvm.char-box]
[String "java.lang.String"]
## Primitives
@@ -354,14 +354,14 @@
(def: #export boxes
(Dictionary Text Text)
- (|> (list [jvm.boolean-reflection "java.lang.Boolean"]
- [jvm.byte-reflection "java.lang.Byte"]
- [jvm.short-reflection "java.lang.Short"]
- [jvm.int-reflection "java.lang.Integer"]
- [jvm.long-reflection "java.lang.Long"]
- [jvm.float-reflection "java.lang.Float"]
- [jvm.double-reflection "java.lang.Double"]
- [jvm.char-reflection "java.lang.Character"])
+ (|> (list [jvm.boolean-reflection jvm.boolean-box]
+ [jvm.byte-reflection jvm.byte-box]
+ [jvm.short-reflection jvm.short-box]
+ [jvm.int-reflection jvm.int-box]
+ [jvm.long-reflection jvm.long-box]
+ [jvm.float-reflection jvm.float-box]
+ [jvm.double-reflection jvm.double-box]
+ [jvm.char-reflection jvm.char-box])
(dictionary.from-list text.hash)))
(def: (array-type-info allow-primitives? arrayT)
@@ -518,10 +518,10 @@
(check-jvm outputT)
#.None
- (/////analysis.throw non-object objectT))
+ (/////analysis.throw ..non-object objectT))
_
- (/////analysis.throw non-object objectT)))
+ (/////analysis.throw ..non-object objectT)))
(def: (check-object objectT)
(-> .Type (Operation Text))
@@ -1032,17 +1032,18 @@
can-cast? (: (Operation Bit)
(case [from-name to-name]
(^template [<primitive> <object>]
- (^or (^ [(static <primitive>) <object>])
- (^ [<object> (static <primitive>)]))
+ (^or (^ [(static <primitive>) (static <object>)])
+ (^ [(static <object>) (static <primitive>)])
+ (^ [(static <primitive>) (static <primitive>)]))
(wrap #1))
- ([jvm.boolean-reflection "java.lang.Boolean"]
- [jvm.byte-reflection "java.lang.Byte"]
- [jvm.short-reflection "java.lang.Short"]
- [jvm.int-reflection "java.lang.Integer"]
- [jvm.long-reflection "java.lang.Long"]
- [jvm.float-reflection "java.lang.Float"]
- [jvm.double-reflection "java.lang.Double"]
- [jvm.char-reflection "java.lang.Character"])
+ ([jvm.boolean-reflection jvm.boolean-box]
+ [jvm.byte-reflection jvm.byte-box]
+ [jvm.short-reflection jvm.short-box]
+ [jvm.int-reflection jvm.int-box]
+ [jvm.long-reflection jvm.long-box]
+ [jvm.float-reflection jvm.float-box]
+ [jvm.double-reflection jvm.double-box]
+ [jvm.char-reflection jvm.char-box])
_
(do @
@@ -1188,7 +1189,7 @@
(dictionary.from-list text.hash))))
_
- (/////analysis.throw non-object objectT)))
+ (/////analysis.throw ..non-object objectT)))
fieldT (java-type-to-lux-type mapping fieldJT)]
(wrap [fieldT (Modifier::isFinal modifiers)]))
(/////analysis.throw not-a-virtual-field [class-name field-name]))))