George Marques
80ba1e0614
GDScript: Load global classes when running debug tests
...
So when running compiler debug tests it works with dependencies within a
project.
2023-07-13 13:05:42 -03:00
Rémi Verschelde
8a06ec979e
Change explicit 'Godot 4.0' references to 'Godot 4'
...
Fixes #79276 .
2023-07-10 13:08:11 +02: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 +02:00
ocean (they/them)
6c28b8edd3
GDScript: fix regression when checking for virtual function implementation.
...
Unfortunately it appears the virtual function checks in #77324 are not
trustworthy at runtime, because objects can have scripts attached, but
this information is not always available at compile-time. These checks
need to be removed.
The rest of the PR is still useful, making all method flags available to
the analyzer, so a full revert isn't necessary/desirable.
This reopens #76938 , which will need another solution.
2023-06-21 15:13:45 -04:00
今井きなみ
bf04c55175
Fix lambda parsing continuing on subsequent lines #73273
2023-06-21 12:56:57 +02: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 +02:00
Danil Alexeev
a0577eb23b
GDScript: Fix _get_script_name()
function collision for SCU build
2023-06-20 12:03:54 +03: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 +02: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 +02:00
Rémi Verschelde
1a62f1e4fc
Merge pull request #74741 from vnen/variant-not-for-everyone
...
Allow boolean operators for all Variant types
2023-06-18 16:28:10 +02:00
Rémi Verschelde
4db1d09bf5
Merge pull request #73657 from mashumafi/callable-ctor
...
Fix: Get constructor as Callable
2023-06-18 16:27:42 +02:00
Rémi Verschelde
1ce2425c0e
Merge pull request #73363 from dalexeev/gds-fix-min-int-not-representable
...
GDScript: Fix `MIN_INT` not representable as numeric literal
2023-06-18 16:27:16 +02:00
Danil Alexeev
aebbbda080
GDScript: Fix some bugs with static variables and functions
2023-06-16 22:52:11 +03:00
Rémi Verschelde
49b774e009
Merge pull request #77324 from anvilfolk/oh-no-its-virtual
...
GDScript: add errors when calling unimplemented virtual functions
2023-06-15 15:26:18 +02:00
Rémi Verschelde
3b4504afea
Merge pull request #75944 from akien-mga/style-modules-includes
...
Style: Harmonize header includes in modules
2023-06-15 15:26:14 +02:00
Rémi Verschelde
12e8bc558d
Merge pull request #73203 from dalexeev/gds-fix-num-literal
...
GDScript: Fix repeated `_` are allowed after decimal point
2023-06-15 15:26:09 +02:00
Rémi Verschelde
25b2f1780a
Style: Harmonize header includes in modules
...
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:
Includes from the platform port or module ("local" includes) should be listed
first in their own block using relative paths, before Godot's "core" includes
which use "absolute" (project folder relative) paths, and finally thirdparty
includes.
Includes in `#ifdef`s come after their relevant section, i.e. the overall
structure is:
- Local includes
* Conditional local includes
- Core includes
* Conditional core includes
- Thirdparty includes
* Conditional thirdparty includes
2023-06-15 14:35:45 +02:00
ocean (they/them)
861743cd04
GDScript: add errors when calling unimplemented virtual functions
...
This PR does a small refactor of how method flags are handled in the GDScript analyzer.
This way, it adds support for the analyzer to use any of MethodInfo's flags, where previously
it could only use METHOD_FLAG_STATIC and METHOD_FLAG_VARARG.
As a side-effect, this also normalizes behavior between editor and release templates, which fixes #76938 .
The tests added also brought a different issue to light, where using `super()` appears to generate a
return variable discarded on calling super's _init(), which doesn't have a return value. This should be
tackled in a different PR, which will have to change the output of this PR's tests.
2023-06-15 07:16:31 -04:00
Rémi Verschelde
3a319daa99
Merge pull request #77351 from anvilfolk/super-discard
...
GDScript: do not RETURN_VALUE_DISCARDED for `super()` inside `_init()`
2023-06-15 10:39:59 +02:00
Danil Alexeev
bf8f996212
GDScript: Fix conflict between property and group names
2023-06-15 08:36:10 +03:00
rune-scape
fcdd926881
GDScript: Strings and StringNames match
2023-06-14 19:24:28 -07:00
Danil Alexeev
fba8cbe6db
GDScript: Fix repeated _
are allowed after decimal point
2023-06-14 21:47:12 +03: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 +02: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 +02: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 +02:00
Danil Alexeev
f3bf75fbb4
GDScript: Reset local variables on exit from block
2023-06-02 13:20:19 +03:00
ocean (they/them)
25c90836fd
GDScript: do not warn of return value discarded for super() inside _init()
...
DO NOT BATCH MERGE WITH #77324 , WILL RESULT IN BROKEN CI
Currently, calling super() inside _init() throws a
RETURN_VALUE_DISCARDED warning. The analyzer identifies super() as being a
constructor, which therefore returns an object of the relevant class.
However, super() isn't really a constructor by itself: in this case, it
is _part_ of the constructor, and so doesn't "return" a value.
A test case for this is already in #77324 , which contains the warning. I
am duplicating it here, without the warning, and it should conflict with
the other PR.
2023-05-22 09:29:34 -04:00
Danil Alexeev
3bf72be625
GDScript: Fix calling static func from non-static is allowed
2023-05-17 10:25:03 +03:00
Danil Alexeev
c2fbb40e9a
GDScript: Fix warning ignoring for member variables
2023-05-12 17:43:58 +03:00
Rémi Verschelde
f37fc4e708
Merge pull request #76412 from dalexeev/gds-reorganize-warnings
...
GDScript: Reorganize and unify warnings
2023-04-28 18:45:48 +02:00
Rémi Verschelde
f374390fc1
Merge pull request #75014 from vonagam/assert-literal-false
...
GDScript: Allow usage of literal false in assert without a warning
2023-04-28 18:45:00 +02:00
Danil Alexeev
13310f3557
GDScript: Reorganize and unify warnings
2023-04-28 18:25:11 +03: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 -03:00
Rémi Verschelde
352ebe9725
Merge pull request #76483 from vnen/gdscript-dont-fail-returning-freed-object
...
GDScript: Don't fail when freed object is return
2023-04-27 08:47:04 +02:00
George Marques
221deb1cc1
GDScript: Use default path in test generator if not provided
...
Since it's almost always used with the same path, assume it is running
from the Godot source root.
2023-04-26 11:12:47 -03: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 -03:00
Rémi Verschelde
45cd5dcad3
Merge pull request #75885 from AThousandShips/compound_fix
...
[GDScript] Fix incorrect compound assignment
2023-04-25 16:17:02 +02:00
Rémi Verschelde
54b0e8123e
Merge pull request #75605 from anvilfolk/type-base
...
Make GDScript type not found errors more informative.
2023-04-24 16:43:32 +02:00
Danil Alexeev
dbc3c82043
GDScript: Add some checks for @tool
and @icon
2023-04-20 07:44:10 +03:00
Yuri Sizov
6596a6c1b5
Merge pull request #72979 from dalexeev/gds-annotation-parsing
...
GDScript: Fix and improve annotation parsing
2023-04-17 17:14:58 +02:00
Yuri Sizov
d220680bd0
Merge pull request #62830 from ajreckof/access-identifier-keywords
...
fix access to identifiers that are reserved keywords
2023-04-17 17:12:10 +02:00
ajreckof
ab9f60dd1a
fix access to identifiers that are reserved keywords
2023-04-14 20:37:24 +02:00
Danil Alexeev
5038a336be
GDScript: Fix and improve annotation parsing
2023-04-14 21:28:46 +03: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 +02:00
Danil Alexeev
66279b98b6
GDScript: Add missing member type check when resolving extends
2023-04-10 17:16:07 +03:00
VolTer
f832eb92e4
Fix mistakes in documentation and GDScript errors
2023-04-10 10:00:09 +02:00
ocean (they/them)
5d164df4e1
Make type not found errors more informative.
...
This PR removes a check for whether a datatype is a meta type when
generating a datatype's to_string() result. This means that error
messages that fail to find the type will now print their class names,
which is much more useful when trying to identify errors.
2023-04-02 18:30:30 -04:00
Dmitrii Maganov
8655d979a1
GDScript: Allow elements of a parent class in a typed array literal
2023-03-28 13:47:24 +03:00
Yuri Sizov
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
Yuri Sizov
5461b9976c
Merge pull request #74844 from vonagam/change-class-extends-parsing
...
GDScript: Change parser representation of class extends
2023-03-20 19:13:23 +01:00
Dmitrii Maganov
5d0b183822
GDScript: Allow usage of literal false in assert without a warning
2023-03-17 05:37:56 +02:00
Danil Alexeev
c0eeb32e38
GDScript: Fix false positive REDUNDANT_AWAIT
warning
2023-03-16 14:04:14 +03:00
Dmitrii Maganov
4e34cf238a
GDScript: Change parser representation of class extends
2023-03-13 01:40:13 +02:00
Dmitrii Maganov
703274fd04
GDScript: Fix missing warning for shadowing of built-in types
2023-03-13 00:49:34 +02:00
George Marques
d76b3f2a4c
GDScript: Allow boolean operators between any types
...
To make consistent with previous behavior. Mostly to be used in
conditions for `if` and `while`.
2023-03-10 16:01:17 -03:00
Danil Alexeev
ea5fd3d732
Fix GDScript code style regarding colon
2023-03-05 17:03:20 +03:00
Rémi Verschelde
491ded1898
Minor typo and docs URL fixes
2023-02-28 13:38:01 +01: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 +01: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 +01: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 -03:00
Dmitrii Maganov
281c8c75d3
GDScript: Fix conversions from native members accessed by identifier
2023-02-25 10:53:36 +02: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 -03:00
George Marques
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
Rémi Verschelde
a6baebc7c2
Fixup GDScript test using non-deterministic ids
...
Follow-up to #73870 .
2023-02-24 14:31:36 +01:00
Rémi Verschelde
7e00cc1f7a
Merge pull request #73870 from vnen/gdscript-dont-reference-group-properties
...
GDScript: Fix groups and categories been seen as members
2023-02-24 14:08:20 +01:00
George Marques
6f2a8434c6
GDScript: Fix groups and categories been seen as members
2023-02-24 10:03:12 -03:00
Dmitrii Maganov
55c5774be9
GDScript: Fix range regression
2023-02-24 00:35:11 +02:00
Rémi Verschelde
76d80c2cba
Merge pull request #73798 from vonagam/fix-bad-continue-in-lambda
...
GDScript: Fix parsing unexpected break/continue in lambda
2023-02-23 13:54:56 +01:00
Dmitrii Maganov
b0b1eaeb6d
GDScript: Fix parsing unexpected break/continue in lambda
2023-02-23 10:49:06 +02:00
Dmitrii Maganov
7ee011051a
GDScript: Fix usage of enum value as range argument
2023-02-23 10:38:53 +02:00
mashumafi
2a12213c31
Fix: Typed arrays aren't working with +
2023-02-22 18:42:26 -05:00
Rémi Verschelde
56622b8ec3
Merge pull request #73709 from vonagam/fix-error-message-unfound-type
...
GDScript: Fix error message for unfound type
2023-02-21 23:36:29 +01:00
Rémi Verschelde
d4bec5855e
Merge pull request #73705 from anvilfolk/doublewoopsie
...
Added check for null objects in gdscript typed assign.
2023-02-21 23:36:06 +01:00
Dmitrii Maganov
2a08739f30
GDScript: Fix error message for unfound type
2023-02-21 23:00:29 +02:00
ocean (they/them)
9ddf482a06
Added check for null objects in gdscript typed assign.
2023-02-21 15:29:07 -05:00
George Marques
1731010774
GDScript: Fix override signature check of script inheritance
...
Avoid treating the super class as a meta type for signature check, since
it is looking at the instance level for that.
2023-02-21 14:37:08 -03:00
mashumafi
8eb837dc3d
Add test for const class references
2023-02-20 23:01:32 -05:00
mashumafi
b39b4010bd
Fix: Get constructor as Callable
2023-02-20 22:05:54 -05:00
Rémi Verschelde
2057d7344e
Merge pull request #73590 from vnen/gdscript-global-scope-enums
...
Make global scope enums accessible as types in GDScript
2023-02-20 15:41:45 +01:00
Rémi Verschelde
ea2bc9795c
Merge pull request #73544 from mashumafi/fix-func-arg-null
...
Fix: Func with typed args error when arg is null
2023-02-20 15:41:40 +01:00
Rémi Verschelde
561d949739
Merge pull request #73489 from vonagam/type-check-node
...
GDScript: Rework type check
2023-02-20 15:41:36 +01:00
mashumafi
30d4d3fa5e
Fix: Func with typed args error when arg is null
2023-02-19 21:47:48 -05:00
George Marques
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
Dmitrii Maganov
8fe023ad93
GDScript: Rework type check
2023-02-17 19:57:18 +02:00
ocean (they/them)
9eb4d1e4bf
Fix inability to assign null regression
...
Co-authored-by: Dmitry Maganov <vonagam@gmail.com>
2023-02-17 11:45:56 -05:00
Yuri Sizov
6e0dd6beca
Merge pull request #72925 from vonagam/fix-enum-typed-array-error
...
GDScript: Fix error about enum typed arrays
2023-02-17 16:47:50 +03:00
Rémi Verschelde
68807165f4
Merge pull request #73398 from anvilfolk/fix-getter
...
Fix unset getter return types resulting in strange behavior
2023-02-17 00:31:42 +01:00
ocean (they/them)
c45970739e
Fix crash by freed object assign to typed variable
2023-02-16 15:17:46 -05:00
ocean (they/them)
94dfac8da7
Add return type for GDScript getters
2023-02-15 17:54:38 -05:00
Danil Alexeev
d15511725a
GDScript: Fix MIN_INT
not representable as numeric literal
2023-02-15 17:41:46 +03:00
Dmitrii Maganov
9cb2da89d6
GDScript: Fix usage of ints with typed array of floats
2023-02-13 22:06:38 +02:00
Rémi Verschelde
dc7f08b556
Merge pull request #72971 from vnen/gdscript-multiline-comment
...
GDScript: Allow strings as multiline comments
2023-02-09 16:19:03 +01:00
George Marques
03ea77407c
GDScript: Be more lenient with identifiers
...
- Allow identifiers similar to keywords if they are in ASCII range.
- Allow constants to be treated as regular identifiers.
- Allow keywords that can be used as identifiers in expressions.
2023-02-09 11:19:05 -03:00
George Marques
f95967c299
GDScript: Allow strings as multiline comments
...
Bring back the behavior in 3.x that was left out by oversight.
2023-02-09 10:16:00 -03:00
Dmitrii Maganov
cedc5fa823
GDScript: Fix error about enum typed arrays
2023-02-09 00:31:40 +02: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 +01:00
Adam Scott
0fef203b1f
Remove script class checks when getting function signature
2023-02-07 11:48:10 +01:00
Yuri Sizov
945207885b
Merge pull request #72546 from vonagam/fix-typed-array-can-reference
...
GDScript: Fix can_reference check for typed arrays
2023-02-06 23:32:47 +03:00
Yuri Sizov
c0edea37ef
Merge pull request #72677 from dalexeev/gds-await-infer-type
...
GDScript: Fix `await` type inference
2023-02-06 23:32:28 +03:00
Yuri Sizov
7b86a082be
Merge pull request #72804 from vnen/gdscript-no-onready-without-node
...
GDScript: Fix inheritance check of @onready for inner classes
2023-02-06 23:03:44 +03:00