Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler crash on pattern-match to rest of args #3577

Closed
scabug opened this issue Jun 16, 2010 · 13 comments
Closed

compiler crash on pattern-match to rest of args #3577

scabug opened this issue Jun 16, 2010 · 13 comments

Comments

@scabug
Copy link

scabug commented Jun 16, 2010

On nsc trunk as of 6/16/2010.

case class Check[A](a: A) {
	def value = a;
}

case class C2(checks: Check[_]*);

object C {
  def m(x : C2) = x match {
	  case C2(Check(1), rest @ _*) => {
		  val b = for (y <- rest) yield y.value;
	  }
  }
}
Exception in thread "main" scala.MatchError: ?>: Nothing <: Any
        at scala.tools.nsc.typechecker.Variances$$class.varianceInType(Variances.scala:78)
        at scala.tools.nsc.Global$$analyzer$$.varianceInType(Global.scala:297)
        at scala.tools.nsc.typechecker.Variances$$$$anonfun$$varianceInArgs$$1.apply(Variances.scala:59)
        at scala.tools.nsc.typechecker.Variances$$$$anonfun$$varianceInArgs$$1.apply(Variances.scala:58)
        at scala.collection.LinearSeqOptimized$$class.foreach(LinearSeqOptimized.scala:61)
        at scala.collection.immutable.List.foreach(List.scala:45)
        at scala.tools.nsc.typechecker.Variances$$class.varianceInArgs(Variances.scala:58)
@scabug
Copy link
Author

scabug commented Jun 16, 2010

Imported From: https://issues.scala-lang.org/browse/SI-3577?orig=1
Reporter: @rossjudson
See #6258

@scabug
Copy link
Author

scabug commented Jun 16, 2010

@rossjudson said:
If 'y <- rest' is replaced by 'x.checks', there is no compiler error.

@scabug
Copy link
Author

scabug commented Sep 20, 2010

@paulp said:
I also would have leapt to the conclusion it's a pattern matcher bug, but this is dying in the typer. In Variances, def varianceInType has no case for BoundedWildcardType, which is arriving there when C2's case accessor type is inferred. Since it's assigned to me I'd fix it anyway if I knew the right thing...

    // something like this maybe?
    case BoundedWildcardType(bounds) =>
      varianceInType(bounds)(tparam)

So instead of fixing this, I'll open another related ticket I found while looking at it.

@scabug
Copy link
Author

scabug commented Oct 12, 2010

@paulp said:
Just wanted to point out because I'm so happy about it that as of r23238 the error message has changed from:

Exception in thread "main" scala.MatchError?: ?>: Nothing <: Any 

to:

Exception in thread "main" scala.MatchError: ?>: Nothing <: Any (of class scala.tools.nsc.symtab.Types$$BoundedWildcardType)

I'm already planning a lengthy vacation with all the time saved.

@scabug
Copy link
Author

scabug commented Mar 13, 2012

@Blaisorblade said:
I got a very similar error on a different piece of source code with Scala 2.9.1. I'm mentioning this because varargs are not involved here. However, making the offending code self-contained seems too time-consuming and pointless here; I'll just discuss the offending change.

I'm posting a brief sample to show what happens. In the following pattern match, the offending change was the addition of the type annotation FoundNode[t, repr] after the binder for fn.

      for (((parentNode: FlatMap[_, _, /*t, repr, */ u, that]), fn: FoundNode[t, repr], allFVSeq) <- lookupIndexableExps(e)) yield {
         //...irrelevant code
         fn.optimize(null, parentNode, allFVSeq) //triggers the crash
      }

Here lookupIndexableExps returns Seq[(FlatMap[_, _, _, _], FoundNode[_, _], Seq[Var])], hence Scalac already knew that fn was of type FoundNode[_, _]; now I just bound the type parameters to FoundNode; the type of optimize requires those parameters to match with the parameters of parentNode, and that's why that call is required to trigger the crash!
FoundNode, FlatMap and related defs are defined as (in simplified form, untested):

  trait Exp[+T] {...}
  abstract class FuncExp[-S, +T](val f: Exp[S] => Exp[T]) extends Exp[S => T] {...}
  sealed abstract class FoundNode[T, Repr <: Traversable[T] with TraversableLike[T, Repr]](val c: Exp[Repr with Traversable[T]]) {
    def optimize[TupleT, U, That <: Traversable[U]](indexBaseToLookup: Exp[Traversable[TupleWith[T]]],
                           parentNode: FlatMap[T, Repr, U, That],
                           allFVSeq: Seq[Var]): Option[Exp[Traversable[T]]]
    type TupleWith[T]
    def buildTuple[T](allFVSeq: Seq[Var])(x: Exp[T]): Exp[TupleWith[T]]
  }
case class FlatMap[T, Repr <: Traversable[T] with TraversableLike[T, Repr],
                   U, That <: Traversable[U]](base: Exp[Repr], f: FuncExp[T, Traversable[U]])(implicit protected[this] val c: CanBuildFrom[Repr, U, That]) {
}

The stack trace from sbt:

[debug]/Users/pgiarrusso/Documents/Research/Sorgenti/linqonsteroids/src/test/scala/ivm/expressiontree/TypeTests.scala
scala.MatchError: ?>: Nothing <: Any (of class scala.tools.nsc.symtab.Types$BoundedWildcardType)
	at scala.tools.nsc.typechecker.Variances$class.varianceInType(Variances.scala:67)
	at scala.tools.nsc.Global$analyzer$.varianceInType(Global.scala:351)
	at scala.tools.nsc.typechecker.Variances$$anonfun$varianceInArgs$2.apply(Variances.scala:48)
	at scala.tools.nsc.typechecker.Variances$$anonfun$varianceInArgs$2.apply(Variances.scala:47)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
	at scala.collection.immutable.List.foreach(List.scala:45)
	at scala.tools.nsc.typechecker.Variances$class.varianceInArgs(Variances.scala:47)
	at scala.tools.nsc.Global$analyzer$.varianceInArgs(Global.scala:351)
	at scala.tools.nsc.typechecker.Variances$class.varianceInType(Variances.scala:74)
	at scala.tools.nsc.Global$analyzer$.varianceInType(Global.scala:351)
	at scala.tools.nsc.typechecker.Variances$$anonfun$varianceInArgs$2.apply(Variances.scala:48)
	at scala.tools.nsc.typechecker.Variances$$anonfun$varianceInArgs$2.apply(Variances.scala:47)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
	at scala.collection.immutable.List.foreach(List.scala:45)
	at scala.tools.nsc.typechecker.Variances$class.varianceInArgs(Variances.scala:47)
	at scala.tools.nsc.Global$analyzer$.varianceInArgs(Global.scala:351)
	at scala.tools.nsc.typechecker.Variances$class.varianceInType(Variances.scala:74)
	at scala.tools.nsc.Global$analyzer$.varianceInType(Global.scala:351)
	at scala.tools.nsc.typechecker.Variances$$anonfun$varianceInArgs$2.apply(Variances.scala:48)
	at scala.tools.nsc.typechecker.Variances$$anonfun$varianceInArgs$2.apply(Variances.scala:47)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
	at scala.collection.immutable.List.foreach(List.scala:45)
	at scala.tools.nsc.typechecker.Variances$class.varianceInArgs(Variances.scala:47)
	at scala.tools.nsc.Global$analyzer$.varianceInArgs(Global.scala:351)
	at scala.tools.nsc.typechecker.Variances$class.varianceInType(Variances.scala:74)
	at scala.tools.nsc.Global$analyzer$.varianceInType(Global.scala:351)
	at scala.tools.nsc.typechecker.Variances$$anonfun$varianceInTypes$1.apply(Variances.scala:40)
	at scala.tools.nsc.typechecker.Variances$$anonfun$varianceInTypes$1.apply(Variances.scala:40)
	at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
	at scala.collection.immutable.List.foldLeft(List.scala:45)
	at scala.collection.TraversableOnce$class.$div$colon(TraversableOnce.scala:137)
	at scala.collection.immutable.List.$div$colon(List.scala:45)
	at scala.tools.nsc.typechecker.Variances$class.varianceInTypes(Variances.scala:40)
	at scala.tools.nsc.Global$analyzer$.varianceInTypes(Global.scala:351)
	at scala.tools.nsc.typechecker.Infer$Inferencer$$anonfun$protoTypeArgs$1.apply(Infer.scala:573)
	at scala.tools.nsc.typechecker.Infer$Inferencer$$anonfun$protoTypeArgs$1.apply(Infer.scala:572)
	at scala.Tuple2$Zipped$$anonfun$map$1.apply(Tuple2.scala:65)
	at scala.Tuple2$Zipped$$anonfun$map$1.apply(Tuple2.scala:63)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
	at scala.collection.immutable.List.foreach(List.scala:45)
	at scala.Tuple2$Zipped.map(Tuple2.scala:63)
	at scala.tools.nsc.typechecker.Infer$Inferencer.protoTypeArgs(Infer.scala:572)
	at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2467)
	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.typedBlock(Typers.scala:1920)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3951)
	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.typedCase(Typers.scala:1957)
	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.typedFunction(Typers.scala:2042)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3978)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
	at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:2191)
	at scala.tools.nsc.typechecker.Typers$Typer.typedArgToPoly$1(Typers.scala:2477)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$32.apply(Typers.scala:2485)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$32.apply(Typers.scala:2485)
	at scala.Tuple2$Zipped$$anonfun$map$1.apply(Tuple2.scala:65)
	at scala.Tuple2$Zipped$$anonfun$map$1.apply(Tuple2.scala:63)
	at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
	at scala.collection.immutable.List.foreach(List.scala:45)
	at scala.Tuple2$Zipped.map(Tuple2.scala:63)
	at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2485)
	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.typedQualifier(Typers.scala:4350)
	at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:4356)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4144)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
	at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:4350)
	at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:4356)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4144)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typedApply$1$1.apply(Typers.scala:3353)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typedApply$1$1.apply(Typers.scala:3353)
	at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:624)
	at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:3353)
	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.typed(Typers.scala:4344)
	at scala.tools.nsc.typechecker.Typers$Typer.typedFunction(Typers.scala:2042)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3978)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
	at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:4428)
	at scala.tools.nsc.typechecker.Typers$Typer.typedValDef(Typers.scala:1567)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3916)
	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.typedClassDef(Typers.scala:1278)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3910)
	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.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.Global$Run.compile(Global.scala:1038)
	at xsbt.CompilerInterface.run(CompilerInterface.scala:87)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:57)
	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:29)
	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:25)
	at sbt.AggressiveCompile$$anonfun$5.compileScala$1(AggressiveCompile.scala:67)
	at sbt.AggressiveCompile$$anonfun$5.apply(AggressiveCompile.scala:79)
	at sbt.AggressiveCompile$$anonfun$5.apply(AggressiveCompile.scala:57)
	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:21)
	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:19)
	at sbt.inc.Incremental$.cycle(Incremental.scala:33)
	at sbt.inc.Incremental$.compile(Incremental.scala:20)
	at sbt.inc.IncrementalCompile$.apply(Compile.scala:17)
	at sbt.AggressiveCompile.compile2(AggressiveCompile.scala:87)
	at sbt.AggressiveCompile.compile1(AggressiveCompile.scala:41)
	at sbt.AggressiveCompile.apply(AggressiveCompile.scala:28)
	at sbt.Compiler$.apply(Compiler.scala:107)
	at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:479)
	at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:479)
	at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:473)
	at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:473)
	at scala.Function1$$anonfun$compose$1.apply(Function1.scala:41)
	at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$11.apply(Structure.scala:295)
	at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$11.apply(Structure.scala:295)
	at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
	at sbt.std.Transform$$anon$5.work(System.scala:67)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:221)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:221)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
	at sbt.Execute.work(Execute.scala:227)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:221)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:221)
	at sbt.CompletionService$$anon$1$$anon$2.call(CompletionService.scala:26)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:680)

@scabug
Copy link
Author

scabug commented Mar 13, 2012

@Blaisorblade said (edited on Mar 13, 2012 4:33:57 AM UTC):
After verifying that the original sample does not trigger any more any error, I changed my mind and reduced the source code I have posted. The bug explanation is almost the same, but apparently parentNode is not required in the call to optimize to trigger the bug; it is only needed in the pattern match.

import scala.collection.TraversableLike
object Container {
    trait Exp[+T]
    abstract class FuncExp[-S, +T](val f: Exp[S] => Exp[T])

    sealed abstract class FoundNode[T, Repr <: Traversable[T] with TraversableLike[T, Repr]](val c: Exp[Repr with Traversable[T]]) {
        def optimize[TupleT, U, That <: Traversable[U]](parentNode: FlatMap[T, Repr, U, That]): Option[Exp[Traversable[T]]]
    }

    case class FlatMap[T, Repr <: Traversable[T] with TraversableLike[T, Repr], U, That <: Traversable[U]](base: Exp[Repr], f: FuncExp[T, Traversable[U]])

    def lookupIndexableExps: Seq[(FlatMap[_, _, _, _], FoundNode[_, _])] = Seq.empty

    for ((parentNode, fn: FoundNode[t, repr]) <- lookupIndexableExps) yield {
        //fn.optimize(parentNode) //triggers the crash
        fn.optimize(null) //triggers the crash as well, surprisingly for me!
    }
    //The code below does not trigger a crash, just a strange compile error!
    /*
    def lookupIndexableExps: Seq[FoundNode[_, _]] = Seq.empty
    //for ((fn: FoundNode[t, repr]) <- lookupIndexableExps) yield {
    for ((fn: FoundNode[_, _]) <- lookupIndexableExps) yield {
        fn.optimize(null)
    }
    */
}

Stacktrace (much shorter this time):

Exception in thread "main" scala.MatchError: ?>: Nothing <: Any (of class scala.tools.nsc.symtab.Types$BoundedWildcardType)
        at scala.tools.nsc.typechecker.Variances$class.varianceInType(Variances.scala:67)
        at scala.tools.nsc.Global$analyzer$.varianceInType(Global.scala:351)
        at scala.tools.nsc.typechecker.Variances$$anonfun$varianceInArgs$2.apply(Variances.scala:48)
        at scala.tools.nsc.typechecker.Variances$$anonfun$varianceInArgs$2.apply(Variances.scala:47)
        at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
        at scala.collection.immutable.List.foreach(List.scala:45)
        at scala.tools.nsc.typechecker.Variances$class.varianceInArgs(Variances.scala:47)
        at scala.tools.nsc.Global$analyzer$.varianceInArgs(Global.scala:351)
        at scala.tools.nsc.typechecker.Variances$class.varianceInType(Variances.scala:74)
        at scala.tools.nsc.Global$analyzer$.varianceInType(Global.scala:351)
        at scala.tools.nsc.typechecker.Variances$$anonfun$varianceInTypes$1.apply(Variances.scala:40)
        at scala.tools.nsc.typechecker.Variances$$anonfun$varianceInTypes$1.apply(Variances.scala:40)
        at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
        at scala.collection.immutable.List.foldLeft(List.scala:45)
        at scala.collection.TraversableOnce$class.$div$colon(TraversableOnce.scala:137)
        at scala.collection.immutable.List.$div$colon(List.scala:45)
        at scala.tools.nsc.typechecker.Variances$class.varianceInTypes(Variances.scala:40)
        at scala.tools.nsc.Global$analyzer$.varianceInTypes(Global.scala:351)
        at scala.tools.nsc.typechecker.Infer$Inferencer$$anonfun$protoTypeArgs$1.apply(Infer.scala:573)
        at scala.tools.nsc.typechecker.Infer$Inferencer$$anonfun$protoTypeArgs$1.apply(Infer.scala:572)
        at scala.Tuple2$Zipped$$anonfun$map$1.apply(Tuple2.scala:65)
        at scala.Tuple2$Zipped$$anonfun$map$1.apply(Tuple2.scala:63)
        at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
        at scala.collection.immutable.List.foreach(List.scala:45)
        at scala.Tuple2$Zipped.map(Tuple2.scala:63)
        at scala.tools.nsc.typechecker.Infer$Inferencer.protoTypeArgs(Infer.scala:572)
        at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2467)
        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.typed(Typers.scala:4344)
        at scala.tools.nsc.typechecker.Typers$Typer.typedCase(Typers.scala:1957)
        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.typedFunction(Typers.scala:2042)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3978)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4271)
        at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:2191)
        at scala.tools.nsc.typechecker.Typers$Typer.typedArgToPoly$1(Typers.scala:2477)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$32.apply(Typers.scala:2485)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$32.apply(Typers.scala:2485)
        at scala.Tuple2$Zipped$$anonfun$map$1.apply(Tuple2.scala:65)
        at scala.Tuple2$Zipped$$anonfun$map$1.apply(Tuple2.scala:63)
        at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
        at scala.collection.immutable.List.foreach(List.scala:45)
        at scala.Tuple2$Zipped.map(Tuple2.scala:63)
        at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2485)
        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.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.Global$Run.compile(Global.scala:1038)
        at scala.tools.nsc.Main$.process(Main.scala:106)
        at scala.tools.nsc.Main$.main(Main.scala:123)
        at scala.tools.nsc.Main.main(Main.scala)

@scabug
Copy link
Author

scabug commented Mar 20, 2012

@Blaisorblade said (edited on Mar 20, 2012 11:50:06 PM UTC):
Note that this bug might derive from a comment which lists types but forgets BoundedWildcardType, at the beginning of src/compiler/scala/reflect/internal/Types.scala, beginning with /* A standard type pattern match:.
EDIT: Link to github sources:
https://github.com/scala/scala/blob/d8ba5d091e5641553b438ef9930a6023a2709dcd/src/compiler/scala/reflect/internal/Types.scala#L17

@scabug
Copy link
Author

scabug commented Aug 20, 2012

@retronym said:
Popped up again in #6258.

@scabug
Copy link
Author

scabug commented Aug 23, 2012

@retronym said:
The original report works with 2.9.0+. But the gap in varianceInType should still be plugged, as Paulo's example shows.

@scabug
Copy link
Author

scabug commented Aug 23, 2012

@retronym said:
scala/scala#1187

@scabug
Copy link
Author

scabug commented Sep 7, 2012

@retronym said:
Fixed in master, ie "Unreleased 2.11.x"

@scabug
Copy link
Author

scabug commented Jan 23, 2013

@adriaanm said:
reopening for potential backport to 2.10.1-RC1

@scabug
Copy link
Author

scabug commented Jan 26, 2013

@retronym said:
backport scala/scala#1981

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants