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
Copy file name to clipboardExpand all lines: modules/gdscript/doc_classes/@GDScript.xml
+10-3Lines changed: 10 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -743,7 +743,7 @@
743
743
<annotationname="@override">
744
744
<returntype="void" />
745
745
<description>
746
-
Mark that the following method overrides the one annotated by [annotation @virtual] from the base class.
746
+
Mark that the following method overrides the one annotated by [annotation @virtual] or modified by [code]abstract[/code] from the base class.
747
747
If you override a method from the base class without this annotation, you will get a warning (or an error).
748
748
[codeblock]
749
749
func _init():
@@ -757,8 +757,15 @@
757
757
class B extends A:
758
758
func test():
759
759
print("B") # Warning (or an error) about overriding a virtual method without explicit overriding.
760
+
761
+
abstract class C:
762
+
abstract func test():
763
+
764
+
class D extends C:
765
+
func test():
766
+
print("D") # Warning (or an error) about overriding an abstract method without explicit overriding.
760
767
[/codeblock]
761
-
You can ignore the warning as long as you know what you are doing.
768
+
Due to that this annotation improves code readability, it is recommended to use it whenever possible. You can ignore the warning as long as you know what you are doing.
762
769
</description>
763
770
</annotation>
764
771
<annotationname="@rpc">
@@ -837,7 +844,7 @@
837
844
func test():
838
845
print("B") # Warning (or an error) about overriding a non-virtual method.
839
846
[/codeblock]
840
-
You can ignore the warning as long as you know what you are doing.
847
+
Due to that this annotation improves code readability, it is recommended to use it whenever possible. You can ignore the warning as long as you know what you are doing.
push_error(R"(The usage of the annotation '@virtual' conflicts with an abstract method. Either remove the '@virtual' annotation or 'abstract' keyword from the method declaration.)");
push_error(R"(The usage of "@virtual" annotation conflicts with the "abstract" keyword. Either remove the "@virtual" annotation or "abstract" keyword from the method's declaration.)", p_annotation);
4444
+
returnfalse;
4445
+
} elseif (method->is_annotated_virtual) {
4443
4446
push_error(R"("@virtual" annotation can only be used once per method.)", p_annotation);
returnvformat(R"*(The method "%s()" overrides a non-virtual method from the base class. This may cause unexpected and unsafe behaviors.)*", symbols[0]);
168
168
case OVERRIDE_WITHOUT_OVERRIDE_ANNOTATION:
169
169
CHECK_SYMBOLS(1);
170
-
returnvformat(R"*(The method "%s()" overrides a virtual method from the base class without the "@override" annotation. Annotating the method with the annotation can better help you understand and clarify the code structure.)*", symbols[0]);
170
+
returnvformat(R"*(The method "%s()" overrides a virtual or an abstract method from the base class without the "@override" annotation. Annotating the method with the annotation can better help you understand and clarify the code structure.)*", symbols[0]);
171
171
case OVERRIDE_INEXISTENT_METHOD_FROM_BASE:
172
172
CHECK_SYMBOLS(1);
173
173
returnvformat(R"*(The method "%s()" is annotated with the "@override" annotation, but the method is not found in the base class. Consider removing the "@override" annotation in this case.)*", symbols[0]);
Copy file name to clipboardExpand all lines: modules/gdscript/tests/scripts/analyzer/features/out_of_order.out
-1Lines changed: 0 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,4 @@
1
1
GDTEST_OK
2
-
~~ WARNING at line 20: (OVERRIDE_NON_VIRTUAL_METHOD) The method "fn()" overrides a non-virtual method from the base class. This may cause unexpected and unsafe behaviors.
~~ WARNING at line 10: (OVERRIDE_NON_VIRTUAL_METHOD) The method "test()" overrides a non-virtual method from the base class. This may cause unexpected and unsafe behaviors.
3
-
~~ WARNING at line 14: (OVERRIDE_WITHOUT_OVERRIDE_ANNOTATION) The method "test()" overrides a virtual method from the base class without the "@override" annotation. Annotating the method with the annotation can better help you understand and clarify the code structure.
3
+
~~ WARNING at line 14: (OVERRIDE_WITHOUT_OVERRIDE_ANNOTATION) The method "test()" overrides a virtual or an abstract method from the base class without the "@override" annotation. Annotating the method with the annotation can better help you understand and clarify the code structure.
4
4
~~ WARNING at line 23: (OVERRIDE_INEXISTENT_METHOD_FROM_BASE) The method "test_()" is annotated with the "@override" annotation, but the method is not found in the base class. Consider removing the "@override" annotation in this case.
5
+
~~ WARNING at line 31: (OVERRIDE_WITHOUT_OVERRIDE_ANNOTATION) The method "test()" overrides a virtual or an abstract method from the base class without the "@override" annotation. Annotating the method with the annotation can better help you understand and clarify the code structure.
0 commit comments