diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/tool/compiler/phase/extension/analysis/host.jvm.lux | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/stdlib/source/lux/tool/compiler/phase/extension/analysis/host.jvm.lux b/stdlib/source/lux/tool/compiler/phase/extension/analysis/host.jvm.lux index 6b1e6ed5b..428bffd66 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension/analysis/host.jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension/analysis/host.jvm.lux @@ -9,10 +9,10 @@ ["." error (#+ Error)] ["." maybe] ["." product] - ["." text ("#/." equivalence) + ["." text ("#;." equivalence) format] [collection - ["." list ("#/." fold functor monoid)] + ["." list ("#;." fold functor monoid)] ["." array (#+ Array)] ["." dictionary (#+ Dictionary)]]] ["." type @@ -24,7 +24,7 @@ ["#." common] ["#/" // ["#." bundle] - ["#/" // ("#/." monad) + ["#/" // ("#;." monad) [analysis [".A" type] [".A" inference]] @@ -96,7 +96,7 @@ (ex.report ["Class" class] ["Method" method] ["Hints" (|> hints - (list/map (|>> product.left %type (format text.new-line text.tab))) + (list;map (|>> product.left %type (format text.new-line text.tab))) (text.join-with ""))]))] [no-candidates] @@ -277,13 +277,13 @@ (-> Type (Operation Text)) (case objectT (#.Primitive name _) - (/////wrap name) + (////;wrap name) (#.Named name unnamed) (check-jvm unnamed) (#.Var id) - (/////wrap "java.lang.Object") + (////;wrap "java.lang.Object") (^template [<tag>] (<tag> env unquantified) @@ -308,7 +308,7 @@ [name (check-jvm objectT)] (if (dictionary.contains? name boxes) (////.throw primitives-are-not-objects name) - (/////wrap name)))) + (////;wrap name)))) (def: (box-array-element-type elemT) (-> Type (Operation [Type Text])) @@ -316,13 +316,13 @@ (#.Primitive name #.Nil) (let [boxed-name (|> (dictionary.get name boxes) (maybe.default name))] - (/////wrap [(#.Primitive boxed-name #.Nil) + (////;wrap [(#.Primitive boxed-name #.Nil) boxed-name])) (#.Primitive name _) (if (dictionary.contains? name boxes) (////.throw primitives-cannot-have-type-parameters name) - (/////wrap [elemT name])) + (////;wrap [elemT name])) _ (////.throw invalid-type-for-array-element (%type elemT)))) @@ -564,7 +564,7 @@ (-> java/lang/reflect/Type (Operation Text)) (<| (case (host.check Class jvm-type) (#.Some jvm-type) - (/////wrap (Class::getName jvm-type)) + (////;wrap (Class::getName jvm-type)) _) (case (host.check ParameterizedType jvm-type) @@ -587,7 +587,7 @@ (let [var-name (TypeVariable::getName java-type)] (case (dictionary.get var-name mappings) (#.Some var-type) - (/////wrap var-type) + (////;wrap var-type) #.None (////.throw unknown-type-var var-name))) @@ -601,21 +601,21 @@ (java-type-to-lux-type mappings bound) _ - (/////wrap Any)) + (////;wrap Any)) _) (case (host.check Class java-type) (#.Some java-type) (let [java-type (:coerce (Class Object) java-type) class-name (Class::getName java-type)] - (/////wrap (case (array.size (Class::getTypeParameters java-type)) + (////;wrap (case (array.size (Class::getTypeParameters java-type)) 0 (#.Primitive class-name (list)) arity (|> (list.indices arity) list.reverse - (list/map (|>> (n/* 2) inc #.Parameter)) + (list;map (|>> (n/* 2) inc #.Parameter)) (#.Primitive class-name) (type.univ-q arity))))) @@ -630,7 +630,7 @@ ParameterizedType::getActualTypeArguments array.to-list (monad.map @ (java-type-to-lux-type mappings)))] - (/////wrap (#.Primitive (Class::getName (:coerce (Class Object) raw)) + (////;wrap (#.Primitive (Class::getName (:coerce (Class Object) raw)) paramsT))) _ @@ -657,7 +657,7 @@ class-params (array.to-list (Class::getTypeParameters class)) num-class-params (list.size class-params) num-type-params (list.size params)] - (cond (not (text/= class-name name)) + (cond (not (text;= class-name name)) (////.throw cannot-correspond-type-with-a-class (format "Class = " class-name text.new-line "Type = " (%type type))) @@ -670,8 +670,8 @@ " Type: " (%type type))) ## else - (/////wrap (|> params - (list.zip2 (list/map (|>> TypeVariable::getName) class-params)) + (////;wrap (|> params + (list.zip2 (list;map (|>> TypeVariable::getName) class-params)) (dictionary.from-list text.hash))) )) @@ -714,7 +714,7 @@ (not (dictionary.contains? to-name boxes))) to-class (load-class to-name)] (loop [[current-name currentT] [from-name valueT]] - (if (text/= to-name current-name) + (if (text;= to-name current-name) (do @ [_ (typeA.infer toT)] (wrap #1)) @@ -734,7 +734,7 @@ (array.to-list (Class::getGenericInterfaces current-class))))] (case (|> candiate-parents (list.filter product.right) - (list/map product.left)) + (list;map product.left)) (#.Cons [next-name nextJT] _) (do @ [mapping (correspond-type-params current-class currentT) @@ -810,7 +810,7 @@ var-names (|> class Class::getTypeParameters array.to-list - (list/map (|>> TypeVariable::getName)))] + (list;map (|>> TypeVariable::getName)))] mappings (: (Operation Mappings) (case objectT (#.Primitive _class-name _class-params) @@ -918,7 +918,7 @@ (-> java/lang/reflect/Type (Operation Text)) (<| (case (host.check Class type) (#.Some type) - (/////wrap (Class::getName type)) + (////;wrap (Class::getName type)) _) (case (host.check ParameterizedType type) @@ -928,12 +928,12 @@ _) (case (host.check TypeVariable type) (#.Some type) - (/////wrap "java.lang.Object") + (////;wrap "java.lang.Object") _) (case (host.check WildcardType type) (#.Some type) - (/////wrap "java.lang.Object") + (////;wrap "java.lang.Object") _) (case (host.check GenericArrayType type) @@ -962,7 +962,7 @@ (monad.map @ java-type-to-parameter)) #let [modifiers (Method::getModifiers method)]] (wrap (and (Object::equals class (Method::getDeclaringClass method)) - (text/= method-name (Method::getName method)) + (text;= method-name (Method::getName method)) (case #Static #Special (Modifier::isStatic modifiers) @@ -977,9 +977,9 @@ _ #1) (n/= (list.size arg-classes) (list.size parameters)) - (list/fold (function (_ [expectedJC actualJC] prev) + (list;fold (function (_ [expectedJC actualJC] prev) (and prev - (text/= expectedJC actualJC))) + (text;= expectedJC actualJC))) #1 (list.zip2 arg-classes parameters)))))) @@ -991,9 +991,9 @@ (monad.map @ java-type-to-parameter))] (wrap (and (Object::equals class (Constructor::getDeclaringClass constructor)) (n/= (list.size arg-classes) (list.size parameters)) - (list/fold (function (_ [expectedJC actualJC] prev) + (list;fold (function (_ [expectedJC actualJC] prev) (and prev - (text/= expectedJC actualJC))) + (text;= expectedJC actualJC))) #1 (list.zip2 arg-classes parameters)))))) @@ -1006,7 +1006,7 @@ (if (n/= 0 amount) (list) (|> (list.indices amount) - (list/map (|>> (n/+ offset) idx-to-parameter))))) + (list;map (|>> (n/+ offset) idx-to-parameter))))) (def: (method-signature method-style method) (-> Method-Style Method (Operation Method-Signature)) @@ -1019,20 +1019,20 @@ _ (|> (Class::getTypeParameters owner) array.to-list - (list/map (|>> TypeVariable::getName)))) + (list;map (|>> TypeVariable::getName)))) method-tvars (|> (Method::getTypeParameters method) array.to-list - (list/map (|>> TypeVariable::getName))) + (list;map (|>> TypeVariable::getName))) num-owner-tvars (list.size owner-tvars) num-method-tvars (list.size method-tvars) - all-tvars (list/compose owner-tvars method-tvars) + all-tvars (list;compose owner-tvars method-tvars) num-all-tvars (list.size all-tvars) owner-tvarsT (type-vars num-owner-tvars 0) method-tvarsT (type-vars num-method-tvars num-owner-tvars) mappings (: Mappings (if (list.empty? all-tvars) fresh-mappings - (|> (list/compose owner-tvarsT method-tvarsT) + (|> (list;compose owner-tvarsT method-tvarsT) list.reverse (list.zip2 all-tvars) (dictionary.from-list text.hash))))] @@ -1087,7 +1087,7 @@ (cond passes? (:: @ map (|>> #Pass) (method-signature method-style method)) - (text/= method-name (Method::getName method)) + (text;= method-name (Method::getName method)) (:: @ map (|>> #Hint) (method-signature method-style method)) ## else @@ -1108,19 +1108,19 @@ owner-name (Class::getName owner) owner-tvars (|> (Class::getTypeParameters owner) array.to-list - (list/map (|>> TypeVariable::getName))) + (list;map (|>> TypeVariable::getName))) constructor-tvars (|> (Constructor::getTypeParameters constructor) array.to-list - (list/map (|>> TypeVariable::getName))) + (list;map (|>> TypeVariable::getName))) num-owner-tvars (list.size owner-tvars) - all-tvars (list/compose owner-tvars constructor-tvars) + all-tvars (list;compose owner-tvars constructor-tvars) num-all-tvars (list.size all-tvars) owner-tvarsT (type-vars num-owner-tvars 0) constructor-tvarsT (type-vars num-all-tvars num-owner-tvars) mappings (: Mappings (if (list.empty? all-tvars) fresh-mappings - (|> (list/compose owner-tvarsT constructor-tvarsT) + (|> (list;compose owner-tvarsT constructor-tvarsT) list.reverse (list.zip2 all-tvars) (dictionary.from-list text.hash))))] @@ -1165,8 +1165,8 @@ (def: (decorate-inputs typesT inputsA) (-> (List Text) (List Analysis) (List Analysis)) (|> inputsA - (list.zip2 (list/map /////analysis.text typesT)) - (list/map (function (_ [type value]) + (list.zip2 (list;map /////analysis.text typesT)) + (list;map (function (_ [type value]) (/////analysis.tuple (list type value)))))) (def: invoke::static @@ -1176,9 +1176,9 @@ (s.run args ($_ p.and s.text s.text (p.some (s.tuple (p.and s.text s.any)))))) (#error.Success [class method argsTC]) (do ////.monad - [#let [argsT (list/map product.left argsTC)] + [#let [argsT (list;map product.left argsTC)] [methodT exceptionsT] (method-candidate class method #Static argsT) - [outputT argsA] (inferenceA.general analyse methodT (list/map product.right argsTC)) + [outputT argsA] (inferenceA.general analyse methodT (list;map product.right argsTC)) outputJC (check-jvm outputT)] (wrap (#/////analysis.Extension extension-name (list& (/////analysis.text class) (/////analysis.text method) (/////analysis.text outputJC) (decorate-inputs argsT argsA))))) @@ -1193,9 +1193,9 @@ (s.run args ($_ p.and s.text s.text s.any (p.some (s.tuple (p.and s.text s.any)))))) (#error.Success [class method objectC argsTC]) (do ////.monad - [#let [argsT (list/map product.left argsTC)] + [#let [argsT (list;map product.left argsTC)] [methodT exceptionsT] (method-candidate class method #Virtual argsT) - [outputT allA] (inferenceA.general analyse methodT (list& objectC (list/map product.right argsTC))) + [outputT allA] (inferenceA.general analyse methodT (list& objectC (list;map product.right argsTC))) #let [[objectA argsA] (case allA (#.Cons objectA argsA) [objectA argsA] @@ -1216,9 +1216,9 @@ (p.run args ($_ p.and s.text s.text s.any (p.some (s.tuple (p.and s.text s.any))) s.end!))) (#error.Success [_ [class method objectC argsTC _]]) (do ////.monad - [#let [argsT (list/map product.left argsTC)] + [#let [argsT (list;map product.left argsTC)] [methodT exceptionsT] (method-candidate class method #Special argsT) - [outputT argsA] (inferenceA.general analyse methodT (list& objectC (list/map product.right argsTC))) + [outputT argsA] (inferenceA.general analyse methodT (list& objectC (list;map product.right argsTC))) outputJC (check-jvm outputT)] (wrap (#/////analysis.Extension extension-name (list& (/////analysis.text class) (/////analysis.text method) (/////analysis.text outputJC) (decorate-inputs argsT argsA))))) @@ -1233,12 +1233,12 @@ (s.run args ($_ p.and s.text s.text s.any (p.some (s.tuple (p.and s.text s.any)))))) (#error.Success [class-name method objectC argsTC]) (do ////.monad - [#let [argsT (list/map product.left argsTC)] + [#let [argsT (list;map product.left argsTC)] class (load-class class-name) _ (////.assert non-interface class-name (Modifier::isInterface (Class::getModifiers class))) [methodT exceptionsT] (method-candidate class-name method #Interface argsT) - [outputT argsA] (inferenceA.general analyse methodT (list& objectC (list/map product.right argsTC))) + [outputT argsA] (inferenceA.general analyse methodT (list& objectC (list;map product.right argsTC))) outputJC (check-jvm outputT)] (wrap (#/////analysis.Extension extension-name (list& (/////analysis.text class-name) (/////analysis.text method) (/////analysis.text outputJC) @@ -1254,9 +1254,9 @@ (s.run args ($_ p.and s.text (p.some (s.tuple (p.and s.text s.any)))))) (#error.Success [class argsTC]) (do ////.monad - [#let [argsT (list/map product.left argsTC)] + [#let [argsT (list;map product.left argsTC)] [methodT exceptionsT] (constructor-candidate class argsT) - [outputT argsA] (inferenceA.general analyse methodT (list/map product.right argsTC))] + [outputT argsA] (inferenceA.general analyse methodT (list;map product.right argsTC))] (wrap (#/////analysis.Extension extension-name (list& (/////analysis.text class) (decorate-inputs argsT argsA))))) _ |