Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstract methods in generic, abstract classes cause compile errors #10735

Closed
Jrayp opened this issue Jun 25, 2022 · 1 comment
Closed

Abstract methods in generic, abstract classes cause compile errors #10735

Jrayp opened this issue Jun 25, 2022 · 1 comment
Assignees
Milestone

Comments

@Jrayp
Copy link

Jrayp commented Jun 25, 2022

Haxe 4.2.5

I'm not sure if there is a logical reason for this, but it seems like a bug to me. See https://try.haxe.org/#b501c2DC

class Test {
	static function main() {}
}

@:generic
abstract class A<T> {
	abstract function foo():Void;
}

class B extends A<Int> {
	function foo() {}
}

This causes two errors:

Test.hx:7: characters 2-31 : Field foo has no expression (possible typing order issue)
Test.hx:10: characters 17-23 : While building A_Int
@Jrayp Jrayp changed the title Non-generic methods in generic, abstract classes cause compile errors Abstract methods in generic, abstract classes cause compile errors Jun 25, 2022
@AbeGellis
Copy link

Also encountering this, I was able to work around it by removing the abstract modifier from the base class and adding a dummy implementation to the abstract method. Not ideal since I can't prevent instantiation with compile-time checks.

@Simn Simn added this to the Release 4.3 milestone Mar 24, 2023
@Simn Simn self-assigned this Mar 24, 2023
@Simn Simn closed this as completed in 70479e8 Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants