diff options
-rw-r--r-- | src/lux/compiler/lux.clj | 16 | ||||
-rw-r--r-- | src/lux/type.clj | 4 |
2 files changed, 9 insertions, 11 deletions
diff --git a/src/lux/compiler/lux.clj b/src/lux/compiler/lux.clj index 72326447a..74c6221bb 100644 --- a/src/lux/compiler/lux.clj +++ b/src/lux/compiler/lux.clj @@ -35,21 +35,19 @@ :let [_ (.visitFieldInsn *writer* Opcodes/GETSTATIC "java/lang/Boolean" (if ?value "TRUE" "FALSE") "Ljava/lang/Boolean;")]] (return nil))) -(do-template [<name> <class> <sig> <caster>] +(do-template [<name> <class> <prim> <caster>] (defn <name> [value] (|do [^MethodVisitor *writer* &/get-writer :let [_ (doto *writer* - (.visitTypeInsn Opcodes/NEW <class>) - (.visitInsn Opcodes/DUP) (.visitLdcInsn (<caster> value)) - (.visitMethodInsn Opcodes/INVOKESPECIAL <class> "<init>" <sig>))]] + (.visitMethodInsn Opcodes/INVOKESTATIC <class> "valueOf" (str "(" <prim> ")" (&host-generics/->type-signature <class>))))]] (return nil))) - compile-nat "java/lang/Long" "(J)V" long - compile-int "java/lang/Long" "(J)V" long - compile-frac "java/lang/Long" "(J)V" long - compile-real "java/lang/Double" "(D)V" double - compile-char "java/lang/Character" "(C)V" char + compile-nat "java/lang/Long" "J" long + compile-int "java/lang/Long" "J" long + compile-frac "java/lang/Long" "J" long + compile-real "java/lang/Double" "D" double + compile-char "java/lang/Character" "C" char ) (defn compile-text [?value] diff --git a/src/lux/type.clj b/src/lux/type.clj index 05a353e85..87c330691 100644 --- a/src/lux/type.clj +++ b/src/lux/type.clj @@ -815,10 +815,10 @@ (return fixpoints) (check-error "" expected actual)) - [(&/$NamedT ?ename ?etype) _] + [(&/$NamedT _ ?etype) _] (check* class-loader fixpoints invariant?? ?etype actual) - [_ (&/$NamedT ?aname ?atype)] + [_ (&/$NamedT _ ?atype)] (check* class-loader fixpoints invariant?? expected ?atype) [_ _] |