HaxeFoundation / HaxeFoundation/haxe
Map Comprehension break/return bug
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
Sometimes, during the process of creating a Map, it becomes clear that the rest of its elements do not need to be created or that it is necessary to exit the current method.
Example:
```haxe
[ERROR] Test.hx:3: characters 55-59
3 | trace([ for (i in 0...3) if (i != 2) i => 0 else break ]);
| ^^^^
| haxe.ds.Map has no field push
```
However, with Array Comprehension it works fine.
As a solution, I don't use Map Comprehension in these cases, but it would be nice if it were possible.
If it's hard to do, it would be better with a clearer error message.
Judging by the error message, the same method is used as for arrays, it seems that it is necessary to make a `set` instead of a `push` for Map.
Contributor guide
Assessment
This issue has not been assessed yet.