-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Godot4.4dev7: Using @warning_ignore
annotation at function signature level is broken
#100878
Comments
Looks like @warning_ignore is broken, in general using at function signature. The introduction of @warning_ignore_start and @warning_ignore_restore makes sense, but is also very cumbersome and generates code noise. The @warning_ignore should work at class, method and line level. To exclude defined blocks, @warning_ignore_start and @warning_ignore_restore make sense, but not as a replacement for entire methods or classes. Running the scripts via command line shows the warning as errors.
|
unsafe_method_access
warnings is broken@warning_ignore
annotation at function signature level is broken
@warning_ignore
annotation at function signature level is broken@warning_ignore
annotation is broken
@warning_ignore
annotation is broken@warning_ignore
annotation at function signature level is broken
This functionality was:
See: This change was intentional |
There has been a correction #75620 do not sound as originally intended. This change is a step backwards and only makes it more cumbersome. It had worked fine for many versions and feels broken. And it was possible to ignore all in 4.1 |
#75620 is for the specific case, the method declaration, it's not for the whole function, at least the issue it solved, can you point to where in that PR that part of this was touched on? The PR is about the scope of shadowing not the scope of the warning, |
From the issue description, #75208 is related to the warning, I would say. Still, I don't see why this should be a problem at the class or method level. I think that forcing developers to switch to the new annotations after the fact is the wrong way to go. |
It working this way was never documented, and was not by design given the discussions, but regardless the removal of it was entirely intentional |
Yes, I understood that, but who says it was bad? |
See the discussion I linked for the background, this was undocumented behaviour that was never officially supported, so therefore there's no breakage
Use local ignore annotations I'd say, that was the supported usage |
This is bad because the user can accidentally ignore existing and future warnings in the function body without actually intending to do so, see the video in the comment. The problem with If we were committed to never breaking compatibility even for undocumented and unintended behavior, we could solve this by introducing a new annotation like We can't guarantee absolute compatibility, because otherwise we wouldn't be able to fix any bugs. General rule: don't rely on bad behavior, fixing a bug is not considered breaking compatibility. The problem is that some behaviors are not obviously bad. They can be controversial: convenient in some cases and confusing in others. In this particular situation, we decided to remove the behavior because it is:
I'm sorry to hear that this has caused inconvenience to your plugin, but I don't see enough justification to revert this change. In my opinion, the only reason we should reconsider this is if the assumption in p.5 turns out to be wrong. If many users report serious problems, even though they didn't rely on this behavior and are not constrained by the need to maintain compatibility with older engine versions. As for addons, I think the problem may be that you want to have one version of the addon compatible with many engine versions. You could adapt the engine workflow: have a Note that using any new engine feature makes the addon incompatible with older engine versions. For example, 4.4 introduces typed dictionaries. If you use them, this will make your addon incompatible with 4.3, just like using Also note that this change has a positive consequence. Users who unintentionally ignored warnings for an entire function will now see them. From this perspective, the change was a bugfix, not a regression. |
@dalexeev thanks for the very detailed explanation.
I am with you on this reasoning, as much as it hurts. I found the option to disable the warnings of the entire function or class quite practical, but yes, it is stricter this way, and you are now “forced” to take a closer look at the problem areas. Nevertheless, I see a bug here, as the editor console output differs from the system console and is even logged as an error. |
|
Tested versions
System information
Windows 11
Issue description
I updated my CI-PR workflow to Godot4.4dev7 and it fails now
It reports now the warning and is ignoring the
@warning_ignore("unsafe_method_access")
[Ignore]Line 13 (UNSAFE_METHOD_ACCESS):The method "line_number()" is not present on the inferred type "Node" (but may be present on a subtype).
The annotation was working before on function signature level but is now ignored, this is a regression
Steps to reproduce
Minimal reproduction project (MRP)
n/a
The text was updated successfully, but these errors were encountered: