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

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

Open
noresttherein opened this issue Jan 6, 2024 · 0 comments

Comments

@noresttherein
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants