Skip to content

Match type compilation is not deterministic #11393

@jto

Description

@jto

Compiler version

3.0.0-M3

Minimized code

object Format:
  type ToFormat[X <: Tuple] = X match
      case EmptyTuple => String
      case '%' *: 's' *: ts => (String => ToFormat[ts])
      case Char *: ts => ToFormat[ts]

val x: Format.ToFormat['a' *: EmptyTuple] =  ""

Output

Sometimes:

[error] -- [E007] Type Mismatch Error: /private/tmp/scala3-fiddling/src/main/scala/Main.scala:27:49
[error] 27 |    val x: Format.ToFormat['a' *: EmptyTuple] =  ""
[error]    |                                                 ^^
[error]    |                   Found:    ("" : String)
[error]    |                   Required: Format.ToFormat[('a' : Char) *: EmptyTuple]
[error] one error found

but other times:

[success] Total time: 0 s, completed Feb 12, 2021 2:52:36 PM

Expectation

The example compiles all the time.

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