Rémi Verschelde
496b7b8482
Core: Improve vformat error reporting on sprintf failure
...
And fix a few occurrences of formatting errors that led me to this.
2024-07-04 10:54:55 +07:00
Danil Alexeev
18d8838051
GDScript: Fix subscript resolution on constant non-metatype GDScript base
2024-05-30 17:37:05 +07:00
Danil Alexeev
4b692959de
GDScript: Fix lambdas capturing non-local variables
2024-05-22 10:07:31 +07:00
Danil Alexeev
76b2d85c9f
GDScript: Fix some export annotation issues
2024-05-13 17:49:06 +07:00
Rémi Verschelde
7d03b1de0b
Style: Trim trailing whitespace and ensure newline at EOF
...
Found by apply the file_format checks again via #91597 .
2024-05-08 10:12:46 +07:00
Rémi Verschelde
4b070e8031
Fix various typos with codespell
...
Using 2.2.7.dev217+g10c2abcf.
Had to add `colour` to the ignore list as we used it as an alias/keyword for the
documentation of color-related APIs.
Also ignore recommendations to change `thirdparty` to either `third-party` or
`third party`, which are correct but we use the former fairly consistently.
2024-05-07 10:08:42 +07:00
K. S. Ernest (iFire) Lee
f9b488508c
Add PackedVector4Array Variant type
...
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-05-03 00:58:27 +07:00
Rémi Verschelde
a7029e4c8a
Merge pull request #91364 from vnen/gdscript-implicit-ready-base-first
...
GDScript: Call implicit ready on base script first
2024-05-02 17:31:32 +07:00
George Marques
99b702ea3d
GDScript: Call implicit ready on base script first
...
It is generally expected that the base class is called before the
inherited clas. This commit implements this behavior for the implicit
ready function (`@onready` annotation) to make it consistent with the
expectations.
2024-05-02 11:25:52 +07:00
A Thousand Ships
c4e24d2b3b
[GDScript] Correctly report invalid read-only access
2024-05-01 12:28:47 +07:00
Rémi Verschelde
731ea17dd4
Merge pull request #91192 from vnen/gdscript-validated-native-static-calls
...
GDScript: Perform validated calls with static methods
2024-05-01 09:55:04 +07:00
Rémi Verschelde
273a643145
Merge pull request #89647 from AThousandShips/read_only_dict
...
[Core] Fix property access on read-only `Dictionary`
2024-05-01 09:54:48 +07:00
Danil Alexeev
2778069025
GDScript: Fix object iterator opcodes
2024-04-26 09:21:55 +07:00
George Marques
7ca038effa
GDScript: Perform validated calls with static methods
...
When the types are validated at compile time, this type of call runs
faster. It is already used for instance methods, this adds this
optimization to native static methods as well.
2024-04-25 21:19:40 +07:00
Danil Alexeev
4136ed7fc8
GDScript: Fix test `reset_uninit_local_vars.gd` failure
2024-04-24 20:49:52 +07:00
Rémi Verschelde
69a23e64e4
Merge pull request #89990 from dalexeev/gds-reset-uninit-local-vars
...
GDScript: Fix uninitialized local variables not being reset
2024-04-24 18:54:56 +07:00
A Thousand Ships
ec29c3e784
[Core] Fix property access on read-only `Dictionary`
2024-04-22 13:57:34 +07:00
George Marques
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 +07:00
Rémi Verschelde
8611fd8400
Merge pull request #90442 from vnen/gdscript-dont-warn-using-default-builtin
...
GDScript: Don't warn on unassigned for builtin-typed variables
2024-04-10 17:49:44 +07:00
George Marques
877802e252
GDScript: Don't warn on unassigned for builtin-typed variables
...
If the type of a variable is a built-in Variant type, then it will
automatically be assigned a default value based on the type. This means
that the explicit initialization may be unnecessary. Thus this commit
removes the warning in such case.
This also changes the meaning of the unassigned warning to happen when
the variable is used before being assigned, not when it has zero
assignments.
2024-04-10 11:59:57 +07:00
Rémi Verschelde
f8ca571efe
Merge pull request #84043 from dalexeev/gds-fix-unsafe-cast-warning
...
GDScript: Fix `UNSAFE_CAST` warning
2024-04-09 22:24:55 +07:00
kobewi
809c6817be
Add tests for signal await with parameters
2024-04-08 19:12:01 +07:00
Danil Alexeev
27d7760f41
GDScript: Fix uninitialized local variables not being reset
2024-03-30 23:25:30 +07:00
A Thousand Ships
db455e5bee
[Core] Disconnect one-shot signals before calling callbacks
...
This prevents infinite recursion with one-shot connections emitting
themselves
2024-03-20 20:24:44 +07:00
Rémi Verschelde
a1c476f9d7
Merge pull request #87680 from AThousandShips/the_angry_count
...
Add methods to get argument count of methods
2024-03-13 22:16:43 +07:00
Danil Alexeev
ef1909fca3
GDScript: Fix `@warning_ignore` annotation issues
2024-03-12 19:00:06 +07:00
A Thousand Ships
59bcc2888c
Add methods to get argument count of methods
...
Added to:
* `Callable`s
* `Object`s
* `ClassDB`
* `Script(Instance)`s
2024-03-10 11:02:43 +07:00
A Thousand Ships
1e61e42250
[GDScript] Fix some test file paths
2024-03-04 19:11:28 +07:00
Danil Alexeev
d90c9db27f
Core: Add `Callable.create` static method for `Variant` callables
2024-02-29 10:45:00 +07:00
Rémi Verschelde
21ee3716c2
Merge pull request #82122 from dalexeev/gds-add-export-hidden-annotation
...
GDScript: Add `@export_storage` annotation
2024-02-27 21:22:49 +07:00
emre0altan
081fa324fd
set has_type false if it is BUILTIN but Variant::NIL
2024-02-11 13:47:12 +07:00
Rémi Verschelde
9572cf5ab2
Merge pull request #86823 from dalexeev/gds-utility-func-as-callable
...
GDScript: Allow utility functions to be used as `Callable`
2024-01-30 17:47:50 +07:00
George Marques
b4e08eb752
Allow `free()` to be used as Callable
...
This method is registered in a special way so ClassDB doesn't naturally
know about its existence. Here it is hardcoded if any other option fail
to check if it is about the `free()` method and, if so, say it exists
and return a Callable.
2024-01-18 09:33:44 +07:00
Danil Alexeev
b31acb0cd5
GDScript: Allow utility functions to be used as `Callable`
2024-01-05 21:16:53 +07:00
Rémi Verschelde
2bffa3cbc5
Merge pull request #82639 from golfinq/gdscript-improve-indexing-error
...
GDScript: Improve error messages for invalid indexing
2024-01-04 16:38:58 +07:00
Rémi Verschelde
2e1725bef6
Merge pull request #86088 from dalexeev/gds-fix-static-func-as-callable-in-static-context
...
GDScript: Fix accessing static function as `Callable` in static context
2024-01-02 18:05:16 +07:00
Danil Alexeev
3a3a2011f4
GDScript: Add `@export_storage` annotation
2023-12-19 20:56:30 +07:00
Danil Alexeev
10dcb21d8b
GDScript: Fix accessing static function as `Callable` in static context
2023-12-12 22:19:39 +07:00
Danil Alexeev
6e996a597f
GDScript: Fix `UNSAFE_CAST` warning
2023-10-27 12:42:00 +07:00
Danil Alexeev
b04263644c
Core: Allow methods of built-in `Variant` types to be used as Callables
2023-10-25 15:53:52 +07:00
Danil Alexeev
0c2202c56e
GDScript: Fix incorrect error message for utility functions
2023-10-16 14:09:57 +07:00
George Marques
4a7d49a89a
GDScript: Replace ptrcalls on MethodBind to validated calls
...
This improves the performance of typed calls to engine methods when the
argument types are exact.
Using validated calls delegate more of the work the core instead of
doing argument unpacking in the VM. It also does not need different
instructions for each return type, simplifying the code.
2023-10-06 11:15:44 +07:00
Danil Alexeev
ed0b3c08e1
Core: Fix `Object::has_method()` for script static methods
2023-10-04 19:44:32 +07:00
Rémi Verschelde
5efbed51cc
GDScript: Improve error messages for invalid indexing
...
These errors are very common when using an invalid property name
or calling on an object of the wrong type, and the previous message
was a bit cryptic for users.
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
Co-authored-by: golfinq <golfinqz@gmail.com>
2023-10-02 14:23:11 +07:00
Danil Alexeev
ba96d4f631
GDScript: Fix `UNSAFE_CALL_ARGUMENT` warning for `Variant` constructors
2023-09-30 13:57:09 +07:00
Yuri Sizov
78483a1df2
Merge pull request #82186 from dalexeev/gds-fix-property-duplication
...
GDScript: Fix duplication of inherited script properties
2023-09-28 20:04:18 +07:00
Yuri Sizov
73252669b1
Merge pull request #82030 from dalexeev/gds-make-for-loop-array-literal-typed
...
GDScript: Make array literal typed if `for` loop variable type is specified
2023-09-28 20:04:12 +07:00
Yuri Sizov
813cd1dfc8
Merge pull request #80085 from vnen/gdscript-pattern-guards
...
GDScript: Implement pattern guards for match statement
2023-09-28 20:03:57 +07:00
George Marques
54a1414500
GDScript: Implement pattern guards for match statement
...
Within a match statement, it is now possible to add guards in each
branch:
var a = 0
match a:
0 when false: print("does not run")
0 when true: print("but this does")
This allows more complex logic for deciding which branch to take.
2023-09-27 11:25:25 +07:00
Danil Alexeev
16e860bcb3
GDScript: Fix duplication of inherited script properties
2023-09-23 15:30:23 +07:00
Danil Alexeev
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 +07:00
Danil Alexeev
3c35e7f1d6
GDScript: Make array literal typed if `for` loop variable type is specified
2023-09-21 11:25:59 +07:00
Danil Alexeev
b1eb737719
GDScript: Fix some lambda bugs
2023-09-14 14:22:23 +07:00
Danil Alexeev
462d8f4752
GDScript: Fix `get_*_list()` methods return incorrect info
2023-09-04 00:21:03 +07:00
Danil Alexeev
6c59ed9485
GDScript: Add static typing for `for` loop variable
2023-08-17 20:54:34 +07:00
Danil Alexeev
f19377160c
GDScript: Fix regression with native signal not found
2023-08-02 15:42:36 +07:00
Yuri Sizov
efbff1369a
Merge pull request #78254 from dalexeev/gds-fix-property-group-name-conflict
...
GDScript: Fix conflict between property and group names
2023-07-31 21:01:03 +07:00
Rémi Verschelde
faf3faa8c8
Merge pull request #77744 from dalexeev/gds-reset-block-locals-on-exit
...
GDScript: Reset local variables on exit from block
2023-06-21 21:51:05 +07:00
Rémi Verschelde
248e5245e4
Merge pull request #73540 from mashumafi/fix-typed-array-add
...
Fix: Typed arrays aren't working with +
2023-06-20 15:12:39 +07:00
Danil Alexeev
a0577eb23b
GDScript: Fix `_get_script_name()` function collision for SCU build
2023-06-20 12:03:54 +07:00
Rémi Verschelde
c211c22abc
Merge pull request #78389 from rune-scape/rune-match-stringnames
...
GDScript: Strings and StringNames match
2023-06-19 21:18:42 +07:00
Rémi Verschelde
ae00187b58
Merge pull request #77129 from dalexeev/gds-fix-static-var-bugs-part-1
...
GDScript: Fix some bugs with static variables and functions
2023-06-19 21:18:18 +07:00
Rémi Verschelde
4db1d09bf5
Merge pull request #73657 from mashumafi/callable-ctor
...
Fix: Get constructor as Callable
2023-06-18 16:27:42 +07:00
Danil Alexeev
aebbbda080
GDScript: Fix some bugs with static variables and functions
2023-06-16 22:52:11 +07:00
Danil Alexeev
bf8f996212
GDScript: Fix conflict between property and group names
2023-06-15 08:36:10 +07:00
rune-scape
fcdd926881
GDScript: Strings and StringNames match
2023-06-14 19:24:28 +07:00
Rémi Verschelde
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 +07:00
Rémi Verschelde
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 +07:00
Rémi Verschelde
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 +07:00
Danil Alexeev
f3bf75fbb4
GDScript: Reset local variables on exit from block
2023-06-02 13:20:19 +07:00
George Marques
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 +07:00
George Marques
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 +07:00
Ninni Pipping
e5365da03c
[GDScript] Fix incorrect compound assignment
...
Reverts in-place compound assignments
Added test to ensure correctness
2023-04-14 11:28:44 +07:00
Dmitrii Maganov
8655d979a1
GDScript: Allow elements of a parent class in a typed array literal
2023-03-28 13:47:24 +07:00
Danil Alexeev
c0eeb32e38
GDScript: Fix false positive `REDUNDANT_AWAIT` warning
2023-03-16 14:04:14 +07:00
Danil Alexeev
ea5fd3d732
Fix GDScript code style regarding colon
2023-03-05 17:03:20 +07:00
Rémi Verschelde
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 +07:00
Rémi Verschelde
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 +07:00
George Marques
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 +07:00
Dmitrii Maganov
281c8c75d3
GDScript: Fix conversions from native members accessed by identifier
2023-02-25 10:53:36 +07:00
George Marques
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 +07:00
Rémi Verschelde
a6baebc7c2
Fixup GDScript test using non-deterministic ids
...
Follow-up to #73870 .
2023-02-24 14:31:36 +07:00
George Marques
6f2a8434c6
GDScript: Fix groups and categories been seen as members
2023-02-24 10:03:12 +07:00
mashumafi
2a12213c31
Fix: Typed arrays aren't working with +
2023-02-22 18:42:26 +07:00
mashumafi
8eb837dc3d
Add test for const class references
2023-02-20 23:01:32 +07:00
mashumafi
b39b4010bd
Fix: Get constructor as Callable
2023-02-20 22:05:54 +07:00
mashumafi
30d4d3fa5e
Fix: Func with typed args error when arg is null
2023-02-19 21:47:48 +07:00
Rémi Verschelde
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 +07:00
Adam Scott
0fef203b1f
Remove script class checks when getting function signature
2023-02-07 11:48:10 +07:00
George Marques
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 +07:00
Dmitrii Maganov
5909f9f075
GDScript: Fix issues with typed arrays
2023-01-31 11:54:41 +07:00
George Marques
aee7b7363b
GDScript: Avoid calling non-static methods on native classes
2023-01-28 20:33:01 +07:00
Dmitrii Maganov
abe6d67232
GDScript: Fix test for read-only state of constants
2023-01-27 05:28:08 +07:00
Danil Alexeev
b004f8180e
GDScript: Allow constant expressions in annotations
2023-01-25 18:43:56 +07:00
Dmitrii Maganov
40613ebd21
GDScript: Fix typing of iterator in for loop
2023-01-13 15:36:11 +07:00
Adam Scott
e3e55b29ce
Add default virtual `gdscript://` path to `GDScript` instances
2023-01-12 10:27:38 +07:00
George Marques
75515e4303
Merge pull request #70987 from vonagam/fix-parameter-conversion-assign
2023-01-12 11:34:13 +07:00
George Marques
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 +07:00
Rémi Verschelde
5eb161a9c8
Merge pull request #70595 from adamscott/add-gdscript-editorconfig
...
Add GDScript `.editorconfig` rules
2023-01-11 01:10:10 +07:00
George Marques
04d0e851ea
GDScript: Fix use of conversion assign for variant values
2023-01-10 20:01:11 +07:00