diff options
author | Eduardo Julian | 2019-04-09 00:40:21 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-04-09 00:40:21 -0400 |
commit | 1a8f93c02a68d7b3968916c14155a391871d6340 (patch) | |
tree | e6a3f9858a7b2a47f7f540df1083df34110af8f6 | |
parent | d049f53804943bd634f76153b9afbb9b1289361c (diff) |
Fixed a host-related type-checking bug in the old compiler.
-rw-r--r-- | luxc/src/lux/type/host.clj | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/luxc/src/lux/type/host.clj b/luxc/src/lux/type/host.clj index 3b9017d6d..038111c84 100644 --- a/luxc/src/lux/type/host.clj +++ b/luxc/src/lux/type/host.clj @@ -74,36 +74,28 @@ ;; [Utils] (defn ^:private trace-lineage* [^Class super-class ^Class sub-class] "(-> Class Class (List Class))" - ;; Either they're both interfaces, of they're both classes + ;; Either they're both interfaces, or they're both classes (let [valid-sub? #(if (or (= super-class %) (.isAssignableFrom super-class %)) % nil)] - (cond (.isInterface sub-class) - (loop [sub-class sub-class - stack (&/|list)] - (let [super-interface (some valid-sub? (.getInterfaces sub-class))] - (if (= super-class super-interface) - (&/$Cons super-interface stack) - (recur super-interface (&/$Cons super-interface stack))))) - - (.isInterface super-class) - (loop [sub-class sub-class - stack (&/|list)] - (if-let [super-interface (some valid-sub? (.getInterfaces sub-class))] - (if (= super-class super-interface) - (&/$Cons super-interface stack) - (recur super-interface (&/$Cons super-interface stack))) - (let [super* (.getSuperclass sub-class)] - (recur super* (&/$Cons super* stack))))) - - :else - (loop [sub-class sub-class - stack (&/|list)] - (let [super* (.getSuperclass sub-class)] - (if (= super* super-class) - (&/$Cons super* stack) - (recur super* (&/$Cons super* stack)))))))) + (if (or (.isInterface sub-class) + (.isInterface super-class)) + (loop [sub-class sub-class + stack (&/|list)] + (if-let [super-interface (some valid-sub? (.getInterfaces sub-class))] + (if (= super-class super-interface) + (&/$Cons super-interface stack) + (recur super-interface (&/$Cons super-interface stack))) + (if-let [super* (.getSuperclass sub-class)] + (recur super* (&/$Cons super* stack)) + stack))) + (loop [sub-class sub-class + stack (&/|list)] + (let [super* (.getSuperclass sub-class)] + (if (= super* super-class) + (&/$Cons super* stack) + (recur super* (&/$Cons super* stack)))))))) (defn ^:private trace-lineage [^Class sub-class ^Class super-class] "(-> Class Class (List Class))" |