Skip to content

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

Closed

Description

@scabug
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)

Activity

  1. scabug commented on Aug 19, 2012

    @scabug
    Author

    Imported From: https://issues.scala-lang.org/browse/SI-6258?orig=1
    Reporter: Evgeny (akshaal)
    Affected Versions: 2.10.0-M6
    Other Milestones: 2.10.0
    Attachments:

    • crash.log (created on Aug 19, 2012 1:28:23 AM UTC, 28759 bytes)
  2. scabug commented on Aug 19, 2012

    @scabug
    Author

    Evgeny (akshaal) said:
    oneliner:

    val f : PartialFunction[_, Int] = { case a : Int => a }
    
  3. scabug commented on Aug 19, 2012

    @scabug
    Author
  4. scabug commented on Aug 20, 2012

    @scabug
    Author
  5. added this to the 2.10.0-M7 milestone on Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions