diff options
author | Eduardo Julian | 2021-07-18 23:10:18 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-07-18 23:10:18 -0400 |
commit | a40f40f230e6312ae432f06e7f73aa5945d8fa49 (patch) | |
tree | 5005ef744b01f9327c2e4df23146928f1723c495 /stdlib/source/library | |
parent | 442d1557b879a8a4bd76f441f72a17bfb71cf05f (diff) |
New JVM compiler can now compile JVM interfaces.
Diffstat (limited to 'stdlib/source/library')
15 files changed, 256 insertions, 218 deletions
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index 881c3f79d..b265e3e42 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -720,11 +720,12 @@ (-> (List (Type Var)) (Parser [Member_Declaration MethodDecl])) (<code>.form (do <>.monad [tvars (<>.default (list) ..vars^) + #let [total_vars (list\compose tvars type_vars)] name <code>.local_identifier anns ..annotations^ - inputs (<code>.tuple (<>.some (..type^ type_vars))) - output (..return^ type_vars) - exs (throws_decl^ type_vars)] + inputs (<code>.tuple (<>.some (..type^ total_vars))) + output (..return^ total_vars) + exs (throws_decl^ total_vars)] (wrap [[name #PublicP anns] {#method_tvars tvars #method_inputs inputs #method_output output @@ -1203,7 +1204,8 @@ (#private baz java/lang/Object) ## Methods (#public [] (new [value A]) [] - (exec (:= ::foo #1) + (exec + (:= ::foo #1) (:= ::bar value) (:= ::baz "") [])) @@ -1225,15 +1227,14 @@ "(::resolve! container [value]) for calling the 'resolve' method." )} (do meta.monad - [current_module meta.current_module_name - #let [fully_qualified_class_name (name.qualify current_module full_class_name) + [#let [fully_qualified_class_name full_class_name field_parsers (list\map (field->parser fully_qualified_class_name) fields) method_parsers (list\map (method->parser fully_qualified_class_name) methods) replacer (parser->replacer (list\fold <>.either (<>.fail "") (list\compose field_parsers method_parsers)))]] (wrap (list (` ("jvm class" - (~ (declaration$ (type.declaration (name.qualify current_module full_class_name) class_vars))) + (~ (declaration$ (type.declaration full_class_name class_vars))) (~ (class$ super)) [(~+ (list\map class$ interfaces))] (~ (inheritance_modifier$ im)) @@ -1251,13 +1252,11 @@ {#.doc (doc "Allows defining JVM interfaces." (interface: TestInterface ([] foo [boolean String] void #throws [Exception])))} - (do meta.monad - [current_module meta.current_module_name] - (wrap (list (` ("jvm class interface" - (~ (declaration$ (type.declaration (name.qualify current_module full_class_name) class_vars))) - [(~+ (list\map class$ supers))] - [(~+ (list\map annotation$ annotations))] - (~+ (list\map method_decl$ members)))))))) + (wrap (list (` ("jvm class interface" + (~ (declaration$ (type.declaration full_class_name class_vars))) + [(~+ (list\map class$ supers))] + [(~+ (list\map annotation$ annotations))] + (~+ (list\map method_decl$ members))))))) (syntax: #export (object {class_vars ..vars^} diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux index c50278c28..82b2d30db 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode.lux @@ -967,7 +967,7 @@ (template [<static?> <name> <instruction> <method>] [(def: #export (<name> class method type) (-> (Type Class) Text (Type Method) (Bytecode Any)) - (let [[inputs output exceptions] (parser.method type)] + (let [[type_variables inputs output exceptions] (parser.method type)] (do ..monad [index (<| ..lift (<method> (..reflection class)) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux index 05872be60..090fc64fe 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux @@ -36,7 +36,7 @@ (def: (minimal type) (-> (Type Method) Nat) - (let [[inputs output exceptions] (/////type/parser.method type)] + (let [[type_variables inputs output exceptions] (/////type/parser.method type)] (|> inputs (list\map (function (_ input) (if (or (is? /////type.long input) diff --git a/stdlib/source/library/lux/target/jvm/loader.lux b/stdlib/source/library/lux/target/jvm/loader.lux index 8b86321ca..c76ff1310 100644 --- a/stdlib/source/library/lux/target/jvm/loader.lux +++ b/stdlib/source/library/lux/target/jvm/loader.lux @@ -2,6 +2,7 @@ [library [lux #* ["@" target] + ["." ffi (#+ import: object do_to)] [abstract [monad (#+ do)]] [control @@ -16,8 +17,7 @@ ["%" format (#+ format)]] [collection ["." array] - ["." dictionary (#+ Dictionary)]]] - ["." ffi (#+ import: object do_to)]]]) + ["." dictionary (#+ Dictionary)]]]]]) (type: #export Library (Atom (Dictionary Text Binary))) diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux index e2297f313..50bb2b974 100644 --- a/stdlib/source/library/lux/target/jvm/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/reflection.lux @@ -96,9 +96,11 @@ (getGenericParameterTypes [] [java/lang/reflect/Type]) (getGenericExceptionTypes [] [java/lang/reflect/Type])]) +(import: java/lang/ClassLoader) + (import: (java/lang/Class c) ["#::." - (#static forName [java/lang/String] #try (java/lang/Class java/lang/Object)) + (#static forName [java/lang/String boolean java/lang/ClassLoader] #try (java/lang/Class java/lang/Object)) (getName [] java/lang/String) (getModifiers [] int) (isAssignableFrom [(java/lang/Class java/lang/Object)] boolean) @@ -123,20 +125,20 @@ [cannot_convert_to_a_lux_type] ) -(def: #export (load name) - (-> External (Try (java/lang/Class java/lang/Object))) - (case (java/lang/Class::forName name) +(def: #export (load class_loader name) + (-> java/lang/ClassLoader External (Try (java/lang/Class java/lang/Object))) + (case (java/lang/Class::forName name false class_loader) (#try.Success class) (#try.Success class) (#try.Failure _) (exception.throw ..unknown_class name))) -(def: #export (sub? super sub) - (-> External External (Try Bit)) +(def: #export (sub? class_loader super sub) + (-> java/lang/ClassLoader External External (Try Bit)) (do try.monad - [super (..load super) - sub (..load sub)] + [super (..load class_loader super) + sub (..load class_loader sub)] (wrap (java/lang/Class::isAssignableFrom sub super)))) (def: (class' parameter reflection) diff --git a/stdlib/source/library/lux/target/jvm/type.lux b/stdlib/source/library/lux/target/jvm/type.lux index e11ef5c99..9b29382c7 100644 --- a/stdlib/source/library/lux/target/jvm/type.lux +++ b/stdlib/source/library/lux/target/jvm/type.lux @@ -130,13 +130,15 @@ (/descriptor.upper descriptor) (/reflection.upper reflection)]))) - (def: #export (method [inputs output exceptions]) - (-> [(List (Type Value)) + (def: #export (method [type_variables inputs output exceptions]) + (-> [(List (Type Var)) + (List (Type Value)) (Type Return) (List (Type Class))] (Type Method)) (:abstraction - [(/signature.method [(list\map ..signature inputs) + [(/signature.method [(list\map ..signature type_variables) + (list\map ..signature inputs) (..signature output) (list\map ..signature exceptions)]) (/descriptor.method [(list\map ..descriptor inputs) diff --git a/stdlib/source/library/lux/target/jvm/type/alias.lux b/stdlib/source/library/lux/target/jvm/type/alias.lux index 56ffbe127..d52051f04 100644 --- a/stdlib/source/library/lux/target/jvm/type/alias.lux +++ b/stdlib/source/library/lux/target/jvm/type/alias.lux @@ -7,7 +7,7 @@ ["." try] ["." exception (#+ exception:)] ["<>" parser - ["<t>" text (#+ Parser)]]] + ["<.>" text (#+ Parser)]]] [data ["." maybe] ["." text @@ -45,17 +45,17 @@ (|> (do <>.monad [name //parser.class_name parameters (|> (<>.some parameter) - (<>.after (<t>.this //signature.parameters_start)) - (<>.before (<t>.this //signature.parameters_end)) + (<>.after (<text>.this //signature.parameters_start)) + (<>.before (<text>.this //signature.parameters_end)) (<>.default (list)))] (wrap (//.class name parameters))) - (<>.after (<t>.this //descriptor.class_prefix)) - (<>.before (<t>.this //descriptor.class_suffix)))) + (<>.after (<text>.this //descriptor.class_prefix)) + (<>.before (<text>.this //descriptor.class_suffix)))) (template [<name> <prefix> <bound> <constructor>] [(def: <name> (-> (Parser (Type Class)) (Parser (Type Parameter))) - (|>> (<>.after (<t>.this <prefix>)) + (|>> (<>.after (<text>.this <prefix>)) (\ <>.monad map <bound>)))] [lower //signature.lower_prefix //.lower ..Lower] @@ -88,8 +88,8 @@ (def: (inputs aliasing) (-> Aliasing (Parser (List (Type Value)))) (|> (<>.some (..value aliasing)) - (<>.after (<t>.this //signature.arguments_start)) - (<>.before (<t>.this //signature.arguments_end)))) + (<>.after (<text>.this //signature.arguments_start)) + (<>.before (<text>.this //signature.arguments_end)))) (def: (return aliasing) (-> Aliasing (Parser (Type Return))) @@ -101,16 +101,20 @@ (def: (exception aliasing) (-> Aliasing (Parser (Type Class))) (|> (..class (..parameter aliasing)) - (<>.after (<t>.this //signature.exception_prefix)))) + (<>.after (<text>.this //signature.exception_prefix)))) (def: #export (method aliasing type) (-> Aliasing (Type Method) (Type Method)) (|> type //.signature //signature.signature - (<t>.run (do <>.monad - [inputs (..inputs aliasing) - return (..return aliasing) - exceptions (<>.some (..exception aliasing))] - (wrap (//.method [inputs return exceptions])))) + (<text>.run (do <>.monad + [type_variables (|> (<>.some (..var aliasing)) + (<>.after (<text>.this //signature.parameters_start)) + (<>.before (<text>.this //signature.parameters_end)) + (<>.default (list))) + inputs (..inputs aliasing) + return (..return aliasing) + exceptions (<>.some (..exception aliasing))] + (wrap (//.method [type_variables inputs return exceptions])))) try.assume)) diff --git a/stdlib/source/library/lux/target/jvm/type/parser.lux b/stdlib/source/library/lux/target/jvm/type/parser.lux index 5b9a3e1af..eac2f5fcb 100644 --- a/stdlib/source/library/lux/target/jvm/type/parser.lux +++ b/stdlib/source/library/lux/target/jvm/type/parser.lux @@ -7,7 +7,7 @@ ["." try] ["." function] ["<>" parser ("#\." monad) - ["<t>" text (#+ Parser)]]] + ["<.>" text (#+ Parser)]]] [data ["." product] [text @@ -25,7 +25,7 @@ (template [<category> <name> <signature> <type>] [(def: #export <name> (Parser (Type <category>)) - (<>.after (<t>.this (//signature.signature <signature>)) + (<>.after (<text>.this (//signature.signature <signature>)) (<>\wrap <type>)))] [Void void //signature.void //.void] @@ -69,8 +69,8 @@ [(def: #export <name> (Parser <type>) (\ <>.functor map <adapter> - (<t>.slice (<t>.and! (<t>.one_of! <head>) - (<t>.some! (<t>.one_of! <tail>))))))] + (<text>.slice (<text>.and! (<text>.one_of! <head>) + (<text>.some! (<text>.one_of! <tail>))))))] [External class_name class/set class/set (|>> //name.internal //name.external)] [Text var_name var/head var/tail function.identity] @@ -79,8 +79,8 @@ (def: #export var' (Parser Text) (|> ..var_name - (<>.after (<t>.this //signature.var_prefix)) - (<>.before (<t>.this //descriptor.class_suffix)))) + (<>.after (<text>.this //signature.var_prefix)) + (<>.before (<text>.this //descriptor.class_suffix)))) (def: #export var (Parser (Type Var)) @@ -90,20 +90,20 @@ (-> (Type Value) (Maybe Text)) (|>> //.signature //signature.signature - (<t>.run ..var') + (<text>.run ..var') try.to_maybe)) (def: #export name (-> (Type Var) Text) (|>> //.signature //signature.signature - (<t>.run ..var') + (<text>.run ..var') try.assume)) (template [<name> <prefix> <constructor>] [(def: <name> (-> (Parser (Type Class)) (Parser (Type Parameter))) - (|>> (<>.after (<t>.this <prefix>)) + (|>> (<>.after (<text>.this <prefix>)) (<>\map <constructor>)))] [lower //signature.lower_prefix //.lower] @@ -115,12 +115,12 @@ (|> (do <>.monad [name ..class_name parameters (|> (<>.some parameter) - (<>.after (<t>.this //signature.parameters_start)) - (<>.before (<t>.this //signature.parameters_end)) + (<>.after (<text>.this //signature.parameters_start)) + (<>.before (<text>.this //signature.parameters_end)) (<>.default (list)))] (wrap [name parameters])) - (<>.after (<t>.this //descriptor.class_prefix)) - (<>.before (<t>.this //descriptor.class_suffix)))) + (<>.after (<text>.this //descriptor.class_prefix)) + (<>.before (<text>.this //descriptor.class_suffix)))) (def: class' (-> (Parser (Type Parameter)) (Parser (Type Class))) @@ -142,7 +142,7 @@ (def: #export array' (-> (Parser (Type Value)) (Parser (Type Array))) - (|>> (<>.after (<t>.this //descriptor.array_prefix)) + (|>> (<>.after (<text>.this //descriptor.array_prefix)) (<>\map //.array))) (def: #export class @@ -154,7 +154,7 @@ (-> (Type Value) (Maybe (Type Class))) (|>> //.signature //signature.signature - (<t>.run (<>.after (<t>.this <prefix>) ..class)) + (<text>.run (<>.after (<text>.this <prefix>) ..class)) try.to_maybe))] [lower? //signature.lower_prefix //.lower] @@ -165,7 +165,7 @@ (-> (Type Class) [External (List (Type Parameter))]) (|>> //.signature //signature.signature - (<t>.run (..class'' ..parameter)) + (<text>.run (..class'' ..parameter)) try.assume)) (def: #export value @@ -190,8 +190,8 @@ (def: inputs (|> (<>.some ..value) - (<>.after (<t>.this //signature.arguments_start)) - (<>.before (<t>.this //signature.arguments_end)))) + (<>.after (<text>.this //signature.arguments_start)) + (<>.before (<text>.this //signature.arguments_end)))) (def: #export return (Parser (Type Return)) @@ -201,19 +201,29 @@ (def: exception (Parser (Type Class)) (|> (..class' ..parameter) - (<>.after (<t>.this //signature.exception_prefix)))) + (<>.after (<text>.this //signature.exception_prefix)))) (def: #export method (-> (Type Method) - [(List (Type Value)) (Type Return) (List (Type Class))]) - (let [parser (do <>.monad - [inputs ..inputs - return ..return - exceptions (<>.some ..exception)] - (wrap [inputs return exceptions]))] + [(List (Type Var)) + (List (Type Value)) + (Type Return) + (List (Type Class))]) + (let [parser (: (Parser [(List (Type Var)) + (List (Type Value)) + (Type Return) + (List (Type Class))]) + ($_ <>.and + (|> (<>.some ..var) + (<>.after (<text>.this //signature.parameters_start)) + (<>.before (<text>.this //signature.parameters_end)) + (<>.default (list))) + ..inputs + ..return + (<>.some ..exception)))] (|>> //.signature //signature.signature - (<t>.run parser) + (<text>.run parser) try.assume))) (template [<name> <category> <parser>] @@ -221,12 +231,12 @@ (-> (Type Value) (Maybe <category>)) (|>> //.signature //signature.signature - (<t>.run <parser>) + (<text>.run <parser>) try.to_maybe))] [array? (Type Value) (do <>.monad - [_ (<t>.this //descriptor.array_prefix)] + [_ (<text>.this //descriptor.array_prefix)] ..value)] [class? [External (List (Type Parameter))] (..class'' ..parameter)] @@ -237,17 +247,19 @@ [object? (Type Object) ..object] ) +(def: #export declaration' + (Parser [External (List (Type Var))]) + (|> (<>.and ..class_name + (|> (<>.some ..var) + (<>.after (<text>.this //signature.parameters_start)) + (<>.before (<text>.this //signature.parameters_end)) + (<>.default (list)))) + (<>.after (<text>.this //descriptor.class_prefix)) + (<>.before (<text>.this //descriptor.class_suffix)))) + (def: #export declaration (-> (Type Declaration) [External (List (Type Var))]) - (let [declaration' (: (Parser [External (List (Type Var))]) - (|> (<>.and ..class_name - (|> (<>.some ..var) - (<>.after (<t>.this //signature.parameters_start)) - (<>.before (<t>.this //signature.parameters_end)) - (<>.default (list)))) - (<>.after (<t>.this //descriptor.class_prefix)) - (<>.before (<t>.this //descriptor.class_suffix))))] - (|>> //.signature - //signature.signature - (<t>.run declaration') - try.assume))) + (|>> //.signature + //signature.signature + (<text>.run ..declaration') + try.assume)) diff --git a/stdlib/source/library/lux/target/jvm/type/signature.lux b/stdlib/source/library/lux/target/jvm/type/signature.lux index 0b21807dd..89cce34e0 100644 --- a/stdlib/source/library/lux/target/jvm/type/signature.lux +++ b/stdlib/source/library/lux/target/jvm/type/signature.lux @@ -103,13 +103,23 @@ (def: #export exception_prefix "^") - (def: #export (method [inputs output exceptions]) - (-> [(List (Signature Value)) + (def: #export (method [type_variables inputs output exceptions]) + (-> [(List (Signature Var)) + (List (Signature Value)) (Signature Return) (List (Signature Class))] (Signature Method)) (:abstraction - (format (|> inputs + (format (case type_variables + #.Nil + "" + _ + (|> type_variables + (list\map ..signature) + (text.join_with "") + (text.enclose [..parameters_start + ..parameters_end]))) + (|> inputs (list\map ..signature) (text.join_with "") (text.enclose [..arguments_start diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux index 02adbd2bd..29796ead6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux @@ -246,6 +246,7 @@ id]))))] [learn artifact.definition] + [learn_custom artifact.custom] [learn_analyser artifact.analyser] [learn_synthesizer artifact.synthesizer] [learn_generator artifact.generator] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux index 76bcd528e..0dcb22927 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -58,6 +58,8 @@ [archive (#+ Archive) [descriptor (#+ Module)]]]]]]]]) +(import: java/lang/ClassLoader) + (import: java/lang/Object ["#::." (equals [java/lang/Object] boolean)]) @@ -132,10 +134,10 @@ (exception.report ["Class" (%.text class)])) -(def: (ensure_fresh_class! name) - (-> External (Operation Any)) +(def: (ensure_fresh_class! class_loader name) + (-> java/lang/ClassLoader External (Operation Any)) (do phase.monad - [class (phase.lift (reflection!.load name))] + [class (phase.lift (reflection!.load class_loader name))] (phase.assert ..deprecated_class [name] (|> class java/lang/Class::getDeclaredAnnotations @@ -785,8 +787,8 @@ _ (/////analysis.throw ///.incorrect_arity [extension_name 2 (list.size args)])))) -(def: object::throw - Handler +(def: (object::throw class_loader) + (-> java/lang/ClassLoader Handler) (function (_ extension_name analyse archive args) (case args (^ (list exceptionC)) @@ -795,7 +797,7 @@ [exceptionT exceptionA] (typeA.with_inference (analyse archive exceptionC)) exception_class (check_object exceptionT) - ? (phase.lift (reflection!.sub? "java.lang.Throwable" exception_class)) + ? (phase.lift (reflection!.sub? class_loader "java.lang.Throwable" exception_class)) _ (: (Operation Any) (if ? (wrap []) @@ -805,17 +807,17 @@ _ (/////analysis.throw ///.incorrect_arity [extension_name 1 (list.size args)])))) -(def: object::class - Handler +(def: (object::class class_loader) + (-> java/lang/ClassLoader Handler) (function (_ extension_name analyse archive args) (case args (^ (list classC)) (case classC [_ (#.Text class)] (do phase.monad - [_ (..ensure_fresh_class! class) + [_ (..ensure_fresh_class! class_loader class) _ (typeA.infer (#.Primitive "java.lang.Class" (list (#.Primitive class (list))))) - _ (phase.lift (reflection!.load class))] + _ (phase.lift (reflection!.load class_loader class))] (wrap (#/////analysis.Extension extension_name (list (/////analysis.text class))))) _ @@ -824,18 +826,18 @@ _ (/////analysis.throw ///.incorrect_arity [extension_name 1 (list.size args)])))) -(def: object::instance? - Handler +(def: (object::instance? class_loader) + (-> java/lang/ClassLoader Handler) (..custom [($_ <>.and <code>.text <code>.any) (function (_ extension_name analyse archive [sub_class objectC]) (do phase.monad - [_ (..ensure_fresh_class! sub_class) + [_ (..ensure_fresh_class! class_loader sub_class) _ (typeA.infer Bit) [objectT objectA] (typeA.with_inference (analyse archive objectC)) object_class (check_object objectT) - ? (phase.lift (reflection!.sub? object_class sub_class))] + ? (phase.lift (reflection!.sub? class_loader object_class sub_class))] (if ? (wrap (#/////analysis.Extension extension_name (list (/////analysis.text sub_class) objectA))) (/////analysis.throw cannot_possibly_be_an_instance (format sub_class " !<= " object_class)))))])) @@ -855,17 +857,17 @@ [reflection_return Return luxT.return] ) -(def: (class_candidate_parents from_name fromT to_name to_class) - (-> External .Type External (java/lang/Class java/lang/Object) (Operation (List [[Text .Type] Bit]))) +(def: (class_candidate_parents class_loader from_name fromT to_name to_class) + (-> java/lang/ClassLoader External .Type External (java/lang/Class java/lang/Object) (Operation (List [[Text .Type] Bit]))) (do {! phase.monad} - [from_class (phase.lift (reflection!.load from_name)) + [from_class (phase.lift (reflection!.load class_loader from_name)) mapping (phase.lift (reflection!.correspond from_class fromT))] (monad.map ! (function (_ superJT) (do ! [superJT (phase.lift (reflection!.type superJT)) #let [super_name (|> superJT ..reflection)] - super_class (phase.lift (reflection!.load super_name)) + super_class (phase.lift (reflection!.load class_loader super_name)) superT (reflection_type mapping superJT)] (wrap [[super_name superT] (java/lang/Class::isAssignableFrom super_class to_class)]))) (case (java/lang/Class::getGenericSuperclass from_class) @@ -878,15 +880,15 @@ (array.to_list (java/lang/Class::getGenericInterfaces from_class))) (array.to_list (java/lang/Class::getGenericInterfaces from_class))))))) -(def: (inheritance_candidate_parents fromT to_class toT fromC) - (-> .Type (java/lang/Class java/lang/Object) .Type Code (Operation (List [[Text .Type] Bit]))) +(def: (inheritance_candidate_parents class_loader fromT to_class toT fromC) + (-> java/lang/ClassLoader .Type (java/lang/Class java/lang/Object) .Type Code (Operation (List [[Text .Type] Bit]))) (case fromT (^ (#.Primitive _ (list& self_classT super_classT super_interfacesT+))) (monad.map phase.monad (function (_ superT) (do {! phase.monad} [super_name (\ ! map ..reflection (check_jvm superT)) - super_class (phase.lift (reflection!.load super_name))] + super_class (phase.lift (reflection!.load class_loader super_name))] (wrap [[super_name superT] (java/lang/Class::isAssignableFrom super_class to_class)]))) (list& super_classT super_interfacesT+)) @@ -894,8 +896,8 @@ _ (/////analysis.throw ..cannot_cast [fromT toT fromC]))) -(def: object::cast - Handler +(def: (object::cast class_loader) + (-> java/lang/ClassLoader Handler) (function (_ extension_name analyse archive args) (case args (^ (list fromC)) @@ -930,11 +932,11 @@ (not (dictionary.key? ..boxes from_name))) _ (phase.assert ..primitives_are_not_objects [to_name] (not (dictionary.key? ..boxes to_name))) - to_class (phase.lift (reflection!.load to_name)) + to_class (phase.lift (reflection!.load class_loader to_name)) _ (if (text\= ..inheritance_relationship_type_name from_name) (wrap []) (do ! - [from_class (phase.lift (reflection!.load from_name))] + [from_class (phase.lift (reflection!.load class_loader from_name))] (phase.assert ..cannot_cast [fromT toT fromC] (java/lang/Class::isAssignableFrom from_class to_class))))] (loop [[current_name currentT] [from_name fromT]] @@ -943,8 +945,8 @@ (do ! [candidate_parents (: (Operation (List [[Text .Type] Bit])) (if (text\= ..inheritance_relationship_type_name current_name) - (inheritance_candidate_parents currentT to_class toT fromC) - (class_candidate_parents current_name currentT to_name to_class)))] + (inheritance_candidate_parents class_loader currentT to_class toT fromC) + (class_candidate_parents class_loader current_name currentT to_name to_class)))] (case (|> candidate_parents (list.filter product.right) (list\map product.left)) @@ -962,29 +964,29 @@ _ (/////analysis.throw ///.invalid_syntax [extension_name %.code args])))) -(def: bundle::object - Bundle +(def: (bundle::object class_loader) + (-> java/lang/ClassLoader Bundle) (<| (///bundle.prefix "object") (|> ///bundle.empty (///bundle.install "null" object::null) (///bundle.install "null?" object::null?) (///bundle.install "synchronized" object::synchronized) - (///bundle.install "throw" object::throw) - (///bundle.install "class" object::class) - (///bundle.install "instance?" object::instance?) - (///bundle.install "cast" object::cast) + (///bundle.install "throw" (object::throw class_loader)) + (///bundle.install "class" (object::class class_loader)) + (///bundle.install "instance?" (object::instance? class_loader)) + (///bundle.install "cast" (object::cast class_loader)) ))) -(def: get::static - Handler +(def: (get::static class_loader) + (-> java/lang/ClassLoader Handler) (..custom [..member (function (_ extension_name analyse archive [class field]) (do phase.monad - [_ (..ensure_fresh_class! class) + [_ (..ensure_fresh_class! class_loader class) [final? deprecated? fieldJT] (phase.lift (do try.monad - [class (reflection!.load class)] + [class (reflection!.load class_loader class)] (reflection!.static_field field class))) _ (phase.assert ..deprecated_field [class field] (not deprecated?)) @@ -995,17 +997,17 @@ (/////analysis.text field) (/////analysis.text (|> fieldJT ..reflection)))))))])) -(def: put::static - Handler +(def: (put::static class_loader) + (-> java/lang/ClassLoader Handler) (..custom [($_ <>.and ..member <code>.any) (function (_ extension_name analyse archive [[class field] valueC]) (do phase.monad - [_ (..ensure_fresh_class! class) + [_ (..ensure_fresh_class! class_loader class) _ (typeA.infer Any) [final? deprecated? fieldJT] (phase.lift (do try.monad - [class (reflection!.load class)] + [class (reflection!.load class_loader class)] (reflection!.static_field field class))) _ (phase.assert ..deprecated_field [class field] (not deprecated?)) @@ -1019,18 +1021,18 @@ (/////analysis.text field) valueA)))))])) -(def: get::virtual - Handler +(def: (get::virtual class_loader) + (-> java/lang/ClassLoader Handler) (..custom [($_ <>.and ..member <code>.any) (function (_ extension_name analyse archive [[class field] objectC]) (do phase.monad - [_ (..ensure_fresh_class! class) + [_ (..ensure_fresh_class! class_loader class) [objectT objectA] (typeA.with_inference (analyse archive objectC)) [deprecated? mapping fieldJT] (phase.lift (do try.monad - [class (reflection!.load class) + [class (reflection!.load class_loader class) [final? deprecated? fieldJT] (reflection!.virtual_field field class) mapping (reflection!.correspond class objectT)] (wrap [deprecated? mapping fieldJT]))) @@ -1043,19 +1045,19 @@ (/////analysis.text field) objectA)))))])) -(def: put::virtual - Handler +(def: (put::virtual class_loader) + (-> java/lang/ClassLoader Handler) (..custom [($_ <>.and ..member <code>.any <code>.any) (function (_ extension_name analyse archive [[class field] valueC objectC]) (do phase.monad - [_ (..ensure_fresh_class! class) + [_ (..ensure_fresh_class! class_loader class) [objectT objectA] (typeA.with_inference (analyse archive objectC)) _ (typeA.infer objectT) [final? deprecated? mapping fieldJT] (phase.lift (do try.monad - [class (reflection!.load class) + [class (reflection!.load class_loader class) [final? deprecated? fieldJT] (reflection!.virtual_field field class) mapping (reflection!.correspond class objectT)] (wrap [final? deprecated? mapping fieldJT]))) @@ -1276,10 +1278,10 @@ (list\map jvm_parser.name expected)) (dictionary.from_list text.hash))) -(def: (method_candidate actual_class_tvars class_name actual_method_tvars method_name method_style inputsJT) - (-> (List (Type Var)) External (List (Type Var)) Text Method_Style (List (Type Value)) (Operation Method_Signature)) +(def: (method_candidate class_loader actual_class_tvars class_name actual_method_tvars method_name method_style inputsJT) + (-> java/lang/ClassLoader (List (Type Var)) External (List (Type Var)) Text Method_Style (List (Type Value)) (Operation Method_Signature)) (do {! phase.monad} - [class (phase.lift (reflection!.load class_name)) + [class (phase.lift (reflection!.load class_loader class_name)) #let [expected_class_tvars (class_type_variables class)] candidates (|> class java/lang/Class::getDeclaredMethods @@ -1309,10 +1311,10 @@ (def: constructor_method "<init>") -(def: (constructor_candidate actual_class_tvars class_name actual_method_tvars inputsJT) - (-> (List (Type Var)) External (List (Type Var)) (List (Type Value)) (Operation Method_Signature)) +(def: (constructor_candidate class_loader actual_class_tvars class_name actual_method_tvars inputsJT) + (-> java/lang/ClassLoader (List (Type Var)) External (List (Type Var)) (List (Type Value)) (Operation Method_Signature)) (do {! phase.monad} - [class (phase.lift (reflection!.load class_name)) + [class (phase.lift (reflection!.load class_loader class_name)) #let [expected_class_tvars (class_type_variables class)] candidates (|> class java/lang/Class::getConstructors @@ -1361,15 +1363,15 @@ (def: type_vars (<code>.tuple (<>.some ..var))) -(def: invoke::static - Handler +(def: (invoke::static class_loader) + (-> java/lang/ClassLoader Handler) (..custom [($_ <>.and ..type_vars ..member ..type_vars (<>.some ..input)) (function (_ extension_name analyse archive [class_tvars [class method] method_tvars argsTC]) (do phase.monad - [_ (..ensure_fresh_class! class) + [_ (..ensure_fresh_class! class_loader class) #let [argsT (list\map product.left argsTC)] - [methodT deprecated? exceptionsT] (..method_candidate class_tvars class method_tvars method #Static argsT) + [methodT deprecated? exceptionsT] (..method_candidate class_loader class_tvars class method_tvars method #Static argsT) _ (phase.assert ..deprecated_method [class method methodT] (not deprecated?)) [outputT argsA] (inferenceA.general archive analyse methodT (list\map product.right argsTC)) @@ -1379,15 +1381,15 @@ (/////analysis.text (..signature outputJT)) (decorate_inputs argsT argsA))))))])) -(def: invoke::virtual - Handler +(def: (invoke::virtual class_loader) + (-> java/lang/ClassLoader Handler) (..custom [($_ <>.and ..type_vars ..member ..type_vars <code>.any (<>.some ..input)) (function (_ extension_name analyse archive [class_tvars [class method] method_tvars objectC argsTC]) (do phase.monad - [_ (..ensure_fresh_class! class) + [_ (..ensure_fresh_class! class_loader class) #let [argsT (list\map product.left argsTC)] - [methodT deprecated? exceptionsT] (..method_candidate class_tvars class method_tvars method #Virtual argsT) + [methodT deprecated? exceptionsT] (..method_candidate class_loader class_tvars class method_tvars method #Virtual argsT) _ (phase.assert ..deprecated_method [class method methodT] (not deprecated?)) [outputT allA] (inferenceA.general archive analyse methodT (list& objectC (list\map product.right argsTC))) @@ -1404,15 +1406,15 @@ objectA (decorate_inputs argsT argsA))))))])) -(def: invoke::special - Handler +(def: (invoke::special class_loader) + (-> java/lang/ClassLoader Handler) (..custom [($_ <>.and ..type_vars ..member ..type_vars <code>.any (<>.some ..input)) (function (_ extension_name analyse archive [class_tvars [class method] method_tvars objectC argsTC]) (do phase.monad - [_ (..ensure_fresh_class! class) + [_ (..ensure_fresh_class! class_loader class) #let [argsT (list\map product.left argsTC)] - [methodT deprecated? exceptionsT] (..method_candidate class_tvars class method_tvars method #Special argsT) + [methodT deprecated? exceptionsT] (..method_candidate class_loader class_tvars class method_tvars method #Special argsT) _ (phase.assert ..deprecated_method [class method methodT] (not deprecated?)) [outputT argsA] (inferenceA.general archive analyse methodT (list& objectC (list\map product.right argsTC))) @@ -1422,18 +1424,18 @@ (/////analysis.text (..signature outputJT)) (decorate_inputs argsT argsA))))))])) -(def: invoke::interface - Handler +(def: (invoke::interface class_loader) + (-> java/lang/ClassLoader Handler) (..custom [($_ <>.and ..type_vars ..member ..type_vars <code>.any (<>.some ..input)) (function (_ extension_name analyse archive [class_tvars [class_name method] method_tvars objectC argsTC]) (do phase.monad - [_ (..ensure_fresh_class! class_name) + [_ (..ensure_fresh_class! class_loader class_name) #let [argsT (list\map product.left argsTC)] - class (phase.lift (reflection!.load class_name)) + class (phase.lift (reflection!.load class_loader class_name)) _ (phase.assert non_interface class_name (java/lang/reflect/Modifier::isInterface (java/lang/Class::getModifiers class))) - [methodT deprecated? exceptionsT] (..method_candidate class_tvars class_name method_tvars method #Interface argsT) + [methodT deprecated? exceptionsT] (..method_candidate class_loader class_tvars class_name method_tvars method #Interface argsT) _ (phase.assert ..deprecated_method [class_name method methodT] (not deprecated?)) [outputT allA] (inferenceA.general archive analyse methodT (list& objectC (list\map product.right argsTC))) @@ -1451,39 +1453,40 @@ objectA (decorate_inputs argsT argsA))))))])) -(def: invoke::constructor +(def: (invoke::constructor class_loader) + (-> java/lang/ClassLoader Handler) (..custom [($_ <>.and ..type_vars <code>.text ..type_vars (<>.some ..input)) (function (_ extension_name analyse archive [class_tvars class method_tvars argsTC]) (do phase.monad - [_ (..ensure_fresh_class! class) + [_ (..ensure_fresh_class! class_loader class) #let [argsT (list\map product.left argsTC)] - [methodT deprecated? exceptionsT] (..constructor_candidate class_tvars class method_tvars argsT) + [methodT deprecated? exceptionsT] (..constructor_candidate class_loader class_tvars class method_tvars argsT) _ (phase.assert ..deprecated_method [class ..constructor_method methodT] (not deprecated?)) [outputT argsA] (inferenceA.general archive analyse methodT (list\map product.right argsTC))] (wrap (#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) (decorate_inputs argsT argsA))))))])) -(def: bundle::member - Bundle +(def: (bundle::member class_loader) + (-> java/lang/ClassLoader Bundle) (<| (///bundle.prefix "member") (|> ///bundle.empty (dictionary.merge (<| (///bundle.prefix "get") (|> ///bundle.empty - (///bundle.install "static" get::static) - (///bundle.install "virtual" get::virtual)))) + (///bundle.install "static" (get::static class_loader)) + (///bundle.install "virtual" (get::virtual class_loader))))) (dictionary.merge (<| (///bundle.prefix "put") (|> ///bundle.empty - (///bundle.install "static" put::static) - (///bundle.install "virtual" put::virtual)))) + (///bundle.install "static" (put::static class_loader)) + (///bundle.install "virtual" (put::virtual class_loader))))) (dictionary.merge (<| (///bundle.prefix "invoke") (|> ///bundle.empty - (///bundle.install "static" invoke::static) - (///bundle.install "virtual" invoke::virtual) - (///bundle.install "special" invoke::special) - (///bundle.install "interface" invoke::interface) - (///bundle.install "constructor" invoke::constructor) + (///bundle.install "static" (invoke::static class_loader)) + (///bundle.install "virtual" (invoke::virtual class_loader)) + (///bundle.install "special" (invoke::special class_loader)) + (///bundle.install "interface" (invoke::interface class_loader)) + (///bundle.install "constructor" (invoke::constructor class_loader)) ))) ))) @@ -1545,7 +1548,11 @@ (monad.map try.monad (function (_ method) (do {! try.monad} - [inputs (|> (java/lang/reflect/Method::getGenericParameterTypes method) + [#let [type_variables (|> (java/lang/reflect/Method::getTypeParameters method) + array.to_list + (list\map (|>> java/lang/reflect/TypeVariable::getName + jvm.var)))] + inputs (|> (java/lang/reflect/Method::getGenericParameterTypes method) array.to_list (monad.map ! reflection!.type)) return (|> method @@ -1555,7 +1562,7 @@ array.to_list (monad.map ! reflection!.class))] (wrap [(java/lang/reflect/Method::getName method) - (jvm.method [inputs return exceptions])]))))))] + (jvm.method [type_variables inputs return exceptions])]))))))] [abstract_methods (list.filter (|>> java/lang/reflect/Method::getModifiers java/lang/reflect/Modifier::isAbstract))] [methods (<|)] @@ -1564,9 +1571,9 @@ (def: jvm_package_separator ".") (template [<name> <methods>] - [(def: <name> - (-> (List (Type Class)) (Try (List [Text (Type Method)]))) - (|>> (monad.map try.monad (|>> ..reflection reflection!.load)) + [(def: (<name> class_loader) + (-> java/lang/ClassLoader (List (Type Class)) (Try (List [Text (Type Method)]))) + (|>> (monad.map try.monad (|>> ..reflection (reflection!.load class_loader))) (try\map (monad.map try.monad <methods>)) try\join (try\map list\join)))] @@ -1954,11 +1961,11 @@ ["Actual (amount)" (%.nat (list.size actual))] ["Actual (parameters)" (exception.enumerate ..signature actual)])) -(def: (super_aliasing class) - (-> (Type Class) (Operation Aliasing)) +(def: (super_aliasing class_loader class) + (-> java/lang/ClassLoader (Type Class) (Operation Aliasing)) (do phase.monad [#let [[name actual_parameters] (jvm_parser.read_class class)] - class (phase.lift (reflection!.load name)) + class (phase.lift (reflection!.load class_loader name)) #let [expected_parameters (|> (java/lang/Class::getTypeParameters class) array.to_list (list\map (|>> java/lang/reflect/TypeVariable::getName)))] @@ -1981,8 +1988,8 @@ local (format "anonymous-class" (%.nat id))] (format global ..jvm_package_separator local))) -(def: class::anonymous - Handler +(def: (class::anonymous class_loader) + (-> java/lang/ClassLoader Handler) (..custom [($_ <>.and (<code>.tuple (<>.some ..var)) @@ -1996,8 +2003,8 @@ constructor_args methods]) (do {! phase.monad} - [_ (..ensure_fresh_class! (..reflection super_class)) - _ (monad.map ! (|>> ..reflection ..ensure_fresh_class!) super_interfaces) + [_ (..ensure_fresh_class! class_loader (..reflection super_class)) + _ (monad.map ! (|>> ..reflection (..ensure_fresh_class! class_loader)) super_interfaces) parameters (typeA.with_env (..parameter_types parameters)) #let [mapping (list\fold (function (_ [parameterJ parameterT] mapping) @@ -2027,15 +2034,16 @@ (wrap [type termA]))) constructor_args) methodsA (monad.map ! (analyse_overriden_method analyse archive selfT mapping) methods) - required_abstract_methods (phase.lift (all_abstract_methods (list& super_class super_interfaces))) - available_methods (phase.lift (all_methods (list& super_class super_interfaces))) + required_abstract_methods (phase.lift (all_abstract_methods class_loader (list& super_class super_interfaces))) + available_methods (phase.lift (all_methods class_loader (list& super_class super_interfaces))) overriden_methods (monad.map ! (function (_ [parent_type method_name - strict_fp? annotations vars + strict_fp? annotations type_vars self_name arguments return exceptions body]) (do ! - [aliasing (super_aliasing parent_type)] - (wrap [method_name (|> (jvm.method [(list\map product.right arguments) + [aliasing (super_aliasing class_loader parent_type)] + (wrap [method_name (|> (jvm.method [type_vars + (list\map product.right arguments) return exceptions]) (jvm_alias.method aliasing))]))) @@ -2052,15 +2060,15 @@ (/////analysis.tuple (list\map typed_analysis constructor_argsA+)) (/////analysis.tuple methodsA))))))])) -(def: bundle::class - Bundle +(def: (bundle::class class_loader) + (-> java/lang/ClassLoader Bundle) (<| (///bundle.prefix "class") (|> ///bundle.empty - (///bundle.install "anonymous" class::anonymous) + (///bundle.install "anonymous" (class::anonymous class_loader)) ))) -(def: #export bundle - Bundle +(def: #export (bundle class_loader) + (-> java/lang/ClassLoader Bundle) (<| (///bundle.prefix "jvm") (|> ///bundle.empty (dictionary.merge bundle::conversion) @@ -2070,7 +2078,7 @@ (dictionary.merge bundle::double) (dictionary.merge bundle::char) (dictionary.merge bundle::array) - (dictionary.merge bundle::object) - (dictionary.merge bundle::member) - (dictionary.merge bundle::class) + (dictionary.merge (bundle::object class_loader)) + (dictionary.merge (bundle::member class_loader)) + (dictionary.merge (bundle::class class_loader)) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/abstract.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/abstract.lux index fea8a985e..eb1f78ed9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/abstract.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/abstract.lux @@ -21,4 +21,4 @@ (def: #export init (Type Method) - (type.method [(list arity.type) type.void (list)])) + (type.method [(list) (list arity.type) type.void (list)])) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux index edfa6d78d..28d9b81cd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux @@ -130,7 +130,7 @@ (def: #export unit (_.string synthesis.unit)) (def: variant::name "variant") -(def: variant::type (type.method [(list //type.tag //type.flag //type.value) //type.variant (list)])) +(def: variant::type (type.method [(list) (list //type.tag //type.flag //type.value) //type.variant (list)])) (def: #export variant (..procedure ..variant::name ..variant::type)) (def: variant_tag _.iconst_0) @@ -204,7 +204,7 @@ ))) (def: decode_frac::name "decode_frac") -(def: decode_frac::type (type.method [(list //type.text) //type.variant (list)])) +(def: decode_frac::type (type.method [(list) (list //type.text) //type.variant (list)])) (def: #export decode_frac (..procedure ..decode_frac::name ..decode_frac::type)) (def: decode_frac::method @@ -215,7 +215,7 @@ (..risky ($_ _.compose _.aload_0 - (_.invokestatic //type.frac "parseDouble" (type.method [(list //type.text) type.double (list)])) + (_.invokestatic //type.frac "parseDouble" (type.method [(list) (list //type.text) type.double (list)])) (//value.wrap type.double) ))))) @@ -224,13 +224,13 @@ (let [^PrintStream (type.class "java.io.PrintStream" (list)) ^System (type.class "java.lang.System" (list)) out (_.getstatic ^System "out" ^PrintStream) - print_type (type.method [(list //type.value) type.void (list)]) + print_type (type.method [(list) (list //type.value) type.void (list)]) print! (function (_ method) (_.invokevirtual ^PrintStream method print_type))] ($_ _.compose out (_.string "LUX LOG: ") (print! "print") out _.swap (print! "println")))) -(def: exception_constructor (type.method [(list //type.text) type.void (list)])) +(def: exception_constructor (type.method [(list) (list //type.text) type.void (list)])) (def: (illegal_state_exception message) (-> Text (Bytecode Any)) (let [^IllegalStateException (type.class "java.lang.IllegalStateException" (list))] @@ -241,7 +241,7 @@ (_.invokespecial ^IllegalStateException "<init>" ..exception_constructor)))) (def: failure::type - (type.method [(list) type.void (list)])) + (type.method [(list) (list) type.void (list)])) (def: (failure name message) (-> Text Text (Resource Method)) @@ -263,7 +263,7 @@ (def: #export stack_tail _.iconst_1) (def: push::name "push") -(def: push::type (type.method [(list //type.stack //type.value) //type.stack (list)])) +(def: push::type (type.method [(list) (list //type.stack //type.value) //type.stack (list)])) (def: #export push (..procedure ..push::name ..push::type)) (def: push::method @@ -283,7 +283,7 @@ _.areturn))))) (def: case::name "case") -(def: case::type (type.method [(list //type.variant //type.tag //type.flag) //type.value (list)])) +(def: case::type (type.method [(list) (list //type.variant //type.tag //type.flag) //type.value (list)])) (def: #export case (..procedure ..case::name ..case::type)) (def: case::method @@ -358,7 +358,7 @@ _.areturn ))))) -(def: projection_type (type.method [(list //type.tuple //type.offset) //type.value (list)])) +(def: projection_type (type.method [(list) (list //type.tuple //type.offset) //type.value (list)])) (def: left_projection::name "left") (def: #export left_projection (..procedure ..left_projection::name ..projection_type)) @@ -427,7 +427,7 @@ $right $tuple::size (_.invokestatic (type.class "java.util.Arrays" (list)) "copyOfRange" - (type.method [(list //type.tuple //type.index //type.index) //type.tuple (list)])))]] + (type.method [(list) (list //type.tuple //type.index //type.index) //type.tuple (list)])))]] ($_ _.compose (_.set_label @loop) $last_right $right @@ -449,13 +449,13 @@ (def: #export (apply::type arity) (-> Arity (Type category.Method)) - (type.method [(list.repeat arity //type.value) //type.value (list)])) + (type.method [(list) (list.repeat arity //type.value) //type.value (list)])) (def: #export apply (_.invokevirtual //function.class ..apply::name (..apply::type 1))) (def: try::name "try") -(def: try::type (type.method [(list //function.class) //type.variant (list)])) +(def: try::type (type.method [(list) (list //function.class) //type.variant (list)])) (def: #export try (..procedure ..try::name ..try::type)) (def: false _.iconst_0) @@ -475,7 +475,7 @@ string_writer ($_ _.compose (_.new ^StringWriter) _.dup - (_.invokespecial ^StringWriter "<init>" (type.method [(list) type.void (list)]))) + (_.invokespecial ^StringWriter "<init>" (type.method [(list) (list) type.void (list)]))) ^PrintWriter (type.class "java.io.PrintWriter" (list)) print_writer ($_ _.compose @@ -484,7 +484,7 @@ _.dup_x1 ## WTPWP _.swap ## WTPPW ..true ## WTPPWZ - (_.invokespecial ^PrintWriter "<init>" (type.method [(list (type.class "java.io.Writer" (list)) type.boolean) type.void (list)])) + (_.invokespecial ^PrintWriter "<init>" (type.method [(list) (list (type.class "java.io.Writer" (list)) type.boolean) type.void (list)])) ## WTP )]] ($_ _.compose @@ -496,8 +496,8 @@ string_writer ## TW _.dup_x1 ## WTW print_writer ## WTP - (_.invokevirtual //type.error "printStackTrace" (type.method [(list ^PrintWriter) type.void (list)])) ## W - (_.invokevirtual ^StringWriter "toString" (type.method [(list) //type.text (list)])) ## S + (_.invokevirtual //type.error "printStackTrace" (type.method [(list) (list ^PrintWriter) type.void (list)])) ## W + (_.invokevirtual ^StringWriter "toString" (type.method [(list) (list) //type.text (list)])) ## S ..left_injection _.areturn ))))) @@ -568,7 +568,7 @@ (let [$partials _.iload_1] ($_ _.compose ..this - (_.invokespecial ^Object "<init>" (type.method [(list) type.void (list)])) + (_.invokespecial ^Object "<init>" (type.method [(list) (list) type.void (list)])) ..this $partials (_.putfield //function.class //function/count.field //function/count.type) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux index ef82a6257..3e2ff3d09 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/value.lux @@ -39,11 +39,11 @@ (-> (Type Primitive) (Bytecode Any)) (let [wrapper (type.class (primitive-wrapper type) (list))] (_.invokestatic wrapper "valueOf" - (type.method [(list type) wrapper (list)])))) + (type.method [(list) (list type) wrapper (list)])))) (def: #export (unwrap type) (-> (Type Primitive) (Bytecode Any)) (let [wrapper (type.class (primitive-wrapper type) (list))] ($_ _.compose (_.checkcast wrapper) - (_.invokevirtual wrapper (primitive-unwrap type) (type.method [(list) type (list)]))))) + (_.invokevirtual wrapper (primitive-unwrap type) (type.method [(list) (list) type (list)]))))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux index cd7b7169a..b41b272f5 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -305,7 +305,7 @@ (#artifact.Custom name) (do ! [#let [output (row.add [artifact_id (#.Some name) data] output)] - value (\ host re_load context (#.Some name) directive)] + _ (\ host re_learn context (#.Some name) directive)] (wrap [definitions [analysers synthesizers |