Skip to content

Type aliases of path-dependent context functions aren't interchangeable with their definition #15995

Closed
@ruippeixotog

Description

@ruippeixotog

Compiler version

3.2.0

Minimized code

trait Env {
  type Res
}

type EnvFunc = (env: Env) ?=> env.Res

val func1: (env: Env) ?=> env.Res = ???
val func2: EnvFunc = ???

def consume(f: EnvFunc): Unit = ???

object Main {
  consume(func1) // ok
  consume(func2) // error
}

Output

[error] 33 |  consume(func2) // error
[error]    |          ^^^^^
[error]    |          Found:    examples.Env#Res
[error]    |          Required: evidence$2.Res

Expectation

Both functions should type check, as I expect type alias usages to be always interchangeable with their definition.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions