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

Remove @:overload from Reflect.makeVarArgs #11853

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

Simn
Copy link
Member

@Simn Simn commented Dec 5, 2024

While working on #11843 I came across this function which has an @:overload in order to support both Array<Dynamic>->Void and Array<Dynamic>->Dynamic functions. This only works incidentally on some targets because the old @:overload(function) syntax doesn't perform the same checks that proper overload functions do. For example, to the JVM target both signatures are the same, so the compiler doesn't know which overload to resolve to.

Since this is only done so that we can support both Dynamic and Void callback returns, I think using a type parameter instead achieves the same goal without the overload hassle.

I had the formatter on so the diff is a bit bigger.

@Simn
Copy link
Member Author

Simn commented Dec 5, 2024

I thought this change might break cases where we rely on explicit Dynamic, for instance the mixed array thing in something like Reflect.makeVarArgs(_ -> ["a", 1]). However, this fails on development too (I'm not sure why though...)

@Simn
Copy link
Member Author

Simn commented Dec 5, 2024

A green CI on a first commit that changes all Reflect.hx files must be some sort of divine sign... I'll merge this before anyone has a chance to complain.

@Simn Simn merged commit f1fd471 into development Dec 5, 2024
100 checks passed
@Simn Simn deleted the reflect_make_var_args_without_overload branch December 5, 2024 09:25
@skial skial mentioned this pull request Dec 9, 2024
1 task
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.

1 participant