-
Notifications
You must be signed in to change notification settings - Fork 28
#688 Avoid colon casts in type system #1550
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
|
fixes #688 |
|
This looks good to me, but because there are so many affected nodes, I would like to ask some of the others reviewers to also have a look. @arimer @jonaskraemer thanks! |
arimer
left a comment
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.
Could you please update the changelog as well?
arimer
left a comment
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.
Please updated the changelog.
done |
|
@nkoester what was the motivation for not only converting TS rules but also: quickfixes, helper classes, behaviour methods etc.? |
|
All of these were within the typesystem and the context thereof. Or at least called from the typesystem. From my perspective |
arimer
left a comment
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.
let's go 🚀
When the type system expects a certain concept, we should not use the colon cast (:) to cast nodes to a different type but rather use the as cast. This cast returns null if the cast is not successful, for example when a user provides a node of a wrong type or the RuntimeErrorType is returned. I've fixed a few of such issues in the past but there are so many hidden cases, it's probably better to just ban this cast and replace all instances in the type system.