diff options
author | Eduardo Julian | 2016-02-15 13:03:21 -0400 |
---|---|---|
committer | Eduardo Julian | 2016-02-15 13:03:21 -0400 |
commit | 60e45bab087d2598510189cbec29b4a566671273 (patch) | |
tree | 47f80f1d4b144a6d0bfb444463abfa423d783d18 | |
parent | 748267663bb0d1e67eb674c010bd97b00b03fff3 (diff) |
- Improved the instantiation of generic types when using unparameterized classes.
- Added beta-reduction for ExQ.
- Improved ident->text.
-rw-r--r-- | src/lux/base.clj | 4 | ||||
-rw-r--r-- | src/lux/type.clj | 18 | ||||
-rw-r--r-- | src/lux/type/host.clj | 4 |
3 files changed, 17 insertions, 9 deletions
diff --git a/src/lux/base.clj b/src/lux/base.clj index d653a11b1..74bb7bfc1 100644 --- a/src/lux/base.clj +++ b/src/lux/base.clj @@ -934,7 +934,9 @@ (defn ident->text [ident] (|let [[?module ?name] ident] - (str ?module ";" ?name))) + (if (= "" ?module) + ?name + (str ?module ";" ?name)))) (defn fold2% [f init xs ys] (|case [xs ys] diff --git a/src/lux/type.clj b/src/lux/type.clj index 8869b2577..224308f0f 100644 --- a/src/lux/type.clj +++ b/src/lux/type.clj @@ -514,18 +514,14 @@ (&/$DataT ?name (&/|map (partial beta-reduce env) ?params)) (&/$SumT ?left ?right) - (let [=left (beta-reduce env ?left) - =right (beta-reduce env ?right)] - (&/$SumT =left =right)) + (&/$SumT (beta-reduce env ?left) (beta-reduce env ?right)) (&/$ProdT ?left ?right) - (let [=left (beta-reduce env ?left) - =right (beta-reduce env ?right)] - (&/$ProdT =left =right)) + (&/$ProdT (beta-reduce env ?left) (beta-reduce env ?right)) (&/$AppT ?type-fn ?type-arg) (&/$AppT (beta-reduce env ?type-fn) (beta-reduce env ?type-arg)) - + (&/$UnivQ ?local-env ?local-def) (|case ?local-env (&/$Nil) @@ -534,6 +530,14 @@ _ type) + (&/$ExQ ?local-env ?local-def) + (|case ?local-env + (&/$Nil) + (&/$ExQ env ?local-def) + + _ + type) + (&/$LambdaT ?input ?output) (&/$LambdaT (beta-reduce env ?input) (beta-reduce env ?output)) diff --git a/src/lux/type/host.clj b/src/lux/type/host.clj index 1a174bb27..9717b0e75 100644 --- a/src/lux/type/host.clj +++ b/src/lux/type/host.clj @@ -81,7 +81,9 @@ (if (.equals "void" base) &/$UnitT (reduce (fn [inner _] (&/$DataT array-data-tag (&/|list inner))) - (&/$DataT base &/$Nil) + (&/$DataT base (-> class .getTypeParameters + seq count (repeat (&/$DataT "java.lang.Object" &/$Nil)) + &/->list)) (range (count (or arr-obrackets arr-pbrackets ""))))) )))) |