From a40f40f230e6312ae432f06e7f73aa5945d8fa49 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 18 Jul 2021 23:10:18 -0400 Subject: New JVM compiler can now compile JVM interfaces. --- stdlib/commands.md | 9 + stdlib/project.lux | 11 + stdlib/source/library/lux/ffi.jvm.lux | 27 ++- stdlib/source/library/lux/target/jvm/bytecode.lux | 2 +- .../jvm/bytecode/environment/limit/registry.lux | 2 +- stdlib/source/library/lux/target/jvm/loader.lux | 4 +- .../source/library/lux/target/jvm/reflection.lux | 18 +- stdlib/source/library/lux/target/jvm/type.lux | 8 +- .../source/library/lux/target/jvm/type/alias.lux | 32 +-- .../source/library/lux/target/jvm/type/parser.lux | 92 +++++---- .../library/lux/target/jvm/type/signature.lux | 16 +- .../lux/tool/compiler/language/lux/generation.lux | 1 + .../language/lux/phase/extension/analysis/jvm.lux | 230 +++++++++++---------- .../lux/phase/generation/jvm/function/abstract.lux | 2 +- .../language/lux/phase/generation/jvm/runtime.lux | 34 +-- .../language/lux/phase/generation/jvm/value.lux | 4 +- .../library/lux/tool/compiler/meta/io/archive.lux | 2 +- stdlib/source/program/aedifex/pom.lux | 5 +- stdlib/source/program/aedifex/repository.lux | 1 + stdlib/source/test/aedifex/metadata/artifact.lux | 84 ++++++-- stdlib/source/test/aedifex/metadata/snapshot.lux | 71 +++++-- stdlib/source/test/aedifex/pom.lux | 49 +++-- stdlib/source/test/aedifex/project.lux | 4 + stdlib/source/test/lux.lux | 37 +++- stdlib/source/test/lux/target/jvm.lux | 48 ++--- 25 files changed, 491 insertions(+), 302 deletions(-) create mode 100644 stdlib/project.lux (limited to 'stdlib') diff --git a/stdlib/commands.md b/stdlib/commands.md index 29af59778..375800f92 100644 --- a/stdlib/commands.md +++ b/stdlib/commands.md @@ -6,6 +6,10 @@ cd ~/lux/stdlib/ \ && lein clean \ && lein with-profile bibliotheca lux auto test + +cd ~/lux/stdlib/ \ +&& lux clean \ +&& lux auto test ``` ## Deploy @@ -42,6 +46,11 @@ cd ~/lux/stdlib/ \ cd ~/lux/stdlib/ \ && lein clean \ && lein with-profile aedifex lux auto build + +cd ~/lux/stdlib/ \ +&& lein clean \ +&& lein with-profile aedifex lux build \ +&& mv target/program.jar aedifex.jar ``` ## Test diff --git a/stdlib/project.lux b/stdlib/project.lux new file mode 100644 index 000000000..919e9e489 --- /dev/null +++ b/stdlib/project.lux @@ -0,0 +1,11 @@ +{#identity ["com.github.luxlang" "stdlib" "0.6.0-SNAPSHOT"] + + #deploy_repositories {"snapshots" "https://oss.sonatype.org/content/repositories/snapshots/" + "releases" "https://oss.sonatype.org/service/local/staging/deploy/maven2/"} + + #repositories ["https://oss.sonatype.org/content/repositories/snapshots/" + "https://oss.sonatype.org/service/local/staging/deploy/maven2/"] + + #compiler ["com.github.luxlang" "lux-jvm" "0.6.0-SNAPSHOT" "jar"] + + #test "test/lux"} 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])) (.form (do <>.monad [tvars (<>.default (list) ..vars^) + #let [total_vars (list\compose tvars type_vars)] name .local_identifier anns ..annotations^ - inputs (.tuple (<>.some (..type^ type_vars))) - output (..return^ type_vars) - exs (throws_decl^ type_vars)] + inputs (.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 [ ] [(def: #export ( 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 ( (..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 - ["" text (#+ Parser)]]] + ["<.>" text (#+ Parser)]]] [data ["." maybe] ["." text @@ -45,17 +45,17 @@ (|> (do <>.monad [name //parser.class_name parameters (|> (<>.some parameter) - (<>.after (.this //signature.parameters_start)) - (<>.before (.this //signature.parameters_end)) + (<>.after (.this //signature.parameters_start)) + (<>.before (.this //signature.parameters_end)) (<>.default (list)))] (wrap (//.class name parameters))) - (<>.after (.this //descriptor.class_prefix)) - (<>.before (.this //descriptor.class_suffix)))) + (<>.after (.this //descriptor.class_prefix)) + (<>.before (.this //descriptor.class_suffix)))) (template [ ] [(def: (-> (Parser (Type Class)) (Parser (Type Parameter))) - (|>> (<>.after (.this )) + (|>> (<>.after (.this )) (\ <>.monad map )))] [lower //signature.lower_prefix //.lower ..Lower] @@ -88,8 +88,8 @@ (def: (inputs aliasing) (-> Aliasing (Parser (List (Type Value)))) (|> (<>.some (..value aliasing)) - (<>.after (.this //signature.arguments_start)) - (<>.before (.this //signature.arguments_end)))) + (<>.after (.this //signature.arguments_start)) + (<>.before (.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 (.this //signature.exception_prefix)))) + (<>.after (.this //signature.exception_prefix)))) (def: #export (method aliasing type) (-> Aliasing (Type Method) (Type Method)) (|> type //.signature //signature.signature - (.run (do <>.monad - [inputs (..inputs aliasing) - return (..return aliasing) - exceptions (<>.some (..exception aliasing))] - (wrap (//.method [inputs return exceptions])))) + (.run (do <>.monad + [type_variables (|> (<>.some (..var aliasing)) + (<>.after (.this //signature.parameters_start)) + (<>.before (.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) - ["" text (#+ Parser)]]] + ["<.>" text (#+ Parser)]]] [data ["." product] [text @@ -25,7 +25,7 @@ (template [ ] [(def: #export (Parser (Type )) - (<>.after (.this (//signature.signature )) + (<>.after (.this (//signature.signature )) (<>\wrap )))] [Void void //signature.void //.void] @@ -69,8 +69,8 @@ [(def: #export (Parser ) (\ <>.functor map - (.slice (.and! (.one_of! ) - (.some! (.one_of! ))))))] + (.slice (.and! (.one_of! ) + (.some! (.one_of! ))))))] [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 (.this //signature.var_prefix)) - (<>.before (.this //descriptor.class_suffix)))) + (<>.after (.this //signature.var_prefix)) + (<>.before (.this //descriptor.class_suffix)))) (def: #export var (Parser (Type Var)) @@ -90,20 +90,20 @@ (-> (Type Value) (Maybe Text)) (|>> //.signature //signature.signature - (.run ..var') + (.run ..var') try.to_maybe)) (def: #export name (-> (Type Var) Text) (|>> //.signature //signature.signature - (.run ..var') + (.run ..var') try.assume)) (template [ ] [(def: (-> (Parser (Type Class)) (Parser (Type Parameter))) - (|>> (<>.after (.this )) + (|>> (<>.after (.this )) (<>\map )))] [lower //signature.lower_prefix //.lower] @@ -115,12 +115,12 @@ (|> (do <>.monad [name ..class_name parameters (|> (<>.some parameter) - (<>.after (.this //signature.parameters_start)) - (<>.before (.this //signature.parameters_end)) + (<>.after (.this //signature.parameters_start)) + (<>.before (.this //signature.parameters_end)) (<>.default (list)))] (wrap [name parameters])) - (<>.after (.this //descriptor.class_prefix)) - (<>.before (.this //descriptor.class_suffix)))) + (<>.after (.this //descriptor.class_prefix)) + (<>.before (.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 (.this //descriptor.array_prefix)) + (|>> (<>.after (.this //descriptor.array_prefix)) (<>\map //.array))) (def: #export class @@ -154,7 +154,7 @@ (-> (Type Value) (Maybe (Type Class))) (|>> //.signature //signature.signature - (.run (<>.after (.this ) ..class)) + (.run (<>.after (.this ) ..class)) try.to_maybe))] [lower? //signature.lower_prefix //.lower] @@ -165,7 +165,7 @@ (-> (Type Class) [External (List (Type Parameter))]) (|>> //.signature //signature.signature - (.run (..class'' ..parameter)) + (.run (..class'' ..parameter)) try.assume)) (def: #export value @@ -190,8 +190,8 @@ (def: inputs (|> (<>.some ..value) - (<>.after (.this //signature.arguments_start)) - (<>.before (.this //signature.arguments_end)))) + (<>.after (.this //signature.arguments_start)) + (<>.before (.this //signature.arguments_end)))) (def: #export return (Parser (Type Return)) @@ -201,19 +201,29 @@ (def: exception (Parser (Type Class)) (|> (..class' ..parameter) - (<>.after (.this //signature.exception_prefix)))) + (<>.after (.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 (.this //signature.parameters_start)) + (<>.before (.this //signature.parameters_end)) + (<>.default (list))) + ..inputs + ..return + (<>.some ..exception)))] (|>> //.signature //signature.signature - (.run parser) + (.run parser) try.assume))) (template [ ] @@ -221,12 +231,12 @@ (-> (Type Value) (Maybe )) (|>> //.signature //signature.signature - (.run ) + (.run ) try.to_maybe))] [array? (Type Value) (do <>.monad - [_ (.this //descriptor.array_prefix)] + [_ (.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 (.this //signature.parameters_start)) + (<>.before (.this //signature.parameters_end)) + (<>.default (list)))) + (<>.after (.this //descriptor.class_prefix)) + (<>.before (.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 (.this //signature.parameters_start)) - (<>.before (.this //signature.parameters_end)) - (<>.default (list)))) - (<>.after (.this //descriptor.class_prefix)) - (<>.before (.this //descriptor.class_suffix))))] - (|>> //.signature - //signature.signature - (.run declaration') - try.assume))) + (|>> //.signature + //signature.signature + (.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 .text .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 .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 .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 .any .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 "") -(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 (.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 .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 .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 .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 .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 [ ] - [(def: - (-> (List (Type Class)) (Try (List [Text (Type Method)]))) - (|>> (monad.map try.monad (|>> ..reflection reflection!.load)) + [(def: ( 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 )) 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 (.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 "" ..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 "" (type.method [(list) type.void (list)]))) + (_.invokespecial ^StringWriter "" (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 "" (type.method [(list (type.class "java.io.Writer" (list)) type.boolean) type.void (list)])) + (_.invokespecial ^PrintWriter "" (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 "" (type.method [(list) type.void (list)])) + (_.invokespecial ^Object "" (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 diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux index c5756ee97..be03d36f5 100644 --- a/stdlib/source/program/aedifex/pom.lux +++ b/stdlib/source/program/aedifex/pom.lux @@ -18,7 +18,9 @@ [collection ["." list ("#\." monoid functor fold)] ["." set] - ["." dictionary]]]]] + ["." dictionary]]] + [world + ["." file]]]] ["." // #_ ["/" profile] ["#." dependency (#+ Dependency)] @@ -40,6 +42,7 @@ (def: version_tag "version") (def: #export file + file.Path "pom.xml") (def: version diff --git a/stdlib/source/program/aedifex/repository.lux b/stdlib/source/program/aedifex/repository.lux index 93e9096e7..7ae07e9b5 100644 --- a/stdlib/source/program/aedifex/repository.lux +++ b/stdlib/source/program/aedifex/repository.lux @@ -49,6 +49,7 @@ (implementation (def: description (\ mock the_description)) + (def: (download uri) (stm.commit (do {! stm.monad} diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux index 5e5f67bec..5ba4bdbe4 100644 --- a/stdlib/source/test/aedifex/metadata/artifact.lux +++ b/stdlib/source/test/aedifex/metadata/artifact.lux @@ -9,8 +9,19 @@ [control ["." try ("#\." functor)] [parser - ["<.>" xml]]] + ["." environment] + ["<.>" xml]] + [concurrency + ["." promise]]] + [data + ["." maybe] + ["." text ("#\." equivalence)] + [collection + ["." list]]] + [macro + ["." code]] [math + ["." random (#+ Random)] [number ["n" nat]]] ["." time @@ -19,12 +30,16 @@ ["." month] ["." instant] ["." duration]] - [math - ["." random (#+ Random)]] - [macro - ["." code]]]] + [world + ["." file] + ["." program]]]] [\\program - ["." /]]) + ["." / + ["/#" // + ["/#" // #_ + ["#." artifact] + ["#." repository #_ + ["#/." local]]]]]]) (def: #export random (Random /.Metadata) @@ -55,16 +70,47 @@ Test (<| (_.covering /._) (_.for [/.Metadata]) - ($_ _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - (do random.monad - [expected ..random] - (_.cover [/.format /.parser] - (|> expected - /.format - list - (.run /.parser) - (try\map (\ /.equivalence = expected)) - (try.default false)))) - ))) + (do random.monad + [expected ..random + #let [artifact {#///artifact.group (get@ #/.group expected) + #///artifact.name (get@ #/.name expected) + #///artifact.version (|> expected + (get@ #/.versions) + list.head + (maybe.default ""))}]] + ($_ _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (do random.monad + [expected ..random] + (_.cover [/.format /.parser] + (|> expected + /.format + list + (.run /.parser) + (try\map (\ /.equivalence = expected)) + (try.default false)))) + (_.cover [/.uri] + (text\= (//.remote_project_uri artifact) + (/.uri artifact))) + (do random.monad + [home (random.ascii/lower 5) + working_directory (random.ascii/lower 5) + #let [program (program.async (program.mock environment.empty home working_directory)) + fs (file.mock (\ file.default separator)) + repository (///repository/local.repository program fs)]] + (wrap (do promise.monad + [wrote? (/.write repository artifact expected) + actual (/.read repository artifact)] + (_.cover' [/.write /.read] + (and (case wrote? + (#try.Success _) true + (#try.Failure _) false) + (case actual + (#try.Success actual) + (\ /.equivalence = expected actual) + + (#try.Failure _) + false)))))) + )))) diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux index 5a821c452..431370048 100644 --- a/stdlib/source/test/aedifex/metadata/snapshot.lux +++ b/stdlib/source/test/aedifex/metadata/snapshot.lux @@ -9,8 +9,19 @@ [control ["." try ("#\." functor)] [parser - ["<.>" xml]]] + ["." environment] + ["<.>" xml]] + [concurrency + ["." promise]]] + [data + ["." maybe] + ["." text ("#\." equivalence)] + [collection + ["." list]]] + [macro + ["." code]] [math + ["." random (#+ Random) ("#\." monad)] [number ["n" nat]]] ["." time @@ -19,10 +30,9 @@ ["." month] ["." instant (#+ Instant)] ["." duration]] - [math - ["." random (#+ Random) ("#\." monad)]] - [macro - ["." code]]]] + [world + ["." file] + ["." program]]]] ["$." /// #_ ["#." artifact ["#/." type] @@ -31,10 +41,13 @@ ["#/." version]]]] [\\program ["." / - [/// - [artifact - [versioning (#+ Versioning)] - ["#." snapshot]]]]]) + ["/#" // + ["/#" // #_ + [artifact + [versioning (#+ Versioning)] + ["#." snapshot]] + ["#." repository #_ + ["#/." local]]]]]]) (def: random_instant (Random Instant) @@ -60,7 +73,7 @@ (def: random_versioning (Random Versioning) ($_ random.and - (random\wrap #/snapshot.Local) + (random\wrap #///snapshot.Local) $///artifact/time.random (random.list 5 $///artifact/snapshot/version.random) )) @@ -76,16 +89,40 @@ Test (<| (_.covering /._) (_.for [/.Metadata]) - ($_ _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - (do random.monad - [expected ..random] + (do random.monad + [expected ..random + #let [artifact (get@ #/.artifact expected)]] + ($_ _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + (_.cover [/.format /.parser] (|> expected /.format list (.run /.parser) (try\map (\ /.equivalence = expected)) - (try.default false)))) - ))) + (try.default false))) + (_.cover [/.uri] + (text\= (//.remote_artifact_uri artifact) + (/.uri artifact))) + (do random.monad + [home (random.ascii/lower 5) + working_directory (random.ascii/lower 5) + #let [program (program.async (program.mock environment.empty home working_directory)) + fs (file.mock (\ file.default separator)) + repository (///repository/local.repository program fs)]] + (wrap (do promise.monad + [wrote? (/.write repository artifact expected) + actual (/.read repository artifact)] + (_.cover' [/.write /.read] + (and (case wrote? + (#try.Success _) true + (#try.Failure _) false) + (case actual + (#try.Success actual) + (\ /.equivalence = expected actual) + + (#try.Failure _) + false)))))) + )))) diff --git a/stdlib/source/test/aedifex/pom.lux b/stdlib/source/test/aedifex/pom.lux index 24ca3c3c6..01b90c33e 100644 --- a/stdlib/source/test/aedifex/pom.lux +++ b/stdlib/source/test/aedifex/pom.lux @@ -10,6 +10,7 @@ ["<>" parser ["<.>" xml]]] [data + ["." text ("#\." equivalence)] [format ["." xml]]] [math @@ -24,27 +25,33 @@ (def: #export test Test (<| (_.covering /._) - (do random.monad - [expected @profile.random] - (_.cover [/.write /.parser] - (case [(/.write expected) - (get@ #//.identity expected)] - [(#try.Success pom) - (#.Some _)] - (case (.run /.parser (list pom)) - (#try.Success actual) - (\ //.equivalence = - (|> (\ //.monoid identity) - (set@ #//.dependencies (get@ #//.dependencies expected)) - (set@ #//.repositories (get@ #//.repositories expected))) - actual) + ($_ _.and + (_.cover [/.file] + (|> /.file + (text\= "") + not)) + (do random.monad + [expected @profile.random] + (_.cover [/.write /.parser] + (case [(/.write expected) + (get@ #//.identity expected)] + [(#try.Success pom) + (#.Some _)] + (case (.run /.parser (list pom)) + (#try.Success actual) + (\ //.equivalence = + (|> (\ //.monoid identity) + (set@ #//.dependencies (get@ #//.dependencies expected)) + (set@ #//.repositories (get@ #//.repositories expected))) + actual) - (#try.Failure error) - false) + (#try.Failure error) + false) - [(#try.Failure error) - #.None] - (exception.match? //.no_identity error) + [(#try.Failure error) + #.None] + (exception.match? //.no_identity error) - _ - false))))) + _ + false))) + ))) diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux index bdeee7993..5b6de5403 100644 --- a/stdlib/source/test/aedifex/project.lux +++ b/stdlib/source/test/aedifex/project.lux @@ -46,6 +46,10 @@ (_.for [/.monoid] ($monoid.spec /.equivalence /.monoid ..random)) + (_.cover [/.file] + (|> /.file + (text\= "") + not)) (do random.monad [[super_name super_profile] ..profile [dummy_name dummy_profile] (random.filter (|>> product.left (text\= super_name) not) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 1e9976f4e..dffa24069 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -277,16 +277,20 @@ false)) ))) -(interface: (Returner a) +(/.interface: (Returner a) (: (-> Any a) return)) -(implementation: (global_returner value) +(/.implementation: (global_returner value) (All [a] (-> a (Returner a))) (def: (return _) value)) +(def: static_return 123) + +(/.open: "global\." (..global_returner ..static_return)) + (def: for_interface Test (do random.monad @@ -301,6 +305,13 @@ (n.= expected (\ (global_returner expected) return []))) (_.cover [/.implementation] (n.= expected (\ local_returner return []))) + (_.cover [/.open:] + (n.= static_return (global\return []))) + (_.cover [/.^open] + (let [(/.^open "local\.") local_returner] + (n.= expected (local\return [])))) + (_.cover [/.\] + (n.= expected (/.\ local_returner return []))) )))) (def: for_module @@ -587,6 +598,27 @@ false))) ))) +(def: option/0 "0") +(def: option/1 "1") +(def: static_char "@") + +(def: for_static + Test + (do random.monad + [sample (random.either (wrap option/0) + (wrap option/1))] + ($_ _.and + (_.cover [/.static] + (case sample + (^ (/.static option/0)) true + (^ (/.static option/1)) true + _ false)) + (_.cover [/.char] + (|> (`` (/.char (~~ (/.static static_char)))) + text.from_code + (text\= static_char))) + ))) + (def: test Test (<| (_.covering /._) @@ -612,6 +644,7 @@ ..for_i64 ..for_function ..for_template + ..for_static ..sub_tests ))) diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index 3486821ce..d7d9030df 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -115,7 +115,7 @@ (list) (list (/method.method ..method_modifier method_name - (/type.method [(list) ..$Object (list)]) + (/type.method [(list) (list) ..$Object (list)]) (list) (#.Some (do /.monad [_ bytecode] @@ -143,7 +143,7 @@ (def: $Boolean (/type.class "java.lang.Boolean" (list))) (def: $Boolean::wrap - (/.invokestatic ..$Boolean "valueOf" (/type.method [(list /type.boolean) ..$Boolean (list)]))) + (/.invokestatic ..$Boolean "valueOf" (/type.method [(list) (list /type.boolean) ..$Boolean (list)]))) (def: $Boolean::random (:as (Random java/lang/Boolean) random.bit)) (def: !false (|> 0 .i64 i32.i32 /.int)) (def: !true (|> 1 .i64 i32.i32 /.int)) @@ -163,7 +163,7 @@ (def: $Byte (/type.class "java.lang.Byte" (list))) (def: $Byte::wrap - (/.invokestatic ..$Byte "valueOf" (/type.method [(list /type.byte) ..$Byte (list)]))) + (/.invokestatic ..$Byte "valueOf" (/type.method [(list) (list /type.byte) ..$Byte (list)]))) (def: $Byte::random (Random java/lang/Byte) (\ random.monad map (|>> (:as java/lang/Long) ffi.long_to_byte) random.int)) @@ -181,7 +181,7 @@ (def: $Short (/type.class "java.lang.Short" (list))) (def: $Short::wrap - (/.invokestatic ..$Short "valueOf" (/type.method [(list /type.short) ..$Short (list)]))) + (/.invokestatic ..$Short "valueOf" (/type.method [(list) (list /type.short) ..$Short (list)]))) (def: $Short::random (Random java/lang/Short) (\ random.monad map (|>> (:as java/lang/Long) ffi.long_to_short) random.int)) @@ -199,7 +199,7 @@ (def: $Integer (/type.class "java.lang.Integer" (list))) (def: $Integer::wrap - (/.invokestatic ..$Integer "valueOf" (/type.method [(list /type.int) ..$Integer (list)]))) + (/.invokestatic ..$Integer "valueOf" (/type.method [(list) (list /type.int) ..$Integer (list)]))) (def: $Integer::random (Random java/lang/Integer) (\ random.monad map (|>> (:as java/lang/Long) ffi.long_to_int) random.int)) @@ -215,7 +215,7 @@ #literal ..$Integer::literal}) (def: $Long (/type.class "java.lang.Long" (list))) -(def: $Long::wrap (/.invokestatic ..$Long "valueOf" (/type.method [(list /type.long) ..$Long (list)]))) +(def: $Long::wrap (/.invokestatic ..$Long "valueOf" (/type.method [(list) (list /type.long) ..$Long (list)]))) (def: $Long::random (:as (Random java/lang/Long) random.int)) (def: $Long::literal (-> java/lang/Long (Bytecode Any)) (|>> (:as Int) /.long)) (def: $Long::primitive @@ -227,7 +227,7 @@ #literal ..$Long::literal}) (def: $Float (/type.class "java.lang.Float" (list))) -(def: $Float::wrap (/.invokestatic ..$Float "valueOf" (/type.method [(list /type.float) ..$Float (list)]))) +(def: $Float::wrap (/.invokestatic ..$Float "valueOf" (/type.method [(list) (list /type.float) ..$Float (list)]))) (def: $Float::random (Random java/lang/Float) (\ random.monad map @@ -247,7 +247,7 @@ #literal ..$Float::literal}) (def: $Double (/type.class "java.lang.Double" (list))) -(def: $Double::wrap (/.invokestatic ..$Double "valueOf" (/type.method [(list /type.double) ..$Double (list)]))) +(def: $Double::wrap (/.invokestatic ..$Double "valueOf" (/type.method [(list) (list /type.double) ..$Double (list)]))) (def: $Double::random (:as (Random java/lang/Double) random.frac)) (def: $Double::literal (-> java/lang/Double (Bytecode Any)) @@ -267,7 +267,7 @@ (def: $Character (/type.class "java.lang.Character" (list))) (def: $Character::wrap - (/.invokestatic ..$Character "valueOf" (/type.method [(list /type.char) ..$Character (list)]))) + (/.invokestatic ..$Character "valueOf" (/type.method [(list) (list /type.char) ..$Character (list)]))) (def: $Character::random (Random java/lang/Character) (\ random.monad map (|>> (:as java/lang/Long) ffi.long_to_int ffi.int_to_char) random.int)) @@ -747,7 +747,7 @@ (do /.monad [_ (/.new ..$Object) _ /.dup] - (/.invokespecial ..$Object "" (/type.method [(list) /type.void (list)]))))] + (/.invokespecial ..$Object "" (/type.method [(list) (list) /type.void (list)]))))] ($_ _.and (<| (_.lift "ACONST_NULL") (..bytecode (|>> (:as Bit) not)) @@ -796,7 +796,7 @@ (|>> (:as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected)))})) (do /.monad [_ (/.double expected)] - (/.invokestatic ..$Double "valueOf" (/type.method [(list /type.double) ..$Double (list)])))) + (/.invokestatic ..$Double "valueOf" (/type.method [(list) (list /type.double) ..$Double (list)])))) (<| (_.lift "INVOKEVIRTUAL") (do random.monad [expected ..$Double::random]) @@ -804,7 +804,7 @@ (do /.monad [_ (/.double expected) _ ..$Double::wrap - _ (/.invokevirtual ..$Double "isNaN" (/type.method [(list) /type.boolean (list)]))] + _ (/.invokevirtual ..$Double "isNaN" (/type.method [(list) (list) /type.boolean (list)]))] ..$Boolean::wrap)) (<| (_.lift "INVOKESPECIAL") (do random.monad @@ -819,14 +819,14 @@ [_ (/.new ..$Double) _ /.dup _ (/.double expected)] - (/.invokespecial ..$Double "" (/type.method [(list /type.double) /type.void (list)])))) + (/.invokespecial ..$Double "" (/type.method [(list) (list /type.double) /type.void (list)])))) (<| (_.lift "INVOKEINTERFACE") (do random.monad [subject ..$String::random]) (..bytecode (|>> (:as Nat) (n.= (text.size (:as Text subject))))) (do /.monad [_ (/.string (:as Text subject)) - _ (/.invokeinterface (/type.class "java.lang.CharSequence" (list)) "length" (/type.method [(list) /type.int (list)])) + _ (/.invokeinterface (/type.class "java.lang.CharSequence" (list)) "length" (/type.method [(list) (list) /type.int (list)])) _ /.i2l] ..$Long::wrap)) )) @@ -848,7 +848,7 @@ class_field "class_field" object_field "object_field" constructor "" - constructor::type (/type.method [(list /type.long) /type.void (list)]) + constructor::type (/type.method [(list) (list /type.long) /type.void (list)]) static_method "static_method" bytecode (|> (/class.class /version.v6_0 /class.public (/name.internal class_name) @@ -862,7 +862,7 @@ (list) (#.Some (do /.monad [_ /.aload_0 - _ (/.invokespecial ..$Object constructor (/type.method [(list) /type.void (list)])) + _ (/.invokespecial ..$Object constructor (/type.method [(list) (list) /type.void (list)])) _ (..$Long::literal part0) _ (/.putstatic $Self class_field /type.long) _ /.aload_0 @@ -873,7 +873,7 @@ /method.public /method.static) static_method - (/type.method [(list) ..$Long (list)]) + (/type.method [(list) (list) ..$Long (list)]) (list) (#.Some (do /.monad [_ (/.new $Self) @@ -1321,7 +1321,7 @@ (do random.monad [class_name ..class_name primitive_method_name (random.ascii/upper 10) - #let [primitive_method_type (/type.method [(list) (get@ #unboxed primitive) (list)])] + #let [primitive_method_type (/type.method [(list) (list) (get@ #unboxed primitive) (list)])] object_method_name (|> (random.ascii/upper 10) (random.filter (|>> (text\= primitive_method_name) not))) expected (get@ #random primitive) @@ -1341,7 +1341,7 @@ return))) (/method.method ..method_modifier object_method_name - (/type.method [(list) (get@ #boxed primitive) (list)]) + (/type.method [(list) (list) (get@ #boxed primitive) (list)]) (list) (#.Some (do /.monad [_ (/.invokestatic $Self primitive_method_name primitive_method_type) @@ -1433,7 +1433,7 @@ (do /.monad [_ (/.new ..$Object) _ /.dup] - (/.invokespecial ..$Object "" (/type.method [(list) /type.void (list)])))) + (/.invokespecial ..$Object "" (/type.method [(list) (list) /type.void (list)])))) reference_comparison ($_ _.and (_.lift "IF_ACMPEQ" (if! /.if_acmpeq (do /.monad [_ new_object] /.dup))) (_.lift "IF_ACMPNE" (if! /.if_acmpne (do /.monad [_ new_object] new_object))) @@ -1543,7 +1543,7 @@ _ (/.new $Exception) _ /.dup _ (..$String::literal exception) - _ (/.invokespecial $Exception "" (/type.method [(list ..$String) /type.void (list)])) + _ (/.invokespecial $Exception "" (/type.method [(list) (list ..$String) /type.void (list)])) _ /.athrow _ (/.set_label @skipped) _ (..$Long::literal dummy) @@ -1606,8 +1606,8 @@ $Abstract (/type.class abstract_class (list)) $Interface (/type.class interface_class (list)) - constructor::type (/type.method [(list) /type.void (list)]) - method::type (/type.method [(list) /type.long (list)]) + constructor::type (/type.method [(list) (list) /type.void (list)]) + method::type (/type.method [(list) (list) /type.long (list)]) inherited_method "inherited_method" overriden_method "overriden_method" @@ -1682,7 +1682,7 @@ /method.public /method.static) static_method - (/type.method [(list) ..$Long (list)]) + (/type.method [(list) (list) ..$Long (list)]) (list) (#.Some (do /.monad [_ (/.new $Concrete) -- cgit v1.2.3