-
-
Notifications
You must be signed in to change notification settings - Fork 391
Re-add local variable type hints #5457
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
base: dev/feature
Are you sure you want to change the base?
Conversation
Also fixed #1229 |
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.
Looking excellent 👍
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.
Looks good
I remember one of the issues of local variable type hints being syntax like How does this PR deal with that issue? |
It doesn't, and it's not the end of the world either, it'll act without type hints still. Maybe a better implementation rather than listening to the set/add would be the listening in on the variable change in Variables.class. Would be able to add a JUnit async effect test once the JUnit pull request is merged. |
Listening for acceptsChanges might also not work, I've seen addons use Indeed it's not the end of the world, but it's annoying for a user to get a false positive warning, it may confuse them. Make sure to also test for code that changes Event (and thus local variables) within a structure, such as sections (newer and older impls of them). Also those that carry over local variables from another event (e.g. spawn section of Skript) |
Ok, well I applied type hints when the change method of the variable expression is used. If an addon does not properly use the change method we cannot provide type hints for it. I don't want to be re-parsing a VariableString to check if it's simple in the Variables.setVariable method. |
Do you still intend to work on this? |
closing due to inactivity |
Ya, can it get some reviews? |
well you marked it as draft |
Was waiting for Pikachu's parse pull request. |
…ript into feature/type-hints
Now that variable types work. The test 551-item amount on itemstacks.sk is referring to Fixed broken tests |
Known issue that |
It seems to only be affecting this PR, though, so I think that should be addressed. |
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.
It seems like tests are failing and conflicts need resolving.
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.
tests still failing
Was broken at the time of commit, not relating to this pull request. Please update branch. Thank you. |
I attempted to fix all the conflicts and resulted in many test failures due to this pr not playing well with AnyX. Please copy this branch onto your own fork and fix the conflicts if you wish to continue development. |
Description
Re-adds local variable type hints. This allows Skript to understand local variable types in some circumstances, and provide warnings so the user knows nothing will happen. Like setting a variable to a string and then attempting to teleport the player to the string should produce a warning.
Also made calling functions with local variables of the wrong type error #1229
Considering this breaking change I guess, since some users may not know their scripts aren't working.
Examples of proper warning now:
Notes:
Target Minecraft Versions: any
Requirements: none
Related Issues: #1229, #3864 and #5060