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

[tsgen] Fix overriding Embind's ClassHandle clone method. #23132

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brendandahl
Copy link
Collaborator

The return type of clone should actually be ThisType<this> to better match what the JS is actually doing. This also makes it possible to override the clone method.

The return type of `clone` should actually be `ThisType<this>` to better
match what the JS is actually doing. This also makes it possible to
override the clone method.
@brendandahl brendandahl requested a review from sbc100 December 11, 2024 22:24
@@ -31,7 +31,7 @@ export interface ClassHandle {
delete(): void;
deleteLater(): this;
isDeleted(): boolean;
clone(): this;
clone(): ThisType<this>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this expression do/mean?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, it's magic marker that changes how the this type is bound using the context it was declared instead of where it was called from. This is a workaround for some g3 conflicts, but I'm actually leaning towards abandoning this PR and asking that they don't try to override the clone method.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a little magical but LGTM if it fixes the issue!

vrabaud added a commit to vrabaud/opencv that referenced this pull request Dec 18, 2024
This is in emscripten 3.1.71 and above, cf
emscripten-core/emscripten#22734
There was a temptative fix upstream to no avail:
emscripten-core/emscripten#23132
vrabaud added a commit to vrabaud/opencv that referenced this pull request Dec 18, 2024
This is in emscripten 3.1.71 and above, cf
emscripten-core/emscripten#22734
There was a temptative fix upstream to no avail:
emscripten-core/emscripten#23132
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.

2 participants