Commit Graph

531 Commits

Author SHA1 Message Date
d201df1ffa Merge pull request #72512 from vonagam/fix-ternary-type-source
GDScript: Fix type certainty for result of ternary operator
2023-02-06 19:41:27 +03:00
13f0158e49 Merge pull request #72608 from vnen/gdscript-warning-default-error
GDScript: Add warnings that are set to error by default (take 2)
2023-02-05 16:00:26 +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
5fc7918594 GDScript: Improve usability of setter chains
- Consider PackedArrays non-shared since they are copied on C++/script
  boundaries.
- Add error messages in the analyzer when assigning to read-only
  properties.
- Add specific error message at runtime when assignment fails because
  the property is read-only.
2023-02-02 10:20:35 -03:00
7b04e3865a GDScript: Fix getting reduced value of incomplete subscript 2023-02-02 02:15:26 +02:00
1a810ff45e GDScript: Fix type certainty for result of ternary operator 2023-02-01 14:52:29 +02: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
925784df03 Merge pull request #72454 from dalexeev/gds-fix-icon-annotation
GDScript: Fix `@icon` annotation
2023-01-31 15:58:49 +01:00
6d9c9d30b9 Merge pull request #72206 from vnen/gdscript-allow-void-return-shorthand
GDScript: Allow void functions to return calls to other void functions
2023-01-31 15:55:35 +01:00
361f3f1721 Merge pull request #57520 from jordigcs/gd-rename-map
Add hint for identifiers renamed from 3.x to 4.0
2023-01-31 15:55:25 +01:00
83cb968965 GDScript: Fix @icon annotation 2023-01-31 17:43:54 +03:00
a47d4d57ca GDScript: Allow void functions to return calls to other void functions 2023-01-31 11:37:30 -03:00
5909f9f075 GDScript: Fix issues with typed arrays 2023-01-31 11:54:41 +02:00
a2817eca03 Merge pull request #72175 from dalexeev/gds-fix-export-group-annotations
GDScript: Fix broken export group annotations
2023-01-30 10:00:54 +01:00
a3dae9e548 Merge pull request #72285 from vnen/gdscript-variable-match
GDScript: Allow variables in match patterns
2023-01-29 02:45:48 +01:00
4011a0915e Merge pull request #71844 from vonagam/fix-constant-conversions
GDScript: Fix constant conversions
2023-01-29 02:18:57 +01:00
c68b2358d5 GDScript: Allow variables in match patterns
To restore an ability available in 3.x and reduce compatibility changes.
2023-01-28 19:53:27 -03:00
31e0ae2012 GDScript: Fix constant conversions 2023-01-29 00:01:53 +02:00
6194a7e0fa GDScript: Fix implicit conversions for function returns 2023-01-28 23:56:07 +02:00
cc6e8379d4 Merge pull request #69163 from vonagam/variant-safe-lines
GDScript: Fix wrong marking of some lines related to Variant as unsafe
2023-01-28 15:40:19 +01:00
1d68ce2cce GDScript: Fix broken export group annotations 2023-01-27 16:25:15 +03:00
abe6d67232 GDScript: Fix test for read-only state of constants 2023-01-27 05:28:08 +02:00
a5c211641f Merge pull request #71634 from dalexeev/gds-annotations-analyzer
GDScript: Allow constant expressions in annotations
2023-01-26 01:07:00 +01:00
944b44243d Merge pull request #72008 from vonagam/fix-property-access-unsafe-mark
GDScript: Fix marking of line with unsafe property access as unsafe
2023-01-26 01:04:57 +01:00
b004f8180e GDScript: Allow constant expressions in annotations 2023-01-25 18:43:56 +03:00
e93266b9ff Merge pull request #71120 from jordigcs/ternary
Closes https://github.com/godotengine/godot/issues/71065
2023-01-25 12:23:11 -03:00
41e5f5b093 Merge pull request #71349 from vonagam/disallow-infer-on-weak
GDScript: Disallow type inference with untyped initializer
2023-01-25 14:42:20 +01:00
3c308f42e2 GDScript: Fix marking of line with unsafe property access as unsafe 2023-01-25 01:45:40 +02:00
bb9a00889a Add hint for identifiers renamed since Godot 3 2023-01-24 12:33:55 -06:00
2e488072d0 Allow standalone ternary expressions 2023-01-19 14:27:57 -06:00
4854e723be Fix unnammed enum crash regression 2023-01-18 09:35:48 -05:00
4005fc4b8d Merge pull request #71279 from vonagam/fix-iterator-number-type
GDScript: Fix typing of iterator in for loop
2023-01-16 22:21:26 +01:00
48e041458f Fix cyclic reference errors while reducing identifiers.
Co-authored-by: Dmitrii Maganov <vonagam@gmail.com>
2023-01-15 19:19:25 -05:00
a1e0281b45 GDScript: Disallow type inference with untyped initializer 2023-01-13 20:51:29 +02:00
40613ebd21 GDScript: Fix typing of iterator in for loop 2023-01-13 15:36:11 +02:00
3a5e41293c GDScript: Fix infinite recursion in resolution of enum values 2023-01-13 10:17:30 -03:00
aaa5158ff9 Merge pull request #70733 from vonagam/fix-assigning-untyped
GDScript: Fix some issues with assignments that involve untyped things
2023-01-12 20:08:55 +01:00
274d49790d GDScript: Fix extending abstract classes, forbid their construction 2023-01-12 17:47:10 +02:00
ef81b344be GDScript: Fix wrong marking of some lines related to Variant as unsafe 2023-01-12 17:21:33 +02:00
38c214d483 GDScript: Fix some issues with assignments that involve untyped things 2023-01-12 17:07:45 +02:00
5980abbcec GDScript: Fix getting type from PropertyInfo for Variant arguments 2023-01-12 16:47:06 +02:00
75515e4303 Merge pull request #70987 from vonagam/fix-parameter-conversion-assign 2023-01-12 11:34:13 -03:00
0f184379de GDScript: Fix small inconsistencies with resolve_datatype 2023-01-12 15:52:55 +02:00
04d0e851ea GDScript: Fix use of conversion assign for variant values 2023-01-10 20:01:11 -03:00
c894edd4cb Merge pull request #71140 from vonagam/fix-const-index-subscript-type
GDScript: Fix type for index subscript on constant
2023-01-10 07:58:29 +01:00
ff505c9875 GDScript: Fix type for index subscript on constant 2023-01-10 07:10:00 +02:00
fb175d92da Fix GDScript base and outer classes, signals and functions lookup order
- Add outer class lookup test
- Add signal lookup test

Co-authored-by: Dmitrii Maganov <vonagam@gmail.com>
2023-01-09 20:12:10 -05:00
d3fc9d9e41 Merge pull request #71051 from vonagam/consts-are-deep-start
GDScript: Begin making constants deep, not shallow or flat
2023-01-09 23:22:59 +01:00
509da86205 Merge pull request #69590 from anvilfolk/enums
GDScript enum fixes & refactor
2023-01-09 23:10:37 +01:00