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

val f : Q[Int] = { case a : Int => a } slains the compiler

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.10.0-M6
    • Fix Version/s: Scala 2.10.0-M7, Scala 2.10.0
    • Component/s: Type Checker
    • Labels:
    • Environment:

      Description

      import language.existentials
      
      object test {
          type Q[R] = PartialFunction[B, R] forSome { type B }
          val f : Q[Int] = { case a : Int => a }
      }
      
           while compiling: test.scala
              during phase: refchecks
           library version: version 2.10.0-M6
          compiler version: version 2.10.0-M6
        reconstructed args: -feature
      
        last tree to typer: Ident(x)
                    symbol: value x (flags: <param> <synthetic>)
         symbol definition: x: Boolean
                       tpe: Boolean
             symbol owners: value x
            context owners: anonymous class $anonfun -> value f -> object test -> package <empty>
      [...]
      == Expanded type of tree ==
      
      TypeRef(TypeSymbol(final abstract class Boolean extends AnyVal))
      
      uncaught exception during compilation: scala.MatchError
      error: scala.MatchError: ? (of class scala.reflect.internal.Types$BoundedWildcardType)
      	at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer$$anon$3.scala$tools$nsc$typechecker$RefChecks$RefCheckTransformer$$anon$$validateVariance$1(RefChecks.scala:894)
      	at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer$$anon$3.validateVariance(RefChecks.scala:965)
      	at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer$$anon$3.traverse(RefChecks.scala:971)
      	at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer$$anon$3.traverse(RefChecks.scala:842)
      	at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:1734)
      	at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer.transform(RefChecks.scala:108)
      	at scala.reflect.api.Trees$Transformer$$anonfun$transformTypeDefs$1.apply(Trees.scala:653)
      	at scala.reflect.api.Trees$Transformer$$anonfun$transformTypeDefs$1.apply(Trees.scala:653)
      	at scala.collection.immutable.List.loop$1(List.scala:164)
      	at scala.collection.immutable.List.mapConserve(List.scala:180)
      [...]
      	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1550)
      	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1546)
      	at scala.tools.nsc.Global$Run.compile(Global.scala:1656)
      	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)
      

        Issue Links

          Activity

          Hide
          Evgeny added a comment -

          oneliner:

          val f : PartialFunction[_, Int] = { case a : Int => a }
          
          Show
          Evgeny added a comment - oneliner: val f : PartialFunction[_, Int] = { case a : Int => a }
          Hide
          Jason Zaugg added a comment -
          Show
          Jason Zaugg added a comment - Patch in progress: https://github.com/retronym/scala/compare/ticket/6258
          Show
          Jason Zaugg added a comment - https://github.com/scala/scala/pull/1168

            People

            • Assignee:
              Jason Zaugg
              Reporter:
              Evgeny
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development