You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Define an extractor object that has a no-args unapply method, then try to match against it. Whatever expression you write on the left-hand side of the match (even if this expression refers to not declared symbols!), the compiler will crash.as follows:
scala> object Foo { def unapply(): Option[Int] = Some(42) }
defined module Foo
scala> val Foo(x) = WHATEVER
<console>:11: error: not found: value WHATEVER
val Foo(x) = WHATEVER
^
scala.MatchError: ()Option[Int] (of class scala.tools.nsc.symtab.Types$MethodType)
at scala.tools.nsc.typechecker.Typers$Typer.freshArgType$1(Typers.scala:2510)
at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2528)
at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2500)
at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:3371)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4104)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typedPattern$1.apply(Typers.scala:4369)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typedPattern$1.apply(Typers.scala:4369)
at scala.tools.nsc.typechecker.Contexts$Context.withImplicitsDisabled(Contexts.scala:156)
at scala.tools.nsc.typechecker.Typers$Typer.typedPattern(Typers.scala:4369)
at scala.tools.nsc.typechecker.Typers$Typer.typedCase(Typers.scala:1941)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typedCases$1.apply(Typers.scala:1975)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typedCases$1.apply(Typers.scala:1974)
at scala.collection.immutable.List.loop$1(List.scala:117)
at scala.collection.immutable.List.mapConserve(List.scala:133)
at scala.tools.nsc.typechecker.Typers$Typer.typedCases(Typers.scala:1974)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4003)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4344)
at scala.tools.nsc.typechecker.Typers$Typer.computeType(Typers.scala:4421)
at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1207)
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$typeCompleter$1.apply(Namers.scala:551)
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$typeCompleter$1.apply(Namers.scala:549)
at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1385)
at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1381)
at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:727)
at scala.tools.nsc.symtab.Symbols$Symbol.initialize(Symbols.scala:839)
at scala.tools.nsc.symtab.Symbols$Symbol.annotations(Symbols.scala:73)
at scala.tools.nsc.typechecker.Typers$Typer.addGetterSetter(Typers.scala:1342)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$13.apply(Typers.scala:1510)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$13.apply(Typers.scala:1510)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:200)
at scala.collection.immutable.List.flatMap(List.scala:45)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1510)
at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1320)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3913)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2100)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
at scala.collection.immutable.List.loop$1(List.scala:117)
at scala.collection.immutable.List.mapConserve(List.scala:133)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2184)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1512)
at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1320)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3913)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2100)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
at scala.collection.immutable.List.loop$1(List.scala:117)
at scala.collection.immutable.List.mapConserve(List.scala:133)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2184)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1512)
at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1320)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3913)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2100)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
at scala.collection.immutable.List.loop$1(List.scala:117)
at scala.collection.immutable.List.mapConserve(List.scala:133)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2184)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1512)
at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1320)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3913)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2100)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
at scala.collection.immutable.List.loop$1(List.scala:117)
at scala.collection.immutable.List.mapConserve(List.scala:133)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2184)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3906)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4331)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:94)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:329)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:86)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:86)
at scala.collection.Iterator$class.foreach(Iterator.scala:660)
at scala.collection.mutable.ListBuffer$$anon$1.foreach(ListBuffer.scala:316)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:86)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:953)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compileAndSaveRun(IMain.scala:756)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:731)
at scala.tools.nsc.interpreter.IMain$Request.compile(IMain.scala:873)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:576)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:543)
at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:694)
at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:745)
at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:651)
at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:542)
at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:550)
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)
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 text was updated successfully, but these errors were encountered:
Define an extractor object that has a no-args unapply method, then try to match against it. Whatever expression you write on the left-hand side of the match (even if this expression refers to not declared symbols!), the compiler will crash.as follows:
The text was updated successfully, but these errors were encountered: