HaxeFoundation / HaxeFoundation/haxe

Field optionality in object intersections incorrectly depends on order.

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

Description

[Minimal example](https://try.haxe.org/#F612a9c5):

```haxe
function main() {
var v:Optional & Mandatory = {};// succeeds
var v:Mandatory & Optional = {};// fails
}

typedef Optional = { final ?o:Int; }
typedef Mandatory = { final o:Int; }
```

Contributor guide

Open the contributing guide

Research direction

Run the linked try.haxe.org minimal example and confirm that reversing the two object intersections changes whether the empty object is accepted. Then locate the Haxe compiler's handling of object intersections and optional versus mandatory fields; done means both declarations behave consistently and the regression is covered by an appropriate compiler test.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.