diff options
author | Eduardo Julian | 2016-02-06 19:34:50 -0400 |
---|---|---|
committer | Eduardo Julian | 2016-02-06 19:34:50 -0400 |
commit | c8e351eb694b8cd1d9d3cea3b0c6c9e52eebe714 (patch) | |
tree | f321039909afcfa57c95130963a7917542c0c3a4 | |
parent | 0ab36505d13cdf83391e240b29b34e5cbbe6bed2 (diff) |
- Fixed some bugs wherein type-variables being created where not getting removed from types that used them.
-rw-r--r-- | src/lux/analyser/base.clj | 6 | ||||
-rw-r--r-- | src/lux/analyser/case.clj | 5 | ||||
-rw-r--r-- | src/lux/analyser/host.clj | 7 | ||||
-rw-r--r-- | src/lux/analyser/lux.clj | 19 |
4 files changed, 21 insertions, 16 deletions
diff --git a/src/lux/analyser/base.clj b/src/lux/analyser/base.clj index 318149b9f..62b2b5aad 100644 --- a/src/lux/analyser/base.clj +++ b/src/lux/analyser/base.clj @@ -182,10 +182,8 @@ (defn analyse-1+ [analyse ?token] (&type/with-var (fn [$var] - (|do [=expr (analyse-1 analyse $var ?token) - :let [[[?type ?cursor] ?item] =expr] - =type (&type/clean $var ?type)] - (return (&/T [(&/T [=type ?cursor]) ?item])))))) + (|do [=expr (analyse-1 analyse $var ?token)] + (clean-analysis $var =expr))))) (defn resolved-ident [ident] (|do [:let [[?module ?name] ident] diff --git a/src/lux/analyser/case.clj b/src/lux/analyser/case.clj index c4372b4a1..3480e50c6 100644 --- a/src/lux/analyser/case.clj +++ b/src/lux/analyser/case.clj @@ -66,8 +66,9 @@ (&/$UnivQ _aenv _abody) (&type/with-var (fn [$var] - (|do [=type (&type/apply-type type $var)] - (adjust-type* (&/Cons$ (&/T [_aenv 1 $var]) (&/|map update-up-frame up)) =type)))) + (|do [=type (&type/apply-type type $var) + ==type (adjust-type* (&/Cons$ (&/T [_aenv 1 $var]) (&/|map update-up-frame up)) =type)] + (&type/clean $var ==type)))) (&/$ExQ _aenv _abody) (|do [$var &type/existential diff --git a/src/lux/analyser/host.clj b/src/lux/analyser/host.clj index a467e7822..25dd1d241 100644 --- a/src/lux/analyser/host.clj +++ b/src/lux/analyser/host.clj @@ -355,8 +355,11 @@ (&/$Cons ^TypeVariable gtv gtype-vars*) (&type/with-var (fn [$var] - (|let [gtype-env* (&/Cons$ (&/T [(.getName gtv) $var]) gtype-env)] - (analyse-jvm-new-helper analyse gtype gtype-env* gtype-vars* gtype-args args)))) + (|do [:let [gtype-env* (&/Cons$ (&/T [(.getName gtv) $var]) gtype-env)] + [=gret =args] (analyse-jvm-new-helper analyse gtype gtype-env* gtype-vars* gtype-args args) + ==gret (&type/clean $var =gret) + ==args (&/map% (partial &&/clean-analysis $var) =args)] + (return (&/T [==gret ==args]))))) )) (defn analyse-jvm-new [analyse exo-type class classes args] diff --git a/src/lux/analyser/lux.clj b/src/lux/analyser/lux.clj index 04f2c9828..29cc253a8 100644 --- a/src/lux/analyser/lux.clj +++ b/src/lux/analyser/lux.clj @@ -228,8 +228,9 @@ (&/$ExQ _) (&type/with-var (fn [$var] - (|do [exo-type** (&type/apply-type exo-type* $var)] - (analyse-variant analyse (&/V &/$Right exo-type**) idx is-last? ?values)))) + (|do [exo-type** (&type/apply-type exo-type* $var) + =exprs (analyse-variant analyse (&/V &/$Right exo-type**) idx is-last? ?values)] + (&/map% (partial &&/clean-analysis $var) =exprs)))) _ (fail (str "[Analyser Error] Can't create variant if the expected type is " (&type/show-type exo-type*)))) @@ -331,7 +332,8 @@ (&type/with-var (fn [$var] (|do [type* (&type/apply-type ?fun-type* $var) - [=output-t =args] (analyse-apply* analyse exo-type type* ?args)] + [=output-t =args] (analyse-apply* analyse exo-type type* ?args) + ==args (&/map% (partial &&/clean-analysis $var) =args)] (|case $var (&/$VarT ?id) (|do [? (&type/bound? ?id) @@ -339,7 +341,7 @@ (&type/clean $var =output-t) (|do [_ (&type/set-var ?id (&/V &/$BoundT 1))] (&type/clean $var =output-t)))] - (return (&/T [type** =args]))) + (return (&/T [type** ==args]))) )))) (&/$ExQ _) @@ -378,8 +380,8 @@ (&/$Some _) (|do [macro-expansion (fn [state] (-> ?value (.apply ?args) (.apply state))) ;; :let [[r-prefix r-name] real-name - ;; _ (when (or (= "using" r-prefix) - ;; ;; (= "defsig" r-prefix) + ;; _ (when (or (= "jvm-import" r-name) + ;; ;; (= "@type" r-name) ;; ) ;; (->> (&/|map &/show-ast macro-expansion) ;; (&/|interpose "\n") @@ -456,8 +458,9 @@ (&/$ExQ _) (&type/with-var (fn [$var] - (|do [exo-type** (&type/apply-type exo-type* $var)] - (analyse-lambda* analyse exo-type** ?self ?arg ?body)))) + (|do [exo-type** (&type/apply-type exo-type* $var) + =expr (analyse-lambda* analyse exo-type** ?self ?arg ?body)] + (&&/clean-analysis $var =expr)))) (&/$LambdaT ?arg-t ?return-t) (|do [[=scope =captured =body] (&&lambda/with-lambda ?self exo-type* |