HaxeFoundation / HaxeFoundation/haxe

Error when using macro on inline local function

Open
#10,451 5 comments 0 reactions 0 assignees View on GitHub
bug platform-macro
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

This code fails with `Cannot create closure on inline closure`

```haxe
using Test.Macros;

class Macros {
macro public static function call (f:haxe.macro.Expr) return macro $f();
}
#if !macro

function main () {
inline function eq () {
trace("i am inline");
}
eq.call();
}
#end
```

Moving the closure into the top level works as expected:

```haxe
using Test.Macros;

class Macros {
macro public static function call (f:haxe.macro.Expr) return macro $f();
}
#if !macro
inline function eq () {
trace("i am inline");
}
function main () {

eq.call();
}
#end
```

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.