Skip to content

Instantly share code, notes, and snippets.

@SethTisue
Created June 3, 2011 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SethTisue/1006806 to your computer and use it in GitHub Desktop.
Save SethTisue/1006806 to your computer and use it in GitHub Desktop.
Last login: Fri Jun 3 10:39:54 on ttys004
~ % cd scala
META-INF/ build.examples.xml dists/ project/
README build.number docs/ src/
build/ build.xml gitignore.SAMPLE test/
build.detach.xml classpath.SAMPLE lib/ tools/
~/scala % dists/latest/bin/scala (master↑16⚡)
Welcome to Scala version 2.10.0.r25048-b20110531064458 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :wrap
wrap: no such command. Type :help for help.
scala> :help
All commands can be abbreviated, e.g. :he instead of :help.
Those marked with a * have more detailed help, e.g. :help imports.
:cp <path> add a jar or directory to the classpath
:help [command] print this summary or command-specific help
:history [num] show the history (optional num is commands to show)
:h? <string> search the history
:imports [name name ...] show import history, identifying sources of names
:implicits [-v] show the implicits in scope
:javap <path|class> disassemble a file or class name
:keybindings show how ctrl-[A-Z] and other keys are bound
:load <path> load and interpret a Scala file
:paste enter paste mode: all input up to ctrl-D compiled together
:power enable power user mode
:quit exit the interpreter
:replay reset execution and replay all previous commands
:sh <command line> run a shell command (result is implicitly => List[String])
:silent disable/enable automatic printing of results
:type <expr> display the type of an expression without evaluating it
scala> :power
** Power User mode enabled - BEEP BOOP WHIR **
** scala.tools.nsc._ has been imported **
** global._ and definitions._ also imported **
** New vals! Try repl, intp, global, power **
** New cmds! :help to discover them **
** New defs! Type power.<tab> to reveal **
scala>
scala> :phase typer.next
Active phase is now: Superaccessors (typer.next)
scala> Nil.bts
res0: List[power.global.Type] = List(scala.collection.immutable.Nil$, List[A], scala.collection.immutable.LinearSeq[A], scala.collection.immutable.Seq[A], scala.collection.LinearSeq[A], Seq[A], scala.collection.immutable.Iterable[A], Iterable[A], scala.collection.LinearSeqOptimized[A,List[A]], scala.collection.LinearSeqLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.LinearSeqLike[A,scala.collection.LinearSeq[A]] with scala.collection.LinearSeqLike[A,List[A]], scala.collection.SeqLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.SeqLike[A,scala.collection.LinearSeq[A]] with scala.collection.SeqLike[A,Seq[A]] with scala.collection.SeqLike[A,scala.collection.immutable.Seq[A]] with scala.collection.SeqLike[A,List[A]], scala.collection.immutable.Trav...
scala> Nil.bts.foreach(println)
scala.collection.immutable.Nil$
List[A]
scala.collection.immutable.LinearSeq[A]
scala.collection.immutable.Seq[A]
scala.collection.LinearSeq[A]
Seq[A]
scala.collection.immutable.Iterable[A]
Iterable[A]
scala.collection.LinearSeqOptimized[A,List[A]]
scala.collection.LinearSeqLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.LinearSeqLike[A,scala.collection.LinearSeq[A]] with scala.collection.LinearSeqLike[A,List[A]]
scala.collection.SeqLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.SeqLike[A,scala.collection.LinearSeq[A]] with scala.collection.SeqLike[A,Seq[A]] with scala.collection.SeqLike[A,scala.collection.immutable.Seq[A]] with scala.collection.SeqLike[A,List[A]]
scala.collection.immutable.Traversable[A]
scala.collection.GenSeq[A]
Traversable[A]
scala.collection.IterableLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.IterableLike[A,scala.collection.LinearSeq[A]] with scala.collection.IterableLike[A,scala.collection.immutable.Iterable[A]] with scala.collection.IterableLike[A,Iterable[A]] with scala.collection.IterableLike[A,Seq[A]] with scala.collection.IterableLike[A,scala.collection.immutable.Seq[A]] with scala.collection.IterableLike[A,List[A]]
scala.collection.GenIterable[A]
scala.collection.TraversableLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.TraversableLike[A,scala.collection.LinearSeq[A]] with scala.collection.TraversableLike[A,scala.collection.immutable.Iterable[A]] with scala.collection.TraversableLike[A,Iterable[A]] with scala.collection.TraversableLike[A,Traversable[A]] with scala.collection.TraversableLike[A,scala.collection.immutable.Traversable[A]] with scala.collection.TraversableLike[A,Seq[A]] with scala.collection.TraversableLike[A,scala.collection.immutable.Seq[A]] with scala.collection.TraversableLike[A,List[A]]
scala.collection.GenTraversable[A]
scala.collection.GenSeqLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.GenSeqLike[A,scala.collection.LinearSeq[A]] with scala.collection.GenSeqLike[A,Seq[A]] with scala.collection.GenSeqLike[A,scala.collection.GenSeq[A]] with scala.collection.GenSeqLike[A,scala.collection.immutable.Seq[A]] with scala.collection.GenSeqLike[A,List[A]]
scala.collection.GenIterableLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.GenIterableLike[A,scala.collection.LinearSeq[A]] with scala.collection.GenIterableLike[A,scala.collection.immutable.Iterable[A]] with scala.collection.GenIterableLike[A,scala.collection.GenIterable[A]] with scala.collection.GenIterableLike[A,Iterable[A]] with scala.collection.GenIterableLike[A,Seq[A]] with scala.collection.GenIterableLike[A,scala.collection.GenSeq[A]] with scala.collection.GenIterableLike[A,scala.collection.immutable.Seq[A]] with scala.collection.GenIterableLike[A,List[A]]
scala.collection.GenTraversableLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.GenTraversableLike[A,scala.collection.LinearSeq[A]] with scala.collection.GenTraversableLike[A,scala.collection.immutable.Iterable[A]] with scala.collection.GenTraversableLike[A,scala.collection.GenIterable[A]] with scala.collection.GenTraversableLike[A,Iterable[A]] with scala.collection.GenTraversableLike[A,scala.collection.GenTraversable[A]] with scala.collection.GenTraversableLike[A,Traversable[A]] with scala.collection.GenTraversableLike[A,scala.collection.immutable.Traversable[A]] with scala.collection.GenTraversableLike[A,Seq[A]] with scala.collection.GenTraversableLike[A,scala.collection.GenSeq[A]] with scala.collection.GenTraversableLike[A,scala.collection.immutable.Seq[A]] with scala.collection.GenTraversableLike[A,List[A]]
PartialFunction[Int,A]
Product
scala.collection.TraversableOnce[A]
scala.collection.generic.GenericTraversableTemplate[A,scala.collection.immutable.LinearSeq] with scala.collection.generic.GenericTraversableTemplate[A,scala.collection.LinearSeq] with scala.collection.generic.GenericTraversableTemplate[A,scala.collection.immutable.Iterable] with scala.collection.generic.GenericTraversableTemplate[A,scala.collection.GenIterable] with scala.collection.generic.GenericTraversableTemplate[A,Iterable] with scala.collection.generic.GenericTraversableTemplate[A,Traversable] with scala.collection.generic.GenericTraversableTemplate[A,scala.collection.GenTraversable] with scala.collection.generic.GenericTraversableTemplate[A,scala.collection.immutable.Traversable] with scala.collection.generic.GenericTraversableTemplate[A,Seq] with scala.collection.generic.GenericTraversableTemplate[A,scala.collection.GenSeq] with scala.collection.generic.GenericTraversableTemplate[A,scala.collection.immutable.Seq] with scala.collection.generic.GenericTraversableTemplate[A,List]
Serializable
(Int) => A
scala.collection.GenTraversableOnce[A]
scala.collection.Parallelizable[A,scala.collection.parallel.immutable.ParIterable[A]] with scala.collection.Parallelizable[A,scala.collection.parallel.ParIterable[A]] with scala.collection.Parallelizable[A,scala.collection.parallel.ParSeq[A]] with scala.collection.Parallelizable[A,scala.collection.parallel.immutable.ParSeq[A]]
ScalaObject
Immutable
Equals
java.io.Serializable
scala.collection.generic.FilterMonadic[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.generic.FilterMonadic[A,scala.collection.LinearSeq[A]] with scala.collection.generic.FilterMonadic[A,scala.collection.immutable.Iterable[A]] with scala.collection.generic.FilterMonadic[A,Iterable[A]] with scala.collection.generic.FilterMonadic[A,Traversable[A]] with scala.collection.generic.FilterMonadic[A,scala.collection.immutable.Traversable[A]] with scala.collection.generic.FilterMonadic[A,Seq[A]] with scala.collection.generic.FilterMonadic[A,scala.collection.immutable.Seq[A]] with scala.collection.generic.FilterMonadic[A,List[A]]
scala.collection.generic.HasNewBuilder[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.generic.HasNewBuilder[A,scala.collection.LinearSeq[A]] with scala.collection.generic.HasNewBuilder[A,scala.collection.immutable.Iterable[A]] with scala.collection.generic.HasNewBuilder[A,scala.collection.GenIterable[A]] with scala.collection.generic.HasNewBuilder[A,Iterable[A]] with scala.collection.generic.HasNewBuilder[A,scala.collection.GenTraversable[A]] with scala.collection.generic.HasNewBuilder[A,Traversable[A]] with scala.collection.generic.HasNewBuilder[A,scala.collection.immutable.Traversable[A]] with scala.collection.generic.HasNewBuilder[A,Seq[A]] with scala.collection.generic.HasNewBuilder[A,scala.collection.GenSeq[A]] with scala.collection.generic.HasNewBuilder[A,scala.collection.immutable.Seq[A]] with scala.collection.generic.HasNewBuilder[A,List[A]]
java.lang.Object
Any
scala> :phase typer
Active phase is now: Typer
scala> Nil.bts.foreach(println)
scala.collection.immutable.Nil$
List[A]
scala.collection.immutable.LinearSeq[A]
scala.collection.immutable.Seq[A]
scala.collection.LinearSeq[A]
Seq[A]
scala.collection.immutable.Iterable[A]
Iterable[A]
scala.collection.LinearSeqOptimized[A,List[A]]
scala.collection.LinearSeqLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.LinearSeqLike[A,scala.collection.LinearSeq[A]] with scala.collection.LinearSeqLike[A,List[A]]
scala.collection.SeqLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.SeqLike[A,scala.collection.LinearSeq[A]] with scala.collection.SeqLike[A,Seq[A]] with scala.collection.SeqLike[A,scala.collection.immutable.Seq[A]] with scala.collection.SeqLike[A,List[A]]
scala.collection.immutable.Traversable[A]
scala.collection.GenSeq[A]
Traversable[A]
scala.collection.IterableLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.IterableLike[A,scala.collection.LinearSeq[A]] with scala.collection.IterableLike[A,scala.collection.immutable.Iterable[A]] with scala.collection.IterableLike[A,Iterable[A]] with scala.collection.IterableLike[A,Seq[A]] with scala.collection.IterableLike[A,scala.collection.immutable.Seq[A]] with scala.collection.IterableLike[A,List[A]]
scala.collection.GenIterable[A]
scala.collection.TraversableLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.TraversableLike[A,scala.collection.LinearSeq[A]] with scala.collection.TraversableLike[A,scala.collection.immutable.Iterable[A]] with scala.collection.TraversableLike[A,Iterable[A]] with scala.collection.TraversableLike[A,Traversable[A]] with scala.collection.TraversableLike[A,scala.collection.immutable.Traversable[A]] with scala.collection.TraversableLike[A,Seq[A]] with scala.collection.TraversableLike[A,scala.collection.immutable.Seq[A]] with scala.collection.TraversableLike[A,List[A]]
scala.collection.GenTraversable[A]
scala.collection.GenSeqLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.GenSeqLike[A,scala.collection.LinearSeq[A]] with scala.collection.GenSeqLike[A,Seq[A]] with scala.collection.GenSeqLike[A,scala.collection.GenSeq[A]] with scala.collection.GenSeqLike[A,scala.collection.immutable.Seq[A]] with scala.collection.GenSeqLike[A,List[A]]
scala.collection.GenIterableLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.GenIterableLike[A,scala.collection.LinearSeq[A]] with scala.collection.GenIterableLike[A,scala.collection.immutable.Iterable[A]] with scala.collection.GenIterableLike[A,scala.collection.GenIterable[A]] with scala.collection.GenIterableLike[A,Iterable[A]] with scala.collection.GenIterableLike[A,Seq[A]] with scala.collection.GenIterableLike[A,scala.collection.GenSeq[A]] with scala.collection.GenIterableLike[A,scala.collection.immutable.Seq[A]] with scala.collection.GenIterableLike[A,List[A]]
scala.collection.GenTraversableLike[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.GenTraversableLike[A,scala.collection.LinearSeq[A]] with scala.collection.GenTraversableLike[A,scala.collection.immutable.Iterable[A]] with scala.collection.GenTraversableLike[A,scala.collection.GenIterable[A]] with scala.collection.GenTraversableLike[A,Iterable[A]] with scala.collection.GenTraversableLike[A,scala.collection.GenTraversable[A]] with scala.collection.GenTraversableLike[A,Traversable[A]] with scala.collection.GenTraversableLike[A,scala.collection.immutable.Traversable[A]] with scala.collection.GenTraversableLike[A,Seq[A]] with scala.collection.GenTraversableLike[A,scala.collection.GenSeq[A]] with scala.collection.GenTraversableLike[A,scala.collection.immutable.Seq[A]] with scala.collection.GenTraversableLike[A,List[A]]
PartialFunction[Int,A]
Product
scala.collection.TraversableOnce[A]
scala.collection.generic.GenericTraversableTemplate[A,scala.collection.immutable.LinearSeq] with scala.collection.generic.GenericTraversableTemplate[A,scala.collection.LinearSeq] with scala.collection.generic.GenericTraversableTemplate[A,scala.collection.immutable.Iterable] with scala.collection.generic.GenericTraversableTemplate[A,scala.collection.GenIterable] with scala.collection.generic.GenericTraversableTemplate[A,Iterable] with scala.collection.generic.GenericTraversableTemplate[A,Traversable] with scala.collection.generic.GenericTraversableTemplate[A,scala.collection.GenTraversable] with scala.collection.generic.GenericTraversableTemplate[A,scala.collection.immutable.Traversable] with scala.collection.generic.GenericTraversableTemplate[A,Seq] with scala.collection.generic.GenericTraversableTemplate[A,scala.collection.GenSeq] with scala.collection.generic.GenericTraversableTemplate[A,scala.collection.immutable.Seq] with scala.collection.generic.GenericTraversableTemplate[A,List]
Serializable
(Int) => A
scala.collection.GenTraversableOnce[A]
scala.collection.Parallelizable[A,scala.collection.parallel.immutable.ParIterable[A]] with scala.collection.Parallelizable[A,scala.collection.parallel.ParIterable[A]] with scala.collection.Parallelizable[A,scala.collection.parallel.ParSeq[A]] with scala.collection.Parallelizable[A,scala.collection.parallel.immutable.ParSeq[A]]
ScalaObject
Immutable
Equals
java.io.Serializable
scala.collection.generic.FilterMonadic[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.generic.FilterMonadic[A,scala.collection.LinearSeq[A]] with scala.collection.generic.FilterMonadic[A,scala.collection.immutable.Iterable[A]] with scala.collection.generic.FilterMonadic[A,Iterable[A]] with scala.collection.generic.FilterMonadic[A,Traversable[A]] with scala.collection.generic.FilterMonadic[A,scala.collection.immutable.Traversable[A]] with scala.collection.generic.FilterMonadic[A,Seq[A]] with scala.collection.generic.FilterMonadic[A,scala.collection.immutable.Seq[A]] with scala.collection.generic.FilterMonadic[A,List[A]]
scala.collection.generic.HasNewBuilder[A,scala.collection.immutable.LinearSeq[A]] with scala.collection.generic.HasNewBuilder[A,scala.collection.LinearSeq[A]] with scala.collection.generic.HasNewBuilder[A,scala.collection.immutable.Iterable[A]] with scala.collection.generic.HasNewBuilder[A,scala.collection.GenIterable[A]] with scala.collection.generic.HasNewBuilder[A,Iterable[A]] with scala.collection.generic.HasNewBuilder[A,scala.collection.GenTraversable[A]] with scala.collection.generic.HasNewBuilder[A,Traversable[A]] with scala.collection.generic.HasNewBuilder[A,scala.collection.immutable.Traversable[A]] with scala.collection.generic.HasNewBuilder[A,Seq[A]] with scala.collection.generic.HasNewBuilder[A,scala.collection.GenSeq[A]] with scala.collection.generic.HasNewBuilder[A,scala.collection.immutable.Seq[A]] with scala.collection.generic.HasNewBuilder[A,List[A]]
java.lang.Object
Any
scala> List(1).members.map(_.defString).filter(_.matches("def m.*"))
res3: List[String] = List(def mapConserve[B >: A <: AnyRef](f: (A) => B): List[B], def map[B,That](f: (A) => B)(implicit bf: scala.collection.generic.CanBuildFrom[Repr,B,That]): That, def mkString: String, def mkString(sep: String): String, def mkString(start: String,sep: String,end: String): String, def minBy[B](f: (A) => B)(implicit cmp: Ordering[B]): A, def maxBy[B](f: (A) => B)(implicit cmp: Ordering[B]): A, def max[B >: A](implicit cmp: Ordering[B]): A, def min[B >: A](implicit cmp: Ordering[B]): A)
scala> List(1).members.map(_.defString).filter(_.matches("def m.*")).foreach(println)
def mapConserve[B >: A <: AnyRef](f: (A) => B): List[B]
def map[B,That](f: (A) => B)(implicit bf: scala.collection.generic.CanBuildFrom[Repr,B,That]): That
def mkString: String
def mkString(sep: String): String
def mkString(start: String,sep: String,end: String): String
def minBy[B](f: (A) => B)(implicit cmp: Ordering[B]): A
def maxBy[B](f: (A) => B)(implicit cmp: Ordering[B]): A
def max[B >: A](implicit cmp: Ordering[B]): A
def min[B >: A](implicit cmp: Ordering[B]): A
scala> def clazz[T: Manifest] = definitions.getClass(manifest[T].erasure.getName)
clazz: [T](implicit evidence$1: Manifest[T])global.Symbol
scala> clazz[java.util.ArrayList]
<console>:23: error: class ArrayList takes type parameters
clazz[java.util.ArrayList]
^
<console>:23: error: No Manifest available for <error>.
clazz[java.util.ArrayList]
^
java.lang.AssertionError: assertion failed: Internal error - eval object method $result is overloaded: [Ljava.lang.reflect.Method;@42f9ff91
at scala.Predef$.assert(Predef.scala:103)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.evalMethod(IMain.scala:648)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:617)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.callOpt(IMain.scala:620)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.evalValue(IMain.scala:627)
at scala.tools.nsc.interpreter.IMain$Request.getEval(IMain.scala:757)
at scala.tools.nsc.interpreter.IMain$$anonfun$valueOfTerm$1.apply(IMain.scala:895)
at scala.tools.nsc.interpreter.IMain$$anonfun$valueOfTerm$1.apply(IMain.scala:895)
at scala.Option.flatMap(Option.scala:147)
at scala.tools.nsc.interpreter.IMain.valueOfTerm(IMain.scala:895)
at scala.tools.nsc.interpreter.IMain.classOfTerm(IMain.scala:898)
at scala.tools.nsc.interpreter.IMain.runtimeClassAndTypeOfTerm(IMain.scala:909)
at scala.tools.nsc.interpreter.JLineCompletion$ids$$anonfun$follow$3.apply(JLineCompletion.scala:165)
at scala.tools.nsc.interpreter.JLineCompletion$ids$$anonfun$follow$3.apply(JLineCompletion.scala:160)
at scala.Option.map(Option.scala:134)
at scala.tools.nsc.interpreter.JLineCompletion$ids$.follow(JLineCompletion.scala:160)
at scala.tools.nsc.interpreter.CompletionAware$class.executionFor(CompletionAware.scala:88)
at scala.tools.nsc.interpreter.JLineCompletion$ids$.executionFor(JLineCompletion.scala:155)
at scala.tools.nsc.interpreter.JLineCompletion.execute(JLineCompletion.scala:288)
at scala.tools.nsc.interpreter.ILoop.runCompletion$1(ILoop.scala:740)
at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:752)
at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:652)
at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:545)
at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:553)
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:820)
at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:67)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:80)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:89)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
The repl compiler has crashed spectacularly. Shall I replay your
session? I can re-run all lines except the last one.
[y/n]
Abandoning crashed session.
scala>
scala> :q
~/scala % dists/latest/bin/scala (master↑16⚡)
Welcome to Scala version 2.10.0.r25048-b20110531064458 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.
scala> def clazz[T: Manifest] = definitions.getClass(manifest[T].erasure.getName)
<console>:7: error: not found: value definitions
def clazz[T: Manifest] = definitions.getClass(manifest[T].erasure.getName)
^
scala> :power
** Power User mode enabled - BEEP BOOP WHIR **
** scala.tools.nsc._ has been imported **
** global._ and definitions._ also imported **
** New vals! Try repl, intp, global, power **
** New cmds! :help to discover them **
** New defs! Type power.<tab> to reveal **
scala>
scala> def clazz[T: Manifest] = definitions.getClass(manifest[T].erasure.getName)
clazz: [T](implicit evidence$1: Manifest[T])global.Symbol
scala> clazz[java.util.ArrayList[_]]
res0: global.Symbol = class ArrayList
scala> :phase typer.next
Active phase is now: Superaccessors (typer.next)
scala> val s1 = clazz[java.util.ArrayList[String]]
s1: global.Symbol = class ArrayList
scala> val s2 = clazz[java.util.HashSet[Int]]
s2: global.Symbol = class HashSet
scala> global.lub(List(s1.tpe, s2.tpe))
res1: global.Type = java.util.AbstractCollection[_ >: E with E] with java.lang.Cloneable with java.io.Serializable
scala> val t1 = global.typeRef(NoPrefix, s1, List(definitions.StringClass.tpe)
| )
t1: global.Type = ArrayList[java.lang.String]
scala> val t2 = global.typeRef(NoPrefix, s1, List(definitions.IntClass.tpe))
t2: global.Type = ArrayList[Int]
scala> val t2 = global.typeRef(NoPrefix, s2, List(definitions.IntClass.tpe))
t2: global.Type = HashSet[Int]
scala> global.lub(List(t1, t2))
res2: global.Type = java.util.AbstractCollection[_ >: java.lang.String with Int] with java.lang.Cloneable with java.io.Serializable
scala> List(new java.util.ArrayList[String], new java.util.HashSet[Int])
res3: List[java.util.AbstractCollection[_ >: Int with java.lang.String] with java.lang.Cloneable with java.io.Serializable] = List([], [])
scala> scala.collection.immutable.Stream[_]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment