Skip to content

[plugin] add workaround for recursive typedef overflow#878

Open
yuxiaomao wants to merge 1 commit intoHaxeFoundation:masterfrom
yuxiaomao:dev-fix-plugin
Open

[plugin] add workaround for recursive typedef overflow#878
yuxiaomao wants to merge 1 commit intoHaxeFoundation:masterfrom
yuxiaomao:dev-fix-plugin

Conversation

@yuxiaomao
Copy link
Collaborator

@yuxiaomao yuxiaomao commented Feb 13, 2026

Repro with -dce no.
Stack overflow when comparing types, e.g. haxe.ds.StringMap hvirtual - hmethod. This PR suggest to workaround the problem by stop checking when recursion is too deep.

However there's still another plugin bug that, excluded functions calls (at least some of them in fun$init) are not replaced by the base version of the function. Repro with --macro exclude("Type") (Edit: any static call that are excluded). I didn't find how to fix yet ^^'

@Simn
Copy link
Member

Simn commented Feb 13, 2026

It might be good to have this failsafe here, but this should really be fixed in the code generation. See HaxeFoundation/haxe#12539

@yuxiaomao
Copy link
Collaborator Author

I remember well that one, but I still don't know what to do ^^'
This bug isn't literally the same because this only occurs on hl.Api.loadPlugin, but the origin of both problem is probably related to HVirtual doesn't have a hash id or something

@Simn
Copy link
Member

Simn commented Feb 13, 2026

I somehow thought this was already fixed but either way, let's discuss that further over there.

As for this, isn't 10 a bit low?

@yuxiaomao
Copy link
Collaborator Author

I tried in haxe but never successed :< Maybe if we fix there, this problem will no longer exists.

I'll probably not merge this yet, until I find a fix or workaround for my other bug. As this is plugin-only, I didn't really think about how deep should I check (I can set it to 20 or more if you prefer, but I hope that most people doesn't write a very deep and non-recursive typedef)

@ncannasse
Copy link
Member

That does not seem like a good fix :) could we instead mark temporarily the ->type value with -1 while we recurse and restore it after so we check for strict equality ?

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

Successfully merging this pull request may close these issues.

3 participants