Overriding methods, inheriting parameter annotations? #1801
Unanswered
PinewoodPip
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Requires |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Let's say I have a class/interface with a default implementation of a method, then a derived one that attempts to override them - is there a clean way currently of doing this without needing to retype the parameter/return annotations? I understand that in lua it's totally possible to override a function with one with entirely different params, but I feel that if the names and param count is left the same, the extension should use the same annotations and assume it's an override.
The code below illustrates the issue; I'm overriding the two methods while keeping the same parameters; however annotations for the parameters are not inherited. Is there an intended, convenient way of doing this?
Another inconvenience regarding this is that if you do not declare the variable Widget there as a derived class, you will trigger a "duplicate set field" warning which I feel is a bit annoying if you just want to make an "anonymous" class and not define a class name for it. Interestingly, in this case, the hover does display the annotations of the implementation of the method in the base class (whereas if you use @Class it will not), but the parameter types will not work.
Beta Was this translation helpful? Give feedback.
All reactions