Skip to content

Cannot match with a bare type variable #621

Open
@scabug

Description

@scabug

The following code compiles and runs as expected:

    val x : List[T] forSome { type T } = List(42)
    val w = x match { case y : List[u] => ((z : u) => z)(y.head) }

but this slight variation does not:

    val x : T forSome { type T } = 42
    val w = x match { case y : u => ((z : u) => z)(y) }

It reports that it cannot find type u. You get the same error with this variation:

    val x : List[List[T]] forSome { type T } = List(List(42))
    val w = x match { case y : List[List[u]] => ((z : u) => z)(y.head.head) }

But in this case, I can imagine that the problem can be attributed to erasure.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions