From 30a237358ca0effc0aabca0a8fbc5ce81a91cb32 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 10 May 2019 00:14:42 -0400 Subject: Grounded some of the machinery used in analysis and generation on the types in "lux/target/jvm/type". --- stdlib/source/lux/target/jvm/type.lux | 21 +- .../tool/compiler/phase/extension/analysis/jvm.lux | 465 ++++++++++++++------- 2 files changed, 333 insertions(+), 153 deletions(-) (limited to 'stdlib/source') diff --git a/stdlib/source/lux/target/jvm/type.lux b/stdlib/source/lux/target/jvm/type.lux index 23925e468..e6532fe0d 100644 --- a/stdlib/source/lux/target/jvm/type.lux +++ b/stdlib/source/lux/target/jvm/type.lux @@ -22,8 +22,8 @@ (def: object-class "java.lang.Object") (type: #export Bound - #Upper - #Lower) + #Lower + #Upper) (type: #export Primitive #Boolean @@ -35,10 +35,12 @@ #Double #Char) +(type: #export Var Text) + (type: #export #rec Generic - (#Var Text) + (#Var Var) (#Wildcard (Maybe [Bound Generic])) - (#Class Text (List Generic))) + (#Class [Text (List Generic)])) (type: #export Class [Text (List Generic)]) @@ -51,11 +53,20 @@ (#Generic Generic) (#Array Type)) +(type: #export Argument + [Text Type]) + +(type: #export Return + (Maybe Type)) + (type: #export Method {#args (List Type) - #return (Maybe Type) + #return Return #exceptions (List Generic)}) +(type: #export (Typed a) + [Type a]) + (template [ ] [(def: #export Type (#Primitive ))] diff --git a/stdlib/source/lux/tool/compiler/phase/extension/analysis/jvm.lux b/stdlib/source/lux/tool/compiler/phase/extension/analysis/jvm.lux index a9417050a..69e80d89f 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension/analysis/jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension/analysis/jvm.lux @@ -1,5 +1,5 @@ (.module: - [lux (#- char int) + [lux (#- Type primitive type char int) ["." host (#+ import:)] ["." macro] [abstract @@ -20,10 +20,10 @@ ["." array (#+ Array)] ["." dictionary (#+ Dictionary)]]] ["." type - ["." check]] + ["." check (#+ Check) ("#@." monad)]] [target [jvm - ["_." type]]]] + ["_." type (#+ Var Bound Primitive Generic Class Type Argument Return Typed)]]]] ["." // #_ ["#." common] ["/#" // @@ -39,10 +39,20 @@ (def: inheritance-relationship-type-name "_jvm_inheritance") (def: (inheritance-relationship-type class super-class super-interfaces) - (-> Type Type (List Type) Type) + (-> .Type .Type (List .Type) .Type) (#.Primitive ..inheritance-relationship-type-name (list& class super-class super-interfaces))) +(template [