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

Extracting enum values with <Void> does not allow compilation #11555

Open
EliteMasterEric opened this issue Feb 7, 2024 · 1 comment · May be fixed by #11558
Open

Extracting enum values with <Void> does not allow compilation #11555

EliteMasterEric opened this issue Feb 7, 2024 · 1 comment · May be fixed by #11558

Comments

@EliteMasterEric
Copy link
Contributor

Example: https://try.haxe.org/#F28DdCCc

This is an example simplified down from a case in which I wanted to use haxe-concurrent to perform a task, and then query the time at which it was completed once it finished.

Here, I have a valid case for using Void as the parameter of PromiseResult, but encounter the issue where I cannot access getResult().time because extracting the enum values requires a variable be assigned to a Void type, even if it is unused (as indicated by assigning it to _).

Switching from Void to typedef NoValue = {} would be annoying as then I would have to make every task I provide to the task executor return an empty value.

Should assigning _ to Void specifically be allowed, or is that too strange of a behavior? There is also the question of whether using Void as the type parameter of an enum is even valid in the first place.

@Simn
Copy link
Member

Simn commented Feb 7, 2024

I suppose we should finally disallow type parameter Void for Haxe 5. See #3463.

@Simn Simn linked a pull request Feb 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants