aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lux/analyser/host.clj9
-rw-r--r--src/lux/analyser/parser.clj3
-rw-r--r--src/lux/base.clj3
-rw-r--r--src/lux/host/generics.clj12
-rw-r--r--src/lux/type.clj2
-rw-r--r--src/lux/type/host.clj2
6 files changed, 29 insertions, 2 deletions
diff --git a/src/lux/analyser/host.clj b/src/lux/analyser/host.clj
index cf503f188..0ccfc9a5c 100644
--- a/src/lux/analyser/host.clj
+++ b/src/lux/analyser/host.clj
@@ -459,6 +459,9 @@
(|case gclass
(&/$GenericTypeVar var-name)
"java.lang.Object"
+
+ (&/$GenericWildcard)
+ "java.lang.Object"
(&/$GenericClass name params)
name
@@ -496,6 +499,9 @@
(str "[L" name ";")
(&/$GenericTypeVar var-name)
+ "[Ljava.lang.Object;"
+
+ (&/$GenericWildcard)
"[Ljava.lang.Object;")
))
@@ -525,6 +531,9 @@
(&/$GenericArray param)
(|do [=param (generic-class->type env param)]
(return (&type/Data$ &host-type/array-data-tag (&/|list =param))))
+
+ (&/$GenericWildcard)
+ (return (&type/Ex$ (&/|list) (&type/Bound$ 1)))
))
(defn gen-super-env [class-env supers class-decl]
diff --git a/src/lux/analyser/parser.clj b/src/lux/analyser/parser.clj
index 3fcf71d8b..c6a24c4e2 100644
--- a/src/lux/analyser/parser.clj
+++ b/src/lux/analyser/parser.clj
@@ -37,6 +37,9 @@
(defn parse-gclass [ast]
(|case ast
+ [_ (&/$TextS "*")]
+ (return (&/V &/$GenericWildcard nil))
+
[_ (&/$TextS var-name)]
(return (&/V &/$GenericTypeVar var-name))
diff --git a/src/lux/base.clj b/src/lux/base.clj
index 4f34f8c24..78625f39c 100644
--- a/src/lux/base.clj
+++ b/src/lux/base.clj
@@ -110,7 +110,8 @@
(deftags
["GenericTypeVar"
"GenericClass"
- "GenericArray"])
+ "GenericArray"
+ "GenericWildcard"])
;; Methods
(deftags
diff --git a/src/lux/host/generics.clj b/src/lux/host/generics.clj
index 1050da53a..169827789 100644
--- a/src/lux/host/generics.clj
+++ b/src/lux/host/generics.clj
@@ -56,6 +56,9 @@
(|case super
(&/$GenericTypeVar name)
(str "T" name ";")
+
+ (&/$GenericWildcard)
+ "*"
(&/$GenericClass name params)
(case name
@@ -97,6 +100,9 @@
(|case gclass
(&/$GenericTypeVar name)
object-simple-signature
+
+ (&/$GenericWildcard)
+ object-simple-signature
(&/$GenericClass name params)
(->type-signature name)
@@ -112,6 +118,9 @@
(|case gclass
(&/$GenericTypeVar name)
(->bytecode-class-name "java.lang.Object")
+
+ (&/$GenericWildcard)
+ (->bytecode-class-name "java.lang.Object")
(&/$GenericClass name params)
(->bytecode-class-name name)
@@ -128,6 +137,9 @@
(|case gclass
(&/$GenericTypeVar name)
object-bc-name
+
+ (&/$GenericWildcard)
+ object-bc-name
(&/$GenericClass name params)
(->bytecode-class-name name)
diff --git a/src/lux/type.clj b/src/lux/type.clj
index 5fa2e090c..f53e80af7 100644
--- a/src/lux/type.clj
+++ b/src/lux/type.clj
@@ -41,6 +41,8 @@
(&/V &/$VariantT members))
(defn Univ$ [env body]
(&/V &/$UnivQ (&/T env body)))
+(defn Ex$ [env body]
+ (&/V &/$ExQ (&/T env body)))
(defn Named$ [name type]
(&/V &/$NamedT (&/T name type)))
diff --git a/src/lux/type/host.clj b/src/lux/type/host.clj
index 9a7546ca4..6e783821c 100644
--- a/src/lux/type/host.clj
+++ b/src/lux/type/host.clj
@@ -256,4 +256,4 @@
(instance? WildcardType gtype)
(if-let [bound (->> ^WildcardType gtype .getUpperBounds seq first)]
(gtype->gclass bound)
- (&/V &/$GenericClass (&/T "java.lang.Object" &/Nil$)))))
+ (&/V &/$GenericWildcard nil))))