Skip to content

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

Open
@noresttherein

Description

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.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions