Skip to content

Pattern matching regression warning in inline quotes with sealed class #13405

Closed
@soronpo

Description

@soronpo

Compiler version

v3.1.0 snapshot of latest master

Minimized code

Macro.scala

import scala.quoted.*

sealed class Foo()
inline def hh(): Unit = ${ interpMacro() }

private def interpMacro()(using Quotes): Expr[Unit] =
  import quotes.reflect.*
  '{
    val res: Either[String, (Foo, Foo)] =
      Right((new Foo, new Foo))
    val (a, b) = res.toOption.get
  }

Main.scala

@main def main: Unit = hh()

Output

[warn]  1 |@main def main: Unit = hh()
[warn]    |                       ^^^^
[warn]    |                       match may not be exhaustive.
[warn]    |
[warn]    |                       It would fail on pattern case: (_, _)

Expectation

No warning.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions