aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/host.old.lux
diff options
context:
space:
mode:
authorEduardo Julian2019-05-28 22:14:53 -0400
committerEduardo Julian2019-05-28 22:14:53 -0400
commit8cd61c00de00728759d0362a60dbca8d23e4d8dc (patch)
tree4eaf5b75bea6bd84b1db28eb405539213392a588 /stdlib/source/lux/host.old.lux
parentf55e513690400cce9e5e17a01a98922d91e086c3 (diff)
Both the old JVM interop and the new JVM interop use the same syntax for array types.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/host.old.lux87
1 files changed, 44 insertions, 43 deletions
diff --git a/stdlib/source/lux/host.old.lux b/stdlib/source/lux/host.old.lux
index 32bb3887f..5c2ac40d9 100644
--- a/stdlib/source/lux/host.old.lux
+++ b/stdlib/source/lux/host.old.lux
@@ -669,47 +669,48 @@
(def: (generic-type^ imports type-vars)
(-> Class-Imports (List Type-Parameter) (Parser GenericType))
- ($_ p.either
- (do p.monad
- [_ (s.this! (' ?))]
- (wrap (#GenericWildcard #.None)))
- (s.tuple (do p.monad
- [_ (s.this! (' ?))
- bound-kind bound-kind^
- bound (generic-type^ imports type-vars)]
- (wrap (#GenericWildcard (#.Some [bound-kind bound])))))
- (do p.monad
- [name (full-class-name^ imports)
- _ (assert-no-periods name)]
- (if (list.member? text.equivalence (list@map product.left type-vars) name)
- (wrap (#GenericTypeVar name))
- (wrap (#GenericClass name (list)))))
- (s.form (do p.monad
- [name (s.this! (' Array))
- component (generic-type^ imports type-vars)]
- (case component
- (^template [<class> <name>]
- (#GenericClass <name> #.Nil)
- (wrap (#GenericClass <class> (list))))
- (["[Z" "boolean"]
- ["[B" "byte"]
- ["[S" "short"]
- ["[I" "int"]
- ["[J" "long"]
- ["[F" "float"]
- ["[D" "double"]
- ["[C" "char"])
-
- _
- (wrap (#GenericArray component)))))
- (s.form (do p.monad
- [name (full-class-name^ imports)
- _ (assert-no-periods name)
- params (p.some (generic-type^ imports type-vars))
- _ (p.assert (format name " cannot be a type-parameter!")
- (not (list.member? text.equivalence (list@map product.left type-vars) name)))]
- (wrap (#GenericClass name params))))
- ))
+ (p.rec
+ (function (_ recur^)
+ ($_ p.either
+ (do p.monad
+ [_ (s.this! (' ?))]
+ (wrap (#GenericWildcard #.None)))
+ (s.tuple (do p.monad
+ [_ (s.this! (' ?))
+ bound-kind bound-kind^
+ bound recur^]
+ (wrap (#GenericWildcard (#.Some [bound-kind bound])))))
+ (do p.monad
+ [name (full-class-name^ imports)
+ _ (assert-no-periods name)]
+ (if (list.member? text.equivalence (list@map product.left type-vars) name)
+ (wrap (#GenericTypeVar name))
+ (wrap (#GenericClass name (list)))))
+ (s.tuple (do p.monad
+ [component recur^]
+ (case component
+ (^template [<class> <name>]
+ (#GenericClass <name> #.Nil)
+ (wrap (#GenericClass <class> (list))))
+ (["[Z" "boolean"]
+ ["[B" "byte"]
+ ["[S" "short"]
+ ["[I" "int"]
+ ["[J" "long"]
+ ["[F" "float"]
+ ["[D" "double"]
+ ["[C" "char"])
+
+ _
+ (wrap (#GenericArray component)))))
+ (s.form (do p.monad
+ [name (full-class-name^ imports)
+ _ (assert-no-periods name)
+ params (p.some recur^)
+ _ (p.assert (format name " cannot be a type-parameter!")
+ (not (list.member? text.equivalence (list@map product.left type-vars) name)))]
+ (wrap (#GenericClass name params))))
+ ))))
(def: (type-param^ imports)
(-> Class-Imports (Parser Type-Parameter))
@@ -1816,7 +1817,7 @@
"#io means the computation has side effects, and will be wrapped by the IO type."
"These options must show up in the following order [#io #try #?] (although, each option can be used independently)."
(import: java/lang/String
- (new [(Array byte)])
+ (new [[byte]])
(#static valueOf [char] String)
(#static valueOf #as int-valueOf [int] String))
@@ -1825,7 +1826,7 @@
(get [int] e))
(import: (java/util/ArrayList a)
- ([T] toArray [(Array T)] (Array T)))
+ ([T] toArray [[T]] [T]))
"#long makes it so the class-type that is generated is of the fully-qualified name."
"In this case, it avoids a clash between the java.util.List type, and Lux's own List type."