Scala Programming Language
  1. Scala Programming Language
  2. SI-3577

compiler crash on pattern-match to rest of args

    Details

      Description

      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)
      

        Issue Links

          Activity

          Hide
          Jason Zaugg added a comment -

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

          Show
          Jason Zaugg added a comment - The original report works with 2.9.0+. But the gap in varianceInType should still be plugged, as Paulo's example shows.
          Show
          Jason Zaugg added a comment - https://github.com/scala/scala/pull/1187
          Hide
          Jason Zaugg added a comment -

          Fixed in master, ie "Unreleased 2.11.x"

          Show
          Jason Zaugg added a comment - Fixed in master, ie "Unreleased 2.11.x"
          Hide
          Adriaan Moors added a comment -

          reopening for potential backport to 2.10.1-RC1

          Show
          Adriaan Moors added a comment - reopening for potential backport to 2.10.1-RC1
          Hide
          Jason Zaugg added a comment -
          Show
          Jason Zaugg added a comment - backport https://github.com/scala/scala/pull/1981

            People

            • Assignee:
              Jason Zaugg
              Reporter:
              Ross Judson
              TracCC:
              Paul Phillips
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development