HaxeFoundation / HaxeFoundation/haxe

The macro-in-macro check seems insufficient.

Open
#11,403 6 comments 0 reactions 1 assignee Claimed by @Simn View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Original discussion about disallowing macro in macro: https://github.com/HaxeFoundation/haxe/issues/7348

It seems the check only occurs when actually calling a macro from a macro:

```haxe
class Test {
static function main() {
#if !macro
for (v in getValues())
trace(v);
#end
}
public static macro function getValues() {
getValues();// Uncaught exception macro-in-macro
return macro [];
}
}
```

But not when calling a macro in macro context:

```haxe
class Test {
static function main() {
for (v in getValues()) // You can't iterate on a Dynamic value, please specify Iterator or Iterable
trace(v);
}
public static macro function getValues() {
return macro [];
}
}
```

Does that really make sense?

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.