Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ruippeixotog opened this issue Sep 7, 2022 · 3 comments

Comments

@ruippeixotog
Copy link

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.

@ruippeixotog ruippeixotog added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 7, 2022
@odersky odersky added stat:fix available and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 8, 2022
@odersky
Copy link
Contributor

odersky commented Sep 8, 2022

I verified that this works now on latest main.

@odersky odersky closed this as completed Sep 8, 2022
@ruippeixotog
Copy link
Author

Thanks for confirming, @odersky! Do you know which PR fixed it? I'm curious to see details about this.

@odersky
Copy link
Contributor

odersky commented Sep 8, 2022

I think it was #15742, but did not check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants