Skip to content

Incorrect kind of type projection #3433

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
OlivierBlanvillain opened this issue Nov 3, 2017 · 0 comments
Closed

Incorrect kind of type projection #3433

OlivierBlanvillain opened this issue Nov 3, 2017 · 0 comments

Comments

@OlivierBlanvillain
Copy link
Contributor

OlivierBlanvillain commented Nov 3, 2017

scala> type Const[t] = { type L[x] = t }
defined type alias Const

scala> type Bar[a] = Const[Int]#L[a] 
-- [E052] Reference Error: <console>:5:15 --------------------------------------
5 | type Bar[a] = Const[Int]#L[a]
  |               ^^^^^^^^^^^^^^^
  |               Const[Int]#L does not take type parameters

Interestingly if we "partially apply" this Const the result is neither in * nor in * → *:

scala> type Foo = Const[Int]#L
defined type alias Foo

scala> val a: Foo[Int] = 1
-- [E052] Reference Error: <console>:6:7 ---------------------------------------
6 |val a: Foo[Int] = 1
  |       ^^^^^^^^
  |       Foo does not take type parameters

scala> val a: Foo = 1
-- [E055] Syntax Error: <console>:6:7 ------------------------------------------
6 |val a: Foo = 1
  |       ^^^
  |       missing type parameter for Foo

(Note that in Dotty we would just define Const as type Const[C] = [X] => C which works as expected, the above is a way to encode a constant type function in scalac)

@odersky odersky self-assigned this Jan 27, 2018
@odersky odersky closed this as completed in e3b4932 Feb 2, 2018
odersky added a commit that referenced this issue Feb 2, 2018
Fix #3433: Fix determining typeParams for structural type members
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