-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Singleton type of context function #16488
Comments
I think that's out of scope. We need an explicit |
Then should at least this work? trait Ctx
val f: Ctx ?=> Int = ???
def g: f.type = (ctx: Ctx) ?=> f Because it doesn't. Although it raises one compiler error less |
No that should not work either. You create a new closure, which is different from |
Is there any way to refer to the exact type of a given context function then? trait Ctx
val f: Ctx ?=> Int = ???
type Tpe = f.type -- Error:
3 |type Tpe = f.type
| ^
| no implicit argument of type Ctx was found for parameter of (Ctx) ?=> Int trait Ctx
val f: Ctx ?=> Int = ???
given Ctx with {}
type Tpe = f.type -- Error:
4 |type Tpe = f.type
| ^^^^^^
| Int is not a valid singleton type, since it is not an immutable path |
Yes, that's a bug. Should be easy to fix. |
In a singleton type `f.type`, if `f` is a context function value, don't complete with implicit arguments. Fixes scala#16488
In a singleton type `f.type`, if `f` is a context function value, don't complete with implicit arguments. Fixes #16488
In a singleton type `f.type`, if `f` is a context function value, don't complete with implicit arguments. Fixes scala#16488
Compiler version
3.2.1
Minimized code
Output
Expectation
This should compile as it does for non-singleton context function types, e.g.
and singleton non-contextual function types, e.g.
The text was updated successfully, but these errors were encountered: