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 alias to singleton type of named tuple value can not be selected (but just singleton type can) #20439

Closed
kavedaa opened this issue May 20, 2024 · 1 comment · Fixed by #20505
Labels
area:named-tuples Issues tied to the named tuples feature. itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label
Milestone

Comments

@kavedaa
Copy link

kavedaa commented May 20, 2024

Compiler version

3.5.0-RC1-bin-20240519-a7ac03e-NIGHTLY

Minimized code

import scala.language.experimental.namedTuples

val bar = (a = 1, b = 2)

type ThatBar = bar.type
val thatBar: ThatBar = bar
val thatBar2: bar.type = bar

def test2 = thatBar.a
def test3 = thatBar2.a

Output

[error] ./tuples.scala:22:13
[error] value a is not a member of ThatBar
[error] def test2 = thatBar.a

Expectation

Successful compilation.

@kavedaa kavedaa added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 20, 2024
@kavedaa
Copy link
Author

kavedaa commented May 20, 2024

If val thatBar: ThatBar = bar is replaced with val thatBar: bar.type = bar, it compiles.

@bishabosha bishabosha added the area:named-tuples Issues tied to the named tuples feature. label May 31, 2024
@bishabosha bishabosha changed the title Type alias does not retain name of Named Tuple Type alias to singleton type of named tuple value can not be selected (but just singleton type can) May 31, 2024
odersky added a commit that referenced this issue Jun 2, 2024
@Kordyjan Kordyjan added this to the 3.5.1 milestone Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:named-tuples Issues tied to the named tuples feature. itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants