From 639e2f66c4eafa045e9ec0e2e06eb87473b7b51b Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 4 Dec 2016 23:43:07 -0400 Subject: - Fixed a bug wherein aliased definitions where getting assigned non-type values, instead of types in the compiler state. --- luxc/src/lux/compiler/cache.clj | 4 ++-- luxc/src/lux/compiler/lux.clj | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'luxc') diff --git a/luxc/src/lux/compiler/cache.clj b/luxc/src/lux/compiler/cache.clj index 6c44e2a45..5f0a77c65 100644 --- a/luxc/src/lux/compiler/cache.clj +++ b/luxc/src/lux/compiler/cache.clj @@ -163,10 +163,10 @@ 2 (let [[_name _alias] parts [_ __module __name] (re-find #"^(.*);(.*)$" _alias) def-class (&&/load-class! loader (str (&host-generics/->class-name __module) "." (&host/def-name __name))) - def-type (&a-module/def-type __module __name) def-anns (&/|list (&/T [&a-meta/alias-tag (&/$IdentM (&/T [__module __name]))])) def-value (get-field &/value-field def-class)] - (&a-module/define module _name def-type def-anns def-value)) + (|do [def-type (&a-module/def-type __module __name)] + (&a-module/define module _name def-type def-anns def-value))) 3 (let [[_name _type _anns] parts def-class (&&/load-class! loader (str module* "." (&host/def-name _name))) [def-anns _] (&&&ann/deserialize-anns _anns) diff --git a/luxc/src/lux/compiler/lux.clj b/luxc/src/lux/compiler/lux.clj index 5dc8becc0..3d7c4aa7b 100644 --- a/luxc/src/lux/compiler/lux.clj +++ b/luxc/src/lux/compiler/lux.clj @@ -264,9 +264,9 @@ (if (= 1 (&/|length ?meta)) (|do [:let [current-class (&host-generics/->class-name (str (&host/->module-class r-module) "/" (&host/def-name r-name))) def-class (&&/load-class! class-loader current-class) - def-type (&a-module/def-type r-module r-name) def-meta ?meta def-value (-> def-class (.getField &/value-field) (.get nil))] + def-type (&a-module/def-type r-module r-name) _ (&/without-repl-closure (&a-module/define module-name ?name def-type def-meta def-value))] (return nil)) @@ -316,8 +316,10 @@ _ false) - def-meta ?meta - def-value (-> def-class (.getField &/value-field) (.get nil))] + def-meta ?meta] + def-value (try (return (-> def-class (.getField &/value-field) (.get nil))) + (catch Throwable t + (&/assert! "Error during value initialization." (throwable->text t)))) _ (&/without-repl-closure (&a-module/define module-name ?name def-type def-meta def-value)) _ (|case (&/T [is-type? (&a-meta/meta-get &a-meta/tags-tag def-meta)]) @@ -388,7 +390,7 @@ def-meta ?meta] def-value (try (return (-> def-class (.getField &/value-field) (.get nil))) (catch Throwable t - (&/assert! false (throwable->text t)))) + (&/assert! "Error during value initialization." (throwable->text t)))) _ (&/without-repl-closure (&a-module/define module-name ?name def-type def-meta def-value)) _ (|case (&/T [is-type? (&a-meta/meta-get &a-meta/tags-tag def-meta)]) -- cgit v1.2.3