scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.82k stars 1.05k forks source link

Match types are unable to correctly handle opaque types. #21679

Closed wz7982 closed 4 hours ago

wz7982 commented 4 hours ago

Compiler version

3.5.0

Minimized code

object A:
    opaque type Str = String

object B:
    type F[X] = X match
        case A.Str => String
        case Int => Boolean
        case Boolean => Int

    val x1: F[A.Str] = ""
    val x2: F[Int] = true
    val x3: F[Boolean] = 1

Output

compile error.

Expectation

This issue hinders the ability to match Tuple and NamedTuple within Match Types.

sjrd commented 4 hours ago

As designed. There are countless issues already closed as "as designed" on the topic.

wz7982 commented 3 hours ago

As designed. There are countless issues already closed as "as designed" on the topic.

How to calculate opaque type?