Closed
Description
Compiler version
3.3.2-RC1
Minimized code
import scala.quoted.*
def test(x: Expr[Any])(using Quotes): Unit =
x match
case '{ type t; type u <: t; () } =>
case '{ type t <: Comparable[t]; () } =>
Output
-- [E005] Naming Error: t/Test.scala:5:12 --------------------------------------
5 | case '{ type t; type u <: t; () } =>
| ^^^^^^^^^^^^^^^^^^^^^^^
| duplicate pattern variable: t
|
| longer explanation available when compiling with `-explain`
-- [E005] Naming Error: t/Test.scala:6:12 --------------------------------------
6 | case '{ type t <: Comparable[t]; () } =>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| duplicate pattern variable: t
|
| longer explanation available when compiling with `-explain`
Expectation
This is an issue in the implementation of SIP-53 - Support for multiple references to the same type in quoted type patterns.
It should be equivalent to
import scala.quoted.*
def test(x: Expr[Any])(using Quotes): Unit =
x match
case '{ type t; type u <: `t`; () } =>
case '{ type t <: Comparable[`t`]; () } =>