HaxeFoundation / HaxeFoundation/haxe

Extracting enum values with <Void> does not allow compilation

Open
#11,555 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

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.

Contributor guide

Open the contributing guide

Research direction

Start with the linked try.haxe.org example and trace how enum values are extracted when PromiseResult is parameterized with Void, especially the required assignment to _. Confirm whether Void is valid as an enum type parameter and whether unused Void extraction should compile. Done means the behavior is decided and the example no longer fails to compile under the chosen rules.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.