Skip to content

Overriding coroutines does not work #95

@Simn

Description

@Simn
import hxcoro.CoroRun;
import hxcoro.Coro.*;

class Parent {
	public function new() {}

	@:coroutine public function test() {
		trace("Parent.test() 1");
		yield();
	}
}

class Child extends Parent {
	@:coroutine override function test() {
		trace("Child.test()");
		super.test();
	}
}

function main() {
	CoroRun.runScoped(node -> {
		new Child().test();
	});
}

This endlessly calls the two test functions. The problem is that invokeResume from Parent.test invokes Child.test instead because the normal OOP dynamic dispatch comes into play.

I think we have to disallow this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions