-
Notifications
You must be signed in to change notification settings - Fork 28
More new generic improvements #1131
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
Conversation
Frotty
commented
Dec 22, 2025
- reject unspecified static new generic usage
- fix generics with monomorphism
- add a big test suite
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
...stscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/EliminateGenerics.java
Outdated
Show resolved
Hide resolved
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (isUsedAsReceiverInExprMember(e) && isNewGenericTypeDef(def)) { | ||
| Element parent = e.getParent(); | ||
| parent.addError( | ||
| "Cannot access members via generic type '" + def.getName() + "' without specialization.\n" | ||
| + "New generics (<T:>) require a concrete specialization; use an instance receiver instead." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow specialized static access to new generics
The new validation rejects all static member access on a new-generic type, because it only checks isNewGenericTypeDef(def) and never verifies whether the reference is already specialized. That means valid code like Foo<int>.bar (explicit type args) will still hit this error path, even though the message says “without specialization” and the rest of the pipeline now tries to specialize generic statics. Consider gating the error on missing type arguments (e.g., wtns.getTypeParameters().isEmpty() or equivalent) so specialized static access remains legal.
Useful? React with 👍 / 👎.