Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Alias to type lambda cannot be used without application #17668

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

Closed
s5bug opened this issue Nov 24, 2022 · 3 comments
Closed

Alias to type lambda cannot be used without application #17668

s5bug opened this issue Nov 24, 2022 · 3 comments

Comments

@s5bug
Copy link

s5bug commented Nov 24, 2022

Compiler version

3.2.0, 3.2.1-RC2, 3.2.1

Minimized code

type [-L <: AnyKind, +R <: AnyKind] = [_ <: L] =>> R

type F = Any  Any

Output

-- Error: ----------------------------------------------------------------------
1 |type F = Any  Any
  |         ^^^^^^^^^
  |         type  takes type parameters

Expectation

Scala allows this usage, especially in the context of

trait Free[F <: ((Any  Any)  Any), A]

where

trait Free[F <: /* giant mess of equivalent type lambda */, A]

is equivalent and does compile.

@s5bug s5bug added the stat:needs triage Every issue needs to have an "area" and "itype" label label Nov 24, 2022
@smarter
Copy link
Member

smarter commented Nov 24, 2022

I'm moving this to feature-request because this was an intentional change, although it could change back again as discussed in #9090

@smarter smarter transferred this issue from scala/scala3 Nov 24, 2022
@smarter smarter removed the stat:needs triage Every issue needs to have an "area" and "itype" label label Nov 24, 2022
@s5bug
Copy link
Author

s5bug commented Nov 24, 2022

As a question, why does the current error appear at usage and not at declaration?

@smarter
Copy link
Member

smarter commented Nov 29, 2022

You mean, why is there no error in the definition of type → ? Because it defines a type lambda which is allowed, you can also write:

type F = [X] =>> (Any  Any)[X]

But the eta-expansion is not performed automatically by the compiler

@ckipp01 ckipp01 transferred this issue from lampepfl/dotty-feature-requests May 31, 2023
@scala scala locked and limited conversation to collaborators May 31, 2023
@ckipp01 ckipp01 converted this issue into discussion #17669 May 31, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants