HaxeFoundation / HaxeFoundation/haxe

Lambda.count with Map<enum abstract,X> : should be Iterable<Unknown<0>>

Open
#12,229 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

Hej,

This piece of code fails : https://try.haxe.org/#C48f1122
```haxe
enum abstract MyE(String) /*to String*/{ // <-- Works with "to String"
var MEA;
var MEB;
}

class Test {
static var h:Map = [MEA => true, MEB => true];

static function main() {
var len = Lambda.count(h); // <-- Map should be Iterable>
for (o in h) { // <-- Always ok
trace(o);
}
}
}
```

The `for` loop see that h is iterable but `Lambda.count` doesn't see that. If I add `to String` to the enum abstract, it works fine.

Thanks for your help

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.