Skip to content

Instantly share code, notes, and snippets.

@kxbmap
Created July 10, 2013 06:45
Show Gist options
  • Save kxbmap/5963952 to your computer and use it in GitHub Desktop.
Save kxbmap/5963952 to your computer and use it in GitHub Desktop.
> scalac Sample.scala
while compiling: Sample.scala
during phase: patmat
library version: version 2.10.2
compiler version: version 2.10.2
reconstructed args:
last tree to typer: Ident(r)
symbol: value r (flags: <triedcooking>)
symbol definition: val r: String
tpe: String
symbol owners: value r -> method run -> object Sample -> package <empty>
context owners: method run -> object Sample -> package <empty>
== Enclosing template or block ==
DefDef( // def run(): Unit in object Sample
<method>
"run"
[]
List(Nil)
<tpt> // tree.tpe=Unit
Match( // tree.tpe=Unit
Typed( // tree.tpe=Short
0
<tpt> // tree.tpe=Short
)
CaseDef( // tree.tpe=Unit
UnApply( // tree.tpe=Short
Apply( // def unapply(i: Int): Option[String] in object Sample, tree.tpe=Option[String]
"Sample"."unapply" // def unapply(i: Int): Option[String] in object Sample, tree.tpe=(i: Int)Option[String]
"<unapply-selector>"."toInt" // def toInt: Int in class Short, tree.tpe=Int
)
List(
Bind( // val r: String, tree.tpe=String
"r"
"_" // tree.tpe=String
)
)
)
Apply( // def println(x: Any): Unit in object Predef, tree.tpe=Unit
scala.this."Predef"."println" // def println(x: Any): Unit in object Predef, tree.tpe=(x: Any)Unit
"r" // val r: String, tree.tpe=String
)
)
)
)
== Expanded type of tree ==
AliasTypeRef(
pre = SingleType(pre = ThisType(package scala), object Predef)
Alias(type String = String)
normalize = TypeRef(
TypeSymbol(
final class String extends Serializable with Comparable[String] with CharSequence
)
)
)
unhandled exception while transforming Sample.scala
error: uncaught exception during compilation: scala.MatchError
error: scala.MatchError: None (of class scala.None$)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$ExtractorCallRegular.extractorCall$lzycompute(MatchTranslation.scala:577)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$ExtractorCallRegular.extractorCall(MatchTranslation.scala:577)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$ExtractorCallRegular.tpe(MatchTranslation.scala:579)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$ExtractorCallRegular.isTyped(MatchTranslation.scala:580)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$class.translateExtractorPattern$1(MatchTranslation.scala:243)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$class.translatePattern(MatchTranslation.scala:310)
at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.translatePattern(PatternMatching.scala:87)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$class.translateCase(MatchTranslation.scala:231)
at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.translateCase(PatternMatching.scala:87)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$$anonfun$4.apply(MatchTranslation.scala:153)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$$anonfun$4.apply(MatchTranslation.scala:153)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.immutable.List.foreach(List.scala:318)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$class.translateMatch(MatchTranslation.scala:153)
at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.translateMatch(PatternMatching.scala:87)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:60)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:55)
at scala.reflect.internal.Trees$$anonfun$itransform$2.apply(Trees.scala:1235)
at scala.reflect.internal.Trees$$anonfun$itransform$2.apply(Trees.scala:1233)
at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2936)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:34)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:28)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:19)
at scala.reflect.internal.Trees$class.itransform(Trees.scala:1232)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2897)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:48)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:71)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:55)
at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2927)
at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2925)
at scala.collection.immutable.List.loop$1(List.scala:170)
at scala.collection.immutable.List.mapConserve(List.scala:186)
at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:2925)
at scala.reflect.internal.Trees$class.itransform(Trees.scala:1276)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2897)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(TypingTransformers.scala:44)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:44)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:44)
at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2936)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:34)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:71)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:55)
at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:2904)
at scala.reflect.internal.Trees$$anonfun$itransform$5.apply(Trees.scala:1285)
at scala.reflect.internal.Trees$$anonfun$itransform$5.apply(Trees.scala:1284)
at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2936)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:34)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:28)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:19)
at scala.reflect.internal.Trees$class.itransform(Trees.scala:1283)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2897)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:48)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:71)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:55)
at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2927)
at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2925)
at scala.collection.immutable.List.loop$1(List.scala:170)
at scala.collection.immutable.List.mapConserve(List.scala:186)
at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:2925)
at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1298)
at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1298)
at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2936)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:34)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:28)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:19)
at scala.reflect.internal.Trees$class.itransform(Trees.scala:1297)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:13)
at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2897)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(TypingTransformers.scala:44)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$2.apply(TypingTransformers.scala:46)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$2.apply(TypingTransformers.scala:46)
at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2936)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:34)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:71)
at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:55)
at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:227)
at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:464)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:431)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:431)
at scala.collection.Iterator$class.foreach(Iterator.scala:727)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:431)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1583)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1557)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1553)
at scala.tools.nsc.Global$Run.compile(Global.scala:1662)
at scala.tools.nsc.Driver.doCompile(Driver.scala:33)
at scala.tools.nsc.Main$.doCompile(Main.scala:79)
at scala.tools.nsc.Driver.process(Driver.scala:54)
at scala.tools.nsc.Driver.main(Driver.scala:67)
at scala.tools.nsc.Main.main(Main.scala)
object Sample {
def unapply(i: Int): Option[String] = Some(i.toString)
def run(): Unit = (0: Short) match {
case Sample(r) => println(r)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment