Commit Graph

63 Commits

Author SHA1 Message Date
72b8d397d0 GDScript: Further restrict test error output for C++ errors
MSVC and GCC/Clang also have different function names...
2023-06-14 13:28:52 +02:00
c40adf027d GDScript: Only include script file path in test error output
Errors originating in C++ files cause unnecessary diffs whenever the engine is updated
(line number changes, etc.) and would cause CI failures due to different formatting
of the file path on Windows (backslashes, worked around here anyway) and when using
SCU builds (`../scu` insert).
2023-06-14 10:54:49 +02:00
8b62c52d1c Merge pull request #75419 from vonagam/fix-super-classes-in-array-literals
GDScript: Allow elements of a parent class in a typed array literal
2023-06-14 09:23:32 +02:00
0ba6048ad3 Add support for static variables in GDScript
Which allows editable data associated with a particular class instead of
the instance. Scripts with static variables are kept in memory
indefinitely unless the `@static_unload` annotation is used or the
`static_unload()` method is called on the GDScript.

If the custom function `_static_init()` exists it will be called when
the class is loaded, after the static variables are set.
2023-04-27 09:51:44 -03:00
abbdf80643 GDScript: Don't fail when freed object is return
This is check is a bit too eager. The user should be able to handle the
return value even if it's a freed object.
2023-04-26 10:57:22 -03:00
e5365da03c [GDScript] Fix incorrect compound assignment
Reverts in-place compound assignments

Added test to ensure correctness
2023-04-14 11:28:44 +02:00
8655d979a1 GDScript: Allow elements of a parent class in a typed array literal 2023-03-28 13:47:24 +03:00
c0eeb32e38 GDScript: Fix false positive REDUNDANT_AWAIT warning 2023-03-16 14:04:14 +03:00
ea5fd3d732 Fix GDScript code style regarding colon 2023-03-05 17:03:20 +03:00
c0f1ed57c4 Merge pull request #73915 from vonagam/fix-conversions-from-native-member
GDScript: Fix conversions from native members accessed by identifier
2023-02-26 19:02:27 +01:00
c118790eb9 Merge pull request #73899 from vnen/gdscript-init-defaults-beforehand
GDScript: Initialize all defaults beforehand in implicit constructor
2023-02-26 15:59:27 +01:00
eba984a44f Revert "GDScript: Fix groups and categories been seen as members"
This reverts commit 6f2a8434c6.

The commit introduces a bug where it creates spurious entries for member
information.
2023-02-25 13:40:31 -03:00
281c8c75d3 GDScript: Fix conversions from native members accessed by identifier 2023-02-25 10:53:36 +02:00
0e6aa6fc38 GDScript: Initialize all defaults beforehand in implicit constructor
Set all the default values for typed variables before actually trying to
initialize them, including `@onready` ones.

This ensures that if validated calls are being used there will be a
value of the correct type, even if the resolution is done out of order
or deferred because of `@onready`.
2023-02-24 22:01:06 -03:00
a6baebc7c2 Fixup GDScript test using non-deterministic ids
Follow-up to #73870.
2023-02-24 14:31:36 +01:00
6f2a8434c6 GDScript: Fix groups and categories been seen as members 2023-02-24 10:03:12 -03:00
8eb837dc3d Add test for const class references 2023-02-20 23:01:32 -05:00
30d4d3fa5e Fix: Func with typed args error when arg is null 2023-02-19 21:47:48 -05:00
98921d8fba Revert "Remove script class checks when getting function signature"
This reverts commit 0fef203b1f.

This introduced some other issues, as discussed in #72144.
2023-02-07 16:28:52 +01:00
0fef203b1f Remove script class checks when getting function signature 2023-02-07 11:48:10 +01: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
5909f9f075 GDScript: Fix issues with typed arrays 2023-01-31 11:54:41 +02:00
aee7b7363b GDScript: Avoid calling non-static methods on native classes 2023-01-28 20:33:01 -03:00
abe6d67232 GDScript: Fix test for read-only state of constants 2023-01-27 05:28:08 +02:00
b004f8180e GDScript: Allow constant expressions in annotations 2023-01-25 18:43:56 +03:00
40613ebd21 GDScript: Fix typing of iterator in for loop 2023-01-13 15:36:11 +02:00
e3e55b29ce Add default virtual gdscript:// path to GDScript instances 2023-01-12 10:27:38 -05:00
75515e4303 Merge pull request #70987 from vonagam/fix-parameter-conversion-assign 2023-01-12 11:34:13 -03:00
66fda2aeea GDScript: Fix temp values being written without proper clear
Temporary values in the stack were not being properly cleared when the
return value of calls were discarded, which can cause memory issues
especially for reference types like PackedByteArray.
2023-01-11 14:24:23 -03:00
5eb161a9c8 Merge pull request #70595 from adamscott/add-gdscript-editorconfig
Add GDScript `.editorconfig` rules
2023-01-11 01:10:10 +01:00
04d0e851ea GDScript: Fix use of conversion assign for variant values 2023-01-10 20:01:11 -03:00
44d1d72af1 Add GDScript .editorconfig rules
- Uniformize `.gd` unit test files indentation to tabs (where needed)
2023-01-10 12:25:35 -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
a1309f1f42 GDScript: Allow using await on calls to void functions 2023-01-09 09:55:05 -03:00
a3816434a6 GDScript: Don't use the NIL address to hold return value of functions
This prevents that the NIL address is filled with another value, which
causes problems for some instructions that read from NIL.
2023-01-09 09:20:18 -03:00
5e2ac1a31e GDScript: Begin making constants deep, not shallow or flat 2023-01-08 07:29:10 +02:00
a8c2f8a0e1 GDScript: Fix missing conversion for default argument values 2023-01-06 11:49:06 +02:00
4e360ac612 Merge pull request #70702 from vnen/gdscript-error-on-assign-void
GDScript: Error when assigning return value of void function
2023-01-03 12:23:00 +01:00
0c15844551 GDScript: Error when assigning return value of void function
This also makes built-in method calls empty the return value when the
method is void, to avoid keeping returning a garbage value in such case.
2022-12-30 12:08:58 -03:00
bbb21c3fd5 Fix type adjustment skipped when value is considered both not hard and not variant 2022-12-25 17:11:30 +03:00
907298d673 Merge pull request #68747 from rune-scape/rune-stringname-unification
GDScript: Unify StringName and String
2022-12-09 18:06:48 +01:00
e79be6ce07 Unify String and StringName 2022-12-05 21:46:47 -05:00
97280279ee Fix incomplete shadowing of member properties by parameters 2022-12-06 00:22:56 +02:00
7eb44fa47d Merge pull request #68125 from kleonc/range-fix-single-arg-optimized-type-mismatch
[GDScript] Fix type mismatch in optimized single arg `range`
2022-11-02 14:18:24 +01:00
c268e3a235 GDScript Fix type mismatch in optimized single arg range 2022-11-02 13:20:47 +01:00
d7d130295e Support for checking that Projection is(not) null 2022-11-01 20:49:52 +01:00
6afbf0bd5a Improve dictionary printing to avoid confusion with arrays
- Add leading and trailing spaces within dictionaries, as the `{}`
  characters are hard to distinguish from `[]` on some fonts.
  This is especially helpful with empty arrays and dictionaries.
2022-10-04 20:33:40 +02:00
a0608bd891 Fix set chain bug with jump_if_shared 2022-06-28 18:45:27 +03:00
58fcad20ef quote strings inside arrays and dictionaries 2022-05-03 13:37:13 -05:00
01d13ab2c1 GDScript: Allow using self in lambdas 2022-04-24 21:49:02 -03:00