HaxeFoundation / HaxeFoundation/haxe

Can't use abstract with @:forwardStatics as enum parameter

Open
#6,334 1 comment 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

This code does not compile. Removing `@:forwardStatics` makes it work.
https://try.haxe.org/#E60cC

@:forwardStatics
abstract AFoo(Foo) from(Foo) {}

class Foo {
public function new() {}
}

enum Bar {
EFoo(foo:AFoo);
}

class Main {
static function main() {
var t = Bar.EFoo(new Foo());
switch(t) {
case EFoo(foo): trace(foo); // Class has no field foo
}
}
}

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.