Skip to content

Type matching on structural types does not work (nor gives an error) #15312

Closed
@p-pavel

Description

@p-pavel

Compiler version

3.1.2

Minimized code

type F[t] =
  t match
    case {type A = Float} => Int
    case {type A = Int} => String

val a: F[{type A = Float}] = 10
val b: F[{type A = Int}] = "asd" // Found:("asd" : String) Required: F[Object{A = Int}]

Output

Found:("asd" : String) Required: F[Object{A = Int}]

Expectation

I expect the compiler to either do the right match (accepting string value for val b) or give some diagnostic about the limitation of match types not playing with structural patterns

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions