bug icon indicating copy to clipboard operation
bug copied to clipboard

Matching over constants of a value class wrapping a value type doesn't emit `switch`.

Open noresttherein opened this issue 1 year ago • 0 comments

Reproduction steps

Scala version: 2.13.11

	class Wrapper(val self :Int) extends AnyVal

	final val One = new Wrapper(1)
	final val Two = new Wrapper(2)

	(One :Wrapper @switch) match {
		case One =>
		case Two =>
		case _ =>
	}

Problem

Compiler warns:

could not emit switch for @switch annotated match
	(One :Wrapper @switch) match {

I may not understand something fully, but there doesn't seem to be a reason for this not to work.

noresttherein avatar Jan 06 '24 19:01 noresttherein