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 matching enumeration tuple #1496

Closed
scabug opened this issue Nov 10, 2008 · 3 comments
Closed

Compiler crash matching enumeration tuple #1496

scabug opened this issue Nov 10, 2008 · 3 comments
Milestone

Comments

@scabug
Copy link

scabug commented Nov 10, 2008

Please see the following code and inline comments:

object EnumMatch {
  object XY extends Enumeration {
    val x = Value("x")
    val y = Value("y")
  }
  private def binOp(left: XY.Value, right: XY.Value) = 
    (left, right) match {
      case (XY.x, XY.x) => XY.y
      
      // the following line produces the compiler crash
      case (XY.y, XY.y) | _ => XY.x
      // case _ => XY.x // however, this line works fine!
    }
}

I got this error (using eclipse plugin):

java.lang.Error: Unknown label target: method body%1 at: OffsetPosition(DoubleMatch.scala,305): ctx: 	package: test
	clazz: test.EnumMatch
	method: test.EnumMatch.binOp
	bb: 24
	labels: Map(method failCont%1 -> method failCont%1, method body%0 -> method body%0, method failCont%3 -> method failCont%3, method failCont%2 -> method failCont%2, method failCont%4 -> method failCont%4)
	exception handlers: List()
	cleanups: List()
	scope: [][value left, value right][value temp1][value temp2, value temp3]

	at scala.tools.nsc.Global.abort(Global.scala:154)
	at scala.tools.nsc.backend.icode.GenICode$$ICodePhase.scala$$tools$$nsc$$backend$$icode$$GenICode$$ICodePhase$$$$genLoad(GenICode.scala:734)
	at scala.tools.nsc.backend.icode.GenICode$$ICodePhase.scala$$tools$$nsc$$backend$$icode$$GenICode$$ICodePhase$$$$genLoad(GenICode.scala:455)
	at scala.tools.nsc.backend.icode.GenICode$$ICodePhase.scala$$tools$$nsc$$backend$$icode$$GenICode$$ICodePhase$$$$genLoad(GenICode.scala:455)
	...
@scabug
Copy link
Author

scabug commented Nov 10, 2008

Imported From: https://issues.scala-lang.org/browse/SI-1496?orig=1
Reporter: paphko
Assignee: @DRMacIver

@scabug
Copy link
Author

scabug commented Nov 10, 2008

@paulp said:
This is another squeezing bug - it works with -Ysqueeze:off.

@scabug
Copy link
Author

scabug commented Jun 26, 2009

@paulp said:
Fixed in r18127.

@scabug scabug closed this as completed May 18, 2011
@scabug scabug added this to the 2.8.0 milestone Apr 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant