You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This may be something that should be a compiler warning instead, so feel free to close if it should be. It's possible to define operator methods top-level that are impossible to call:
def+(other)
p! other
end+1# => 1
As well, it's possible to define a method with protected top-level, when the visibility modifier has no effect
Since these methods cannot be called and the visibility restriction makes no sense, I suppose this could find its place in the compiler. Feel free to start adopting it in ameba though.
My personal preference for these (and other things that would give compiler warnings) is to have them in both, due to ameba's integration with dev environments being better + a better system for reporting issues.
nobodywasishere
changed the title
Add Lint/TopLevelOperatorMethod and Lint/UselessVisibilityModifier
Add Lint/UselessDef and Lint/UselessVisibilityModifierJan 31, 2025
This may be something that should be a compiler warning instead, so feel free to close if it should be. It's possible to define operator methods top-level that are impossible to call:
As well, it's possible to define a method with
protected
top-level, when the visibility modifier has no effectSee: crystal-lang/crystal#12360
The text was updated successfully, but these errors were encountered: