- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
repl debugger is now $plus$plus
Tue, 2009-07-14, 19:17
I wrangled manifests into telling me something about the parameter
types, and as of r18291 you can do sweet stuff like this:
// here is a line I put in parallelmatching at a strategic spot
// (line 570 of the current ParallelMatching.scala.)
// you put your line wherever you like!
Interpreter.breakIf(true, "lits" -> literals, "mixlit" -> this, literalMap)
// here is an interpreter session after compiling that in
// notice you can supply parameter name, or just let it make one up
scala> (5: Int) match { case 3|4 => true ; case 5 => false }
lits: scala.collection.immutable.List[scala.tools.nsc.ast.Trees$Tree]
mixlit: scala.tools.nsc.matching.ParallelMatching$MatchMatrix$MixLiteralInts
p1: scala.collection.immutable.IntMap[scala.collection.immutable.List[int]]
scala> lits.head
res0: scala.tools.nsc.ast.Trees$Tree = 3
scala> res0.tpe
res1: scala.tools.nsc.symtab.SymbolTable#Type = Int(3)
scala> lits foreach (_ setType res1)
scala> lits(2).tpe
res3: scala.tools.nsc.symtab.SymbolTable#Type = Int(3)
// resume execution! don't be surprised if you broke something
// if you do something less innocuous than the giggle inducer of
// setting the types of 4 and 5 to Int(3).
scala> :quit
// and there's the result of the original match on 5.
res0: Boolean = false