From 7e9db69d78ae4abbad922e093361fc2632518008 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 24 Dec 2015 19:00:49 -0400 Subject: - Fixed a bug wherein the wrong super-class name was being generated (due to a type error >_<) when generating the default constructor for anonymous classes. - Fixed a bug when tracing the lineage of interfaces when doing host-type type-checking. --- src/lux/compiler/host.clj | 5 +++-- src/lux/type/host.clj | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lux/compiler/host.clj b/src/lux/compiler/host.clj index ceec03870..3c937b2af 100644 --- a/src/lux/compiler/host.clj +++ b/src/lux/compiler/host.clj @@ -597,7 +597,8 @@ -return)) (defn ^:private add-anon-class- [^ClassWriter class-writer compile class-name super-class env ctor-args] - (let [init-types (->> ctor-args (&/|map (comp &host-generics/->type-signature &/|first)) (&/fold str ""))] + (|let [[super-class-name super-class-params] super-class + init-types (->> ctor-args (&/|map (comp &host-generics/->type-signature &/|first)) (&/fold str ""))] (&/with-writer (.visitMethod class-writer Opcodes/ACC_PUBLIC init-method (anon-class--signature env) nil nil) (|do [^MethodVisitor =method &/get-writer :let [_ (doto =method (.visitCode) @@ -609,7 +610,7 @@ (return nil)))) ctor-args) :let [_ (doto =method - (.visitMethodInsn Opcodes/INVOKESPECIAL (&host-generics/->bytecode-class-name super-class) init-method (str "(" init-types ")" -return)) + (.visitMethodInsn Opcodes/INVOKESPECIAL (&host-generics/->bytecode-class-name super-class-name) init-method (str "(" init-types ")" -return)) (-> (doto (.visitVarInsn Opcodes/ALOAD 0) (.visitVarInsn Opcodes/ALOAD (inc ?captured-id)) (.visitFieldInsn Opcodes/PUTFIELD class-name captured-name clo-field-sig)) diff --git a/src/lux/type/host.clj b/src/lux/type/host.clj index ac045eebe..5f19904d3 100644 --- a/src/lux/type/host.clj +++ b/src/lux/type/host.clj @@ -31,8 +31,7 @@ (.getInterfaces sub-class))] (if (= super-class super-interface) (&/Cons$ super-interface stack) - (let [super* (.getSuperclass sub-class)] - (recur super* (&/Cons$ super* stack))))))) + (recur super-interface (&/Cons$ super-interface stack)))))) (.isInterface super-class) (let [class<=interface? #(if (= super-class %) % nil)] -- cgit v1.2.3