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

Fix #4982: Synthesize This nodes with primitive types in hijacked classes. #4983

Merged
merged 1 commit into from
May 16, 2024

Conversation

sjrd
Copy link
Member

@sjrd sjrd commented May 11, 2024

No description provided.

@sjrd sjrd requested a review from gzm0 May 11, 2024 10:58
@sjrd sjrd force-pushed the fix-hijacked-class-refl-proxy-this-type branch from 0388092 to a01863e Compare May 11, 2024 12:28
Copy link
Contributor

@gzm0 gzm0 left a comment

Choose a reason for hiding this comment

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

The changes look good, but I'm a bit concerned about not addressing the underlying issue here: Is it really infeasible to run the ClassDef checker on synthesized methods?

I guess this PR is evidence that the method synthesizer is sufficiently complex that class def checking is a good idea :)

@sjrd
Copy link
Member Author

sjrd commented May 14, 2024

I initially thought this was a somewhat severe issue, but now I don't think it is. The checkers are required to make sure that the input we receive is well-formed and well-typed. If we have linker-internal methods that generate wrong IR, it's not a big deal because we can fix it without care for binary compatibility. It only matters that we produce IR that survives the rest of our pipeline without causing any user-visible bug.

@gzm0
Copy link
Contributor

gzm0 commented May 15, 2024

Ah yes, I agree with this. From a "safety" POV this is not an issue. However, it just feels kind of silly that we have this piece of infrastructure to validate arbitrary IR and we don't use it for code generated in the linker.

A compromise might be to amend the test to use the ClassDef checker instead of a hand crafted test condition.

@sjrd sjrd force-pushed the fix-hijacked-class-refl-proxy-this-type branch from a01863e to b9e3b09 Compare May 15, 2024 17:00
@sjrd
Copy link
Member Author

sjrd commented May 15, 2024

A compromise might be to amend the test to use the ClassDef checker instead of a hand crafted test condition.

Done.

@sjrd sjrd requested a review from gzm0 May 15, 2024 17:01
@sjrd sjrd force-pushed the fix-hijacked-class-refl-proxy-this-type branch from b9e3b09 to 69baff1 Compare May 15, 2024 17:02
@gzm0 gzm0 merged commit db4d46c into scala-js:main May 16, 2024
3 checks passed
@sjrd sjrd deleted the fix-hijacked-class-refl-proxy-this-type branch May 16, 2024 09:03
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.

None yet

2 participants