HaxeFoundation / HaxeFoundation/haxe

Returning anything from build macro interferes with field type completion.

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

Description

Minimal example:

```haxe
#if !macro
@:build(Main.build())
#end
class Main {
#if !macro
var name:|
static function main() {}
#else
static function build() {
var ret = haxe.macro.Context.getBuildFields();
return ret;// return null works
}
#end
}
```

The compiler seems a little confused:

![image](https://user-images.githubusercontent.com/509501/90746977-f0d83e80-e2d0-11ea-99de-f7c3e4cc2bf9.png)

Without returning any changes (i.e. `return null` as suggested in the comment), it works:

![image](https://user-images.githubusercontent.com/509501/90746511-d0a87f80-e2d0-11ea-8c91-b37f535a4a52.png)

Also, if you type at least one letter and force completion (or type two letters), you get type completion:

![image](https://user-images.githubusercontent.com/509501/90746113-b66ea180-e2d0-11ea-9bdf-458ea688b17c.png)

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.