Skip to content

Cannot extract type from refinement in match type #15319

Closed
@prolativ

Description

@prolativ

Compiler version

According to our bisecting tool:
Last good release: 3.1.3-RC1-bin-20220403-a26a2c3-NIGHTLY
First bad release: 3.1.3-RC1-bin-20220404-ad2553d-NIGHTLY

Minimized code

type FAux[A0] = {type A = A0}

type F[t] =
  t match
    case FAux[a] => a

val a: F[{type A = Int}] = 10
val b: F[{type A = String}] = "asd"

Output

[error] /var/folders/rp/f9y80jvs54lcy26rxnt2y2kw0000gn/T/StructMatch.scala:7:28: Found:    (10 : Int)
[error] Required: F[Object{A = Int}]
[error] val a: F[{type A = Int}] = 10
[error]                            ^^
[error] /var/folders/rp/f9y80jvs54lcy26rxnt2y2kw0000gn/T/StructMatch.scala:8:31: Found:    ("asd" : String)
[error] Required: F[Object{A = String}]
[error] val b: F[{type A = String}] = "asd"
[error] 

Expectation

This should compile without an error as it used to before the regression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions