diff options
author | George Marques <george@gmarqu.es> | 2023-01-31 22:34:21 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2023-02-01 00:05:14 -0300 |
commit | a166833bfa23a21a7bff196a85a20b014e7c1396 (patch) | |
tree | 93b95bbf2d927fb80150c8807584b9d998c2ce59 /modules/gdscript/tests/scripts/analyzer/features/hard_variants.gd | |
parent | 0810ecaafdbee3ea747219e6ab3a8de5d2216a09 (diff) |
GDScript: Add warnings that are set to error by default
- Adds a list of default levels for all warning so they can be set
individually.
- Add warnings set by default to error for:
- Using `get_node()` without `@onready`.
- Using `@onready` together with `@export`.
- Inferring a static type with a Variant value.
- Overriding a native engine method.
- Adjust how annotations to ignore warnings are treated so they also
apply to method parameters.
- Clean up a bit how ignored warnings are set. There were two sets but
only one was actually being used.
- Set all warnings to the `WARN` level for tests, so they they can be
properly tested.
- Fix enum types in native methods signatures being set to `int`.
- Fix native enums being treated as Dictionary by mistake.
- Make name of native enum types use the class they are defined in, not
the direct super class of the script. This ensures they are always
equal even when coming from different sources.
- Fix error for signature mismatch that was only showing the first
default argument as having a default. Now it shows for all.
Diffstat (limited to 'modules/gdscript/tests/scripts/analyzer/features/hard_variants.gd')
-rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/hard_variants.gd | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/gdscript/tests/scripts/analyzer/features/hard_variants.gd b/modules/gdscript/tests/scripts/analyzer/features/hard_variants.gd index 48a804ff54..b447180ea8 100644 --- a/modules/gdscript/tests/scripts/analyzer/features/hard_variants.gd +++ b/modules/gdscript/tests/scripts/analyzer/features/hard_variants.gd @@ -2,16 +2,18 @@ func variant() -> Variant: return null var member_weak = variant() var member_typed: Variant = variant() +@warning_ignore("inference_on_variant") var member_inferred := variant() func param_weak(param = variant()) -> void: print(param) func param_typed(param: Variant = variant()) -> void: print(param) +@warning_ignore("inference_on_variant") func param_inferred(param := variant()) -> void: print(param) func return_untyped(): return variant() func return_typed() -> Variant: return variant() -@warning_ignore("unused_variable") +@warning_ignore("unused_variable", "inference_on_variant") func test() -> void: var weak = variant() var typed: Variant = variant() |