Commit Graph

38 Commits

Author SHA1 Message Date
8e8f93cf0c Display correct symbol in warning when unique name is used without @onready annotation
Add tests for `GET_NODE_DEFAULT_WITHOUT_ONREADY` warning with unique nodes

Small modifications to tests
2025-02-06 10:49:08 -08:00
7d65d0a908 GDScript: Add @warning_ignore_start and @warning_ignore_restore annotations 2024-12-06 15:37:02 +03:00
f86dcd4e67 GDScript: Support tracking multiple analyzer and runtime errors in tests 2024-11-21 22:09:50 +03:00
413490c270 Fix analyzer pushing SHADOWED_VARIABLE warning for members shadowed in subclasses
This fixes a bug in the analyzer where it did not push the SHADOWED_VARIABLE_BASE_CLASS
warning for members shadowed by variable in subclass. It does this by comparing the class
which contains the shadowed member with the class containing the variable, and pushing
SHADOWED_VARIABLE only if the classes are the same. Additionally, SHADOWED_VARIABLE_BASE_CLASS
can take an extra symbol which helps to specify the line for non native base class.
2024-11-06 15:04:14 +00:00
d3be91e6ab Merge pull request #89675 from dalexeev/gds-correct-unused-signal-warning
GDScript: Do not produce `UNUSED_SIGNAL` warning for common implicit uses
2024-09-05 18:34:45 +02:00
154049ce17 StringName Dictionary keys
also added 'is_string()' method to Variant
and refactored many String type comparisons to use it instead
2024-08-29 13:39:27 -07:00
4e051ff6f7 Merge pull request #78178 from dalexeev/gds-add-non-tool-extends-tool-error
GDScript: Add warning if non-`@tool` class extends `@tool` class
2024-08-28 13:14:13 +02:00
638148a184 GDScript: Fix false positive cases of ENUM_VARIABLE_WITHOUT_DEFAULT 2024-07-22 21:45:01 +03:00
3f52871f70 GDScript: Add warning if non-@tool class extends @tool class 2024-07-04 10:31:01 +03:00
d15ed0bcbb GDScript: Fix false positive CONFUSABLE_CAPTURE_REASSIGNMENT warnings 2024-06-28 16:41:32 +03:00
68898dbcc9 GDScript: Add CONFUSABLE_CAPTURE_REASSIGNMENT warning 2024-06-28 11:12:01 +03:00
f9048fcd7d GDScript: Warn when enum variable has no default
The default will always be set to `0`, so if it's not a valid value in
the enum, the warning is shown.
2024-04-16 11:46:59 -03:00
f8ca571efe Merge pull request #84043 from dalexeev/gds-fix-unsafe-cast-warning
GDScript: Fix `UNSAFE_CAST` warning
2024-04-09 22:24:55 +02:00
d1e2afaae3 GDScript: Do not produce UNUSED_SIGNAL warning for common implicit uses 2024-03-19 17:43:10 +03:00
ef1909fca3 GDScript: Fix @warning_ignore annotation issues 2024-03-12 19:00:06 +03:00
6e996a597f GDScript: Fix UNSAFE_CAST warning 2023-10-27 12:42:00 +03:00
ba96d4f631 GDScript: Fix UNSAFE_CALL_ARGUMENT warning for Variant constructors 2023-09-30 13:57:09 +03:00
aa474c9feb Merge pull request #75988 from dalexeev/gds-unsafe-call-argument
GDScript: Improve call analysis
2023-09-27 19:07:46 +02:00
ceda13720b Check if any global script class is shadowed by a variable 2023-09-26 16:47:17 +08:00
e8696f9961 GDScript: Improve call analysis
* Add missing `UNSAFE_CALL_ARGUMENT` warning.
* Fix `Object` constructor.
* Display an error for non-existent static methods.
2023-09-21 13:36:39 +03:00
ceda960131 Remove REDUNDANT_FOR_VARIABLE_TYPE
Remove REDUNDANT_FOR_VARIABLE_TYPE
2023-09-12 20:04:32 -05:00
6c59ed9485 GDScript: Add static typing for for loop variable 2023-08-17 20:54:34 +03:00
d53fc92b4c GDScript: Fix bug with identifier shadowed below in current scope 2023-07-26 11:26:57 +03:00
13c73500ab Fix for not being able to ignore shadowing warnings on class scope 2023-07-24 17:22:12 -03:00
c2fbb40e9a GDScript: Fix warning ignoring for member variables 2023-05-12 17:43:58 +03:00
13310f3557 GDScript: Reorganize and unify warnings 2023-04-28 18:25:11 +03:00
f832eb92e4 Fix mistakes in documentation and GDScript errors 2023-04-10 10:00:09 +02:00
215893ebca Merge pull request #74949 from dalexeev/gds-fix-await-warning
GDScript: Fix false positive `REDUNDANT_AWAIT` warning
2023-03-20 19:14:15 +01:00
c0eeb32e38 GDScript: Fix false positive REDUNDANT_AWAIT warning 2023-03-16 14:04:14 +03:00
703274fd04 GDScript: Fix missing warning for shadowing of built-in types 2023-03-13 00:49:34 +02:00
defa46bfd1 GDScript: Don't use validated call for vararg methods
Since they may have runtime type validation, we cannot use the validated
call.
2023-02-24 14:06:02 -03:00
75f16b8167 Make global scope enums accessible as types in GDScript
Add functions to CoreConstant so enums can be properly deduced. Also add
the enums in release builds to make consistent with ClassDB enums and
avoid differences in script compilation between debug and release.
2023-02-19 13:00:07 -03:00
273bf7210f 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.
2023-02-02 12:07:25 -03:00
afe3b94ab2 Revert "GDScript: Add warnings that are set to error by default"
This reverts commit a166833bfa.

This caused multiple regressions.
Needs to be redone with more testing before merge.

Fixes #72501.
2023-02-01 10:54:22 +01:00
a166833bfa 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.
2023-02-01 00:05:14 -03:00
31e0ae2012 GDScript: Fix constant conversions 2023-01-29 00:01:53 +02:00
7548e043fc Add support for Unicode identifiers in GDScript
This is using an adapted version of UAX#31 to not rely on the ICU
database (which isn't available in builds without TextServerAdvanced).
It allows most characters used in diverse scripts but not everything.
2023-01-21 13:39:40 -03:00
532ffc30bd GDScript: Fix typing of lambda functions 2023-01-06 16:38:22 +02:00