diff options
Diffstat (limited to 'stdlib/source')
22 files changed, 155 insertions, 152 deletions
diff --git a/stdlib/source/lux/abstract/monad.lux b/stdlib/source/lux/abstract/monad.lux index 2d086fcf3..f0444a4cf 100644 --- a/stdlib/source/lux/abstract/monad.lux +++ b/stdlib/source/lux/abstract/monad.lux @@ -155,12 +155,3 @@ (do monad [init' (f x init)] (fold monad f init' xs')))) - -(def: #export (lift monad f) - {#.doc "Lift a normal function into the space of monads."} - (All [M a b] - (-> (Monad M) (-> a b) (-> (M a) (M b)))) - (function (_ ma) - (do monad - [a ma] - (wrap (f a))))) diff --git a/stdlib/source/lux/control/try.lux b/stdlib/source/lux/control/try.lux index e4e4cae4a..20d4dcab7 100644 --- a/stdlib/source/lux/control/try.lux +++ b/stdlib/source/lux/control/try.lux @@ -76,7 +76,7 @@ (def: #export (lift monad) (All [M a] (-> (Monad M) (-> (M a) (M (Try a))))) - (monad.lift monad (:: ..monad wrap))) + (:: monad map (:: ..monad wrap))) (structure: #export (equivalence (^open ",@.")) (All [a] (-> (Equivalence a) (Equivalence (Try a)))) diff --git a/stdlib/source/lux/data/collection/list.lux b/stdlib/source/lux/data/collection/list.lux index cec488e95..dd8e3f09b 100644 --- a/stdlib/source/lux/data/collection/list.lux +++ b/stdlib/source/lux/data/collection/list.lux @@ -563,7 +563,7 @@ (def: #export (lift monad) (All [M a] (-> (Monad M) (-> (M a) (M (List a))))) - (monad.lift monad (:: ..monad wrap))) + (:: monad map (:: ..monad wrap))) (def: (enumerate' idx xs) (All [a] (-> Nat (List a) (List [Nat a]))) diff --git a/stdlib/source/lux/data/maybe.lux b/stdlib/source/lux/data/maybe.lux index 3ba5e87e9..3a8bc8497 100644 --- a/stdlib/source/lux/data/maybe.lux +++ b/stdlib/source/lux/data/maybe.lux @@ -84,7 +84,7 @@ (def: #export (lift monad) (All [M a] (-> (Monad M) (-> (M a) (M (Maybe a))))) - (monad.lift monad (:: ..monad wrap))) + (:: monad map (:: ..monad wrap))) (macro: #export (default tokens state) {#.doc (doc "Allows you to provide a default value that will be used" diff --git a/stdlib/source/lux/target/jvm/attribute/constant.lux b/stdlib/source/lux/target/jvm/attribute/constant.lux index dd8c7c395..debf07abe 100644 --- a/stdlib/source/lux/target/jvm/attribute/constant.lux +++ b/stdlib/source/lux/target/jvm/attribute/constant.lux @@ -12,7 +12,7 @@ ["#." unsigned (#+ U2 U4)]]]) (type: #export Constant - (Index (Value Any))) + (Index Value)) (def: #export equivalence (Equivalence Constant) diff --git a/stdlib/source/lux/target/jvm/descriptor.lux b/stdlib/source/lux/target/jvm/descriptor.lux index 267835e1b..5452c16c7 100644 --- a/stdlib/source/lux/target/jvm/descriptor.lux +++ b/stdlib/source/lux/target/jvm/descriptor.lux @@ -1,7 +1,12 @@ (.module: [lux (#- int char) + [abstract + [equivalence (#+ Equivalence)]] [data - ["." text + ["." maybe] + [number + ["n" nat]] + ["." text ("#@." equivalence) ["%" format (#+ format)]] [collection ["." list ("#@." functor)]]] @@ -25,53 +30,65 @@ Text - (type: #export (Value kind) (Return (Value' kind))) + (type: #export Value (<| Return Value' Any)) (type: #export Void (Return Void')) - (type: #export Field (Value Any)) + (type: #export Field Value) - (template [<refined>] - [(with-expansions [<raw> (template.identifier [<refined> "'"])] + (abstract: #export (Object' brand) {} Any) + (type: #export Object (<| Return Value' Object' Any)) + + (template [<parents> <child>] + [(with-expansions [<raw> (template.identifier [<child> "'"])] (abstract: #export <raw> {} Any) - (type: #export <refined> (Value <raw>)))] + (type: #export <child> + (`` (<| Return Value' (~~ (template.splice <parents>)) <raw>))))] - [Primitive] - [Object] - [Array] + [[] Primitive] + [[Object'] Class] + [[Object'] Array] ) - (template [<sigil> <name> <kind>] + (template [<sigil> <kind> <name>] [(def: #export <name> (Descriptor <kind>) (:abstraction <sigil>))] - ["Z" boolean Primitive] - ["B" byte Primitive] - ["S" short Primitive] - ["I" int Primitive] - ["J" long Primitive] - ["F" float Primitive] - ["D" double Primitive] - ["C" char Primitive] - ["V" void Void] + ["Z" Primitive boolean] + ["B" Primitive byte] + ["S" Primitive short] + ["I" Primitive int] + ["J" Primitive long] + ["F" Primitive float] + ["D" Primitive double] + ["C" Primitive char] + ["V" Void void] ) - (def: #export object - (-> External (Descriptor Object)) + (def: class-prefix "L") + (def: class-suffix ";") + + (def: #export class + (-> External (Descriptor Class)) (|>> //name.internal //name.read - (text.enclose ["L" ";"]) + (text.enclose [..class-prefix ..class-suffix]) :abstraction)) + (def: #export var (..class "java.lang.Object")) + (def: #export wildcard (..class "java.lang.Object")) + + (def: array-prefix "[") + (def: #export array - (-> (Descriptor (Value Any)) + (-> (Descriptor Value) (Descriptor Array)) (|>> :representation - (format "[") + (format ..array-prefix) :abstraction)) (def: #export (method [inputs output]) - (-> [(List (Descriptor (Value Any))) + (-> [(List (Descriptor Value)) (Descriptor (Return Any))] (Descriptor Method)) (:abstraction @@ -84,4 +101,54 @@ (def: #export descriptor (-> (Descriptor Any) Text) (|>> :representation)) + + (structure: #export equivalence (All [brand] (Equivalence (Descriptor brand))) + (def: (= parameter subject) + (text@= (:representation parameter) (:representation subject)))) + + (def: #export (primitive? descriptor) + (-> (Descriptor Value) (Either (Descriptor Object) + (Descriptor Primitive))) + (if (`` (or (~~ (template [<descriptor>] + [(:: ..equivalence = <descriptor> descriptor)] + + [..boolean] + [..byte] + [..short] + [..int] + [..long] + [..float] + [..double] + [..char])))) + (|> descriptor :transmutation #.Right) + (|> descriptor :transmutation #.Left))) + + (def: #export (class? descriptor) + (-> (Descriptor Value) (Maybe Text)) + (let [repr (:representation descriptor)] + (if (and (text.starts-with? ..class-prefix repr) + (text.ends-with? ..class-suffix repr)) + (:: maybe.monad map + (|>> //name.internal //name.external) + (text.clip (text.size ..class-prefix) + (n.- (text.size ..class-suffix) + (text.size repr)) + repr)) + #.None))) + + (def: #export class-name + (-> (Descriptor Object) Text) + (let [prefix-size (text.size ..class-prefix) + suffix-size (text.size ..class-suffix)] + (function (_ descriptor) + (let [repr (:representation descriptor)] + (if (text.starts-with? ..array-prefix repr) + repr + (|> repr + (text.clip prefix-size + (n.- suffix-size + (text.size repr))) + (:: maybe.monad map + (|>> //name.internal //name.external)) + maybe.assume)))))) ) diff --git a/stdlib/source/lux/target/jvm/field.lux b/stdlib/source/lux/target/jvm/field.lux index a2cc35f45..b6dc1b946 100644 --- a/stdlib/source/lux/target/jvm/field.lux +++ b/stdlib/source/lux/target/jvm/field.lux @@ -26,7 +26,7 @@ (type: #export #rec Field {#modifier (Modifier Field) #name (Index UTF8) - #descriptor (Index (Descriptor (Value Any))) + #descriptor (Index (Descriptor Value)) #attributes (Row Attribute)}) (modifiers: Field @@ -62,7 +62,7 @@ ))) (def: #export (field modifier name descriptor attributes) - (-> (Modifier Field) UTF8 (Descriptor (Value Any)) (Row Attribute) + (-> (Modifier Field) UTF8 (Descriptor Value) (Row Attribute) (State Pool Field)) (do state.monad [@name (//constant/pool.utf8 name) diff --git a/stdlib/source/lux/target/jvm/instruction.lux b/stdlib/source/lux/target/jvm/instruction.lux index 628079110..36fa103dd 100644 --- a/stdlib/source/lux/target/jvm/instruction.lux +++ b/stdlib/source/lux/target/jvm/instruction.lux @@ -541,7 +541,7 @@ (template [<static?> <name> <bytecode>] [(def: #export (<name> class method [inputs output]) - (-> External Text [(List (Descriptor (Value Any))) (Descriptor (Return Any))] (Instruction Any)) + (-> External Text [(List (Descriptor Value)) (Descriptor (Return Any))] (Instruction Any)) (do ..monad [index (<| ..lift (//constant/pool.method class) diff --git a/stdlib/source/lux/target/jvm/reflection.lux b/stdlib/source/lux/target/jvm/reflection.lux index 89f759dcb..e6ee7e630 100644 --- a/stdlib/source/lux/target/jvm/reflection.lux +++ b/stdlib/source/lux/target/jvm/reflection.lux @@ -18,7 +18,9 @@ ["." list ("#@." fold functor)] ["." array] ["." dictionary]]]] - [// + ["." // #_ + [encoding + ["#." name]] ["/" type ["#." lux (#+ Mapping)] ["." reflection]]]) @@ -205,7 +207,7 @@ class-name (if (text.starts-with? /.array-prefix class-name) - (<t>.run /.parse-signature (/.binary-name class-name)) + (<t>.run /.parse-signature (|> class-name //name.internal //name.read)) (#try.Success (/.class class-name (list))))) _) (case (host.check java/lang/reflect/GenericArrayType reflection) diff --git a/stdlib/source/lux/target/jvm/type.lux b/stdlib/source/lux/target/jvm/type.lux index fffac9b6e..4601003a8 100644 --- a/stdlib/source/lux/target/jvm/type.lux +++ b/stdlib/source/lux/target/jvm/type.lux @@ -12,7 +12,10 @@ ["." text ("#@." equivalence) ["%" format (#+ format)]] [collection - ["." list ("#@." functor)]]]]) + ["." list ("#@." functor)]]]] + ["." // #_ + [encoding + ["#." name]]]) (template [<descriptor> <definition>] [(def: #export <definition> <descriptor>)] @@ -31,7 +34,7 @@ (def: #export array-prefix "[") (def: object-prefix "L") (def: var-prefix "T") -(def: wildcard-descriptor "*") +(def: wildcard-signature "*") (def: lower-prefix "-") (def: upper-prefix "+") (def: object-suffix ";") @@ -46,14 +49,11 @@ (format valid-var-characters/head "0123456789")) -(def: syntax-package-separator ".") -(def: binary-package-separator "/") - (def: valid-class-characters/head - (format valid-var-characters/head ..binary-package-separator)) + (format valid-var-characters/head //name.internal-separator)) (def: valid-class-characters/tail - (format valid-var-characters/tail ..binary-package-separator)) + (format valid-var-characters/tail //name.internal-separator)) (type: #export Bound #Lower @@ -210,59 +210,6 @@ 0 elemT _ (#Array (array (dec depth) elemT)))) -(template [<name> <from> <to>] - [(def: #export <name> - (-> Text Text) - (text.replace-all <from> <to>))] - - [binary-name ..syntax-package-separator ..binary-package-separator] - [syntax-name ..binary-package-separator ..syntax-package-separator] - ) - -(def: #export (descriptor type) - (-> Type Text) - (case type - (#Primitive prim) - (case prim - #Boolean ..boolean-descriptor - #Byte ..byte-descriptor - #Short ..short-descriptor - #Int ..int-descriptor - #Long ..long-descriptor - #Float ..float-descriptor - #Double ..double-descriptor - #Char ..char-descriptor) - - (#Array sub) - (format ..array-prefix (descriptor sub)) - - (#Generic generic) - (case generic - (#Class class params) - (format ..object-prefix (binary-name class) ..object-suffix) - - (^or (#Var name) (#Wildcard ?bound)) - (descriptor (#Generic (#Class ..object-class (list))))) - )) - -(def: #export (class-name type) - (-> Type (Maybe Text)) - (case type - (#Primitive prim) - #.None - - (#Array sub) - (#.Some (descriptor type)) - - (#Generic generic) - (case generic - (#Class class params) - (#.Some class) - - (^or (#Var name) (#Wildcard ?bound)) - (#.Some ..object-class)) - )) - (def: #export (signature type) (-> Type Text) (case type @@ -290,13 +237,13 @@ (list@map (|>> #Generic signature)) (text.join-with "")) ">"))] - (format ..object-prefix (binary-name class) =params ..object-suffix)) + (format ..object-prefix (|> class //name.internal //name.read) =params ..object-suffix)) (#Var name) (format ..var-prefix name ..object-suffix) (#Wildcard #.None) - ..wildcard-descriptor + ..wildcard-signature (^template [<tag> <prefix>] (#Wildcard (#.Some [<tag> bound])) @@ -312,7 +259,7 @@ (<t>.slice (<t>.and! (<t>.one-of! <head>) (<t>.some! (<t>.one-of! <tail>))))))] - [parse-class-name valid-class-characters/head valid-class-characters/tail ..syntax-name] + [parse-class-name valid-class-characters/head valid-class-characters/tail (|>> //name.internal //name.external)] [parse-var-name valid-var-characters/head valid-var-characters/tail function.identity] ) @@ -335,7 +282,7 @@ ($_ <>.or ..parse-var ($_ <>.or - (<t>.this ..wildcard-descriptor) + (<t>.this ..wildcard-signature) (<>.and ..parse-bound recur) ) (|> (<>.and ..parse-class-name @@ -371,22 +318,12 @@ (-> (List Type) (Maybe Type) (List Generic) Method) {#args args #return return #exceptions exceptions}) -(def: method-args - (text.enclose ["(" ")"])) - -(def: #export (method-descriptor method) - (-> Method Text) - (format (|> (get@ #args method) (list@map descriptor) (text.join-with "") ..method-args) - (case (get@ #return method) - #.None - ..void-descriptor - - (#.Some return) - (descriptor return)))) - (def: #export (method-signature method) (-> Method Text) - (format (|> (get@ #args method) (list@map signature) (text.join-with "") ..method-args) + (format (|> (get@ #args method) + (list@map signature) + (text.join-with "") + (text.enclose ["(" ")"])) (case (get@ #return method) #.None ..void-descriptor diff --git a/stdlib/source/lux/target/jvm/type/lux.lux b/stdlib/source/lux/target/jvm/type/lux.lux index cc207e1d6..1ebf4b74e 100644 --- a/stdlib/source/lux/target/jvm/type/lux.lux +++ b/stdlib/source/lux/target/jvm/type/lux.lux @@ -14,7 +14,10 @@ abstract ["." check (#+ Check) ("#@." monad)]]] ["." // - ["#." reflection]]) + ["#." reflection] + ["/#" // #_ + [encoding + ["#." name]]]]) (template [<name>] [(abstract: #export (<name> class) {} Any)] @@ -95,12 +98,12 @@ (#//.Array elementT) (case elementT (#//.Primitive primitive) - (check@wrap (#.Primitive (//.descriptor input) #.Nil)) + (check@wrap (#.Primitive (|> input //reflection.class ///name.internal ///name.read) #.Nil)) _ - (do check.monad - [elementT (type mapping elementT)] - (wrap (.type (Array elementT))))))) + (:: check.monad map + (|>> Array .type) + (type mapping elementT))))) (def: #export (return mapping input) (-> Mapping //.Return (Check Type)) diff --git a/stdlib/source/lux/target/jvm/type/reflection.lux b/stdlib/source/lux/target/jvm/type/reflection.lux index 6526256b7..b74a4ea30 100644 --- a/stdlib/source/lux/target/jvm/type/reflection.lux +++ b/stdlib/source/lux/target/jvm/type/reflection.lux @@ -1,5 +1,8 @@ (.module: - [lux (#- int char)] + [lux (#- int char) + [data + [text + ["%" format (#+ format)]]]] ["." //]) (template [<name> <reflection>] @@ -31,12 +34,12 @@ #//.Char ..char) (#//.Array sub) - (//.syntax-name (//.descriptor type)) + (|> sub class (format //.array-prefix)) (#//.Generic generic) (case generic - (#//.Class class params) - (//.syntax-name class) + (#//.Class name params) + name (^or (#//.Var name) (#//.Wildcard #.None) 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 85d7524f9..af85ebf1c 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension/analysis/jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension/analysis/jvm.lux @@ -281,7 +281,7 @@ (^ (list arrayC)) (do ////.monad [_ (typeA.infer ..int) - arrayA (typeA.with-type (#.Primitive (jvm.descriptor (jvm.array 1 primitive-type)) (list)) + arrayA (typeA.with-type (#.Primitive (reflection.class (jvm.array 1 primitive-type)) (list)) (analyse arrayC))] (wrap (#/////analysis.Extension extension-name (list arrayA)))) @@ -315,7 +315,7 @@ (do ////.monad [lengthA (typeA.with-type ..int (analyse lengthC)) - _ (typeA.infer (#.Primitive (jvm.descriptor (jvm.array 1 primitive-type)) (list)))] + _ (typeA.infer (#.Primitive (reflection.class (jvm.array 1 primitive-type)) (list)))] (wrap (#/////analysis.Extension extension-name (list lengthA)))) _ @@ -415,7 +415,7 @@ (-> .Type (Operation Text)) (if (is? .Any type) (////@wrap jvm.void-descriptor) - (////@map jvm.descriptor (check-jvm type)))) + (////@map reflection.class (check-jvm type)))) (def: (read-primitive-array-handler lux-type jvm-type) (-> .Type Type Handler) @@ -426,7 +426,7 @@ [_ (typeA.infer lux-type) idxA (typeA.with-type ..int (analyse idxC)) - arrayA (typeA.with-type (#.Primitive (jvm.descriptor (jvm.array 1 jvm-type)) (list)) + arrayA (typeA.with-type (#.Primitive (reflection.class (jvm.array 1 jvm-type)) (list)) (analyse arrayC))] (wrap (#/////analysis.Extension extension-name (list idxA arrayA)))) @@ -458,7 +458,7 @@ (def: (write-primitive-array-handler lux-type jvm-type) (-> .Type Type Handler) - (let [array-type (#.Primitive (jvm.descriptor (jvm.array 1 jvm-type)) (list))] + (let [array-type (#.Primitive (reflection.class (jvm.array 1 jvm-type)) (list))] (function (_ extension-name analyse args) (case args (^ (list idxC valueC arrayC)) @@ -924,7 +924,7 @@ [parameters (|> (java/lang/reflect/Method::getGenericParameterTypes method) array.to-list (monad.map try.monad reflection!.type) - (:: try.monad map (list@map jvm.descriptor)) + (:: try.monad map (list@map reflection.class)) ////.lift) #let [modifiers (java/lang/reflect/Method::getModifiers method) correct-class? (java/lang/Object::equals class (java/lang/reflect/Method::getDeclaringClass method)) @@ -961,7 +961,7 @@ [parameters (|> (java/lang/reflect/Constructor::getGenericParameterTypes constructor) array.to-list (monad.map try.monad reflection!.type) - (:: try.monad map (list@map jvm.descriptor)) + (:: try.monad map (list@map reflection.class)) ////.lift)] (wrap (and (java/lang/Object::equals class (java/lang/reflect/Constructor::getDeclaringClass constructor)) (n.= (list.size arg-classes) (list.size parameters)) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/field/foreign.lux b/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/field/foreign.lux index b4fa6727e..91e06c383 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/field/foreign.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/field/foreign.lux @@ -20,7 +20,7 @@ [analysis (#+ Environment)]]]]) (def: #export (closure environment) - (-> Environment (List (Descriptor (Value Any)))) + (-> Environment (List (Descriptor Value))) (list.repeat (list.size environment) ////value.type)) (def: #export fields diff --git a/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/apply.lux b/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/apply.lux index 3971610ff..d2f2b9380 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/apply.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/apply.lux @@ -27,7 +27,7 @@ (def: #export name "apply") (def: #export (type arity) - (-> Arity [(List (Descriptor (Value Any))) (Descriptor (Return Any))]) + (-> Arity [(List (Descriptor Value)) (Descriptor (Return Any))]) [(list.repeat arity ////value.type) ////value.type]) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/init.lux b/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/init.lux index 0489b8f12..5a53ff9e0 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/init.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/init.lux @@ -14,7 +14,7 @@ ["." arity (#+ Arity)]]]]) (def: #export type - [(List (Descriptor (Value Any))) + [(List (Descriptor Value)) (Descriptor (Return Any))] [(list ///arity.type) descriptor.void]) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/new.lux b/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/new.lux index c0bf6e44b..7196d60fd 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/new.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/new.lux @@ -38,11 +38,11 @@ ["." phase]]]]]) (def: (arguments arity) - (-> Arity (List (Descriptor (Value Any)))) + (-> Arity (List (Descriptor Value))) (list.repeat (dec arity) ////value.type)) (def: #export (type environment arity) - (-> Environment Arity [(List (Descriptor (Value Any))) + (-> Environment Arity [(List (Descriptor Value)) (Descriptor (Return Any))]) [(list@compose (///field/foreign.closure environment) (if (arity.multiary? arity) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/reset.lux b/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/reset.lux index 7aee9e428..df9ea0ae8 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/reset.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/jvm/function/method/reset.lux @@ -35,7 +35,7 @@ (def: #export type (-> External (Descriptor descriptor.Method)) - (|>> descriptor.object [(list)] descriptor.method)) + (|>> descriptor.class [(list)] descriptor.method)) (def: #export (method class environment arity) (-> External Environment Arity (State Pool Method)) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/jvm/primitive.lux b/stdlib/source/lux/tool/compiler/phase/generation/jvm/primitive.lux index 27a02d7b4..d2d51d992 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/jvm/primitive.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/jvm/primitive.lux @@ -16,7 +16,7 @@ (-> Bit (Instruction Any)) (_.getstatic "java.lang.Boolean" (if value "TRUE" "FALSE") - (|.object "java.lang.Boolean"))) + (|.class "java.lang.Boolean"))) (template [<name> <inputT> <ldc> <class> <inputD>] [(def: #export (<name> value) @@ -25,7 +25,7 @@ [_ (`` (|> value (~~ (template.splice <ldc>))))] (_.invokestatic <class> "valueOf" [(list <inputD>) - (|.object <class>)])))] + (|.class <class>)])))] [i64 (I64 Any) [.int constant.long _.ldc/long] "java.lang.Long" |.long] [f64 Frac [constant.double _.ldc/double] "java.lang.Double" |.double] diff --git a/stdlib/source/lux/tool/compiler/phase/generation/jvm/structure.lux b/stdlib/source/lux/tool/compiler/phase/generation/jvm/structure.lux index 8b2c6c270..380040fa5 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/jvm/structure.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/jvm/structure.lux @@ -57,7 +57,7 @@ ..unitG _.aconst-null)) -(def: $Object (|.object "java.lang.Object")) +(def: $Object (|.class "java.lang.Object")) (def: #export (variant generate [lefts right? valueS]) (Generator (Variant Synthesis)) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/jvm/value.lux b/stdlib/source/lux/tool/compiler/phase/generation/jvm/value.lux index a598b9997..c0634ac25 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/jvm/value.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/jvm/value.lux @@ -6,4 +6,4 @@ (def: #export field "_value") -(def: #export type (Descriptor (Value Any)) (descriptor.object "java.lang.Object")) +(def: #export type (descriptor.class "java.lang.Object")) diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index 4dd3ee4b3..9437fb38a 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -75,7 +75,7 @@ (#static TYPE (java/lang/Class java/lang/Long))) (def: descriptor - (Random (Descriptor (Value Any))) + (Random (Descriptor Value)) (random.rec (function (_ descriptor) ($_ random.either @@ -87,13 +87,13 @@ (random@wrap /descriptor.float) (random@wrap /descriptor.double) (random@wrap /descriptor.char) - (random@map (|>> (text.join-with /name.external-separator) /descriptor.object) + (random@map (|>> (text.join-with /name.external-separator) /descriptor.class) (random.list 3 (random.ascii/upper-alpha 10))) (random@map /descriptor.array descriptor) )))) (def: field - (Random [Text (Descriptor (Value Any))]) + (Random [Text (Descriptor Value)]) ($_ random.and (random.ascii/lower-alpha 10) ..descriptor @@ -120,7 +120,7 @@ method-name (random.ascii/upper-alpha 10) expected random.int #let [inputsJT (list) - outputJT (/descriptor.object "java.lang.Object")]] + outputJT (/descriptor.class "java.lang.Object")]] (_.test "Can compile a method." (let [bytecode (|> (/class.class /version.v6_0 /class.public (/name.internal class-name) @@ -137,7 +137,7 @@ [_ (/instruction.ldc/long (/constant.long expected)) _ (/instruction.invokestatic "java.lang.Long" "valueOf" [(list /descriptor.long) - (/descriptor.object "java.lang.Long")])] + (/descriptor.class "java.lang.Long")])] /instruction.areturn))) (row.row)) (binaryF.run /class.writer)) |