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

empty-selector match in a function body must yield a function #5690

Closed
scabug opened this issue Apr 22, 2012 · 3 comments
Closed

empty-selector match in a function body must yield a function #5690

scabug opened this issue Apr 22, 2012 · 3 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Apr 22, 2012

object PatMatCrash {
  // m.$minus(1)
  // at scala.Predef$.assert(Predef.scala:185)
  // at scala.tools.nsc.Global.assert(Global.scala:187)
  // at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:291)
  val a: (Map[Int, Int] => (Any => Any)) = { m => { case _ => m - 1} }

  // patmat-crash.scala:9: error: erroneous or inaccessible type
  val b: (Int => (Any => Any)) = { m => { case _ => m } }

  // no-symbol does not have an owner (this is a bug: scala version 2.10.0-20120420-170445-56c1f29250)
  // at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:45)
  // at scala.tools.nsc.Global.abort(Global.scala:202)
  // at scala.reflect.internal.Symbols$NoSymbol.owner(Symbols.scala:3031)
  // at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.hostForAccessorOf(SuperAccessors.scala:474)
  // at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.needsProtectedAccessor(SuperAccessors.scala:457)
  val c: (Int => (Any => Any)) = { m => { case _ => m.toInt } }
}

// -Xoldpatmat works
@scabug
Copy link
Author

scabug commented Apr 22, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5690?orig=1
Reporter: @retronym
Affected Versions: 2.10.0
Other Milestones: 2.10.0-M3

@scabug
Copy link
Author

scabug commented Apr 22, 2012

@retronym said:
In the wild, with workarounds: scalaz/scalaz@180c0ad

@scabug
Copy link
Author

scabug commented Apr 22, 2012

@retronym said:
By way of contrast, this snippet works:

{ (m: Any) => 0; { case _ => 0 } }: (Any => (Any => Any))

The fun seems to start here:

scala/scala@2848373

@scabug scabug closed this as completed Apr 27, 2012
@scabug scabug added the patmat label Apr 7, 2017
@scabug scabug added this to the 2.10.0-M2 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants