Skip to content

Compiler fails to synthesize ValueOf for singleton this.type #23086

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
rcano opened this issue May 1, 2025 · 0 comments · Fixed by #23094
Closed

Compiler fails to synthesize ValueOf for singleton this.type #23086

rcano opened this issue May 1, 2025 · 0 comments · Fixed by #23094
Assignees
Labels
itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label

Comments

@rcano
Copy link

rcano commented May 1, 2025

Compiler version

3.6.x, 3.7.0-RC4

Minimized code

class Test { summon[ValueOf[this.type]] }

Output

-- [E172] Type Error: ----------------------------------------------------------
1 |class Test { summon[ValueOf[this.type]] }
  |                                       ^
  |No singleton value available for (Test.this : Test); eligible singleton types for `ValueOf` synthesis include literals and stable paths.
1 error found

Expectation

This a singleton type with a singleton value that can only ever be created in exactly one way. The compiler should be able to synthesize this like it does for any other singleton value

@rcano rcano added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 1, 2025
@hamzaremmal hamzaremmal self-assigned this May 3, 2025
hamzaremmal added a commit that referenced this issue May 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants