Rémi Verschelde
ee5ace10b7
Merge pull request #85501 from /remove-packed-scene-cache
2024-02-25 11:49:27 +01:00
Danil Alexeev
a2e3e31e80
GDScript: Fix extension comparison for exported scripts
2024-02-15 17:53:24 +03: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 +01:00
Yuri Sizov
72756133e0
Merge pull request #85224 from HolonProduction/identifier-type-prefer-annotated
...
Prefer identifiers annotated type if assigned type is incompatible to it
2024-01-24 14:07:52 +01:00
Rémi Verschelde
b5dcb5f58a
Merge pull request #85215 from HolonProduction/type-from-property-class-name
...
Handle global classes when resolving type from `PropertyInfo`
2024-01-18 09:33:22 +01:00
HolonProduction
0203b3c310
Prefer identifiers annotated type if assigned type is incompatible to it
2024-01-17 22:32:00 +01:00
HolonProduction
4ab985d138
Handle global classes when resolving type from `PropertyInfo`
2024-01-17 21:39:51 +01:00
Danil Alexeev
b31acb0cd5
GDScript: Allow utility functions to be used as `Callable`
2024-01-05 21:16:53 +03:00
Muller-Castro
96a95cb974
Add const lvalue ref to container parameters
2024-01-05 14:49:57 -03: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 +01:00
Rémi Verschelde
b5c6e870e8
Merge pull request #82264 from dalexeev/core-builtin-methods-as-callables
...
Core: Allow methods of built-in `Variant` types to be used as Callables
2024-01-02 18:05:05 +01:00
Yuri Sizov
38d8ca0dc1
Merge pull request #85703 from TitanNano/jovan/gdscript_foreign_script_properties
...
Make GDScriptAnalyzer aware of properties from other languages
2023-12-19 13:02:19 +01:00
Jovan Gerodetti
030aa41a99
GDScriptAnalyzer is unaware of properties from other Languages
...
Co-authored-by: K. S. Ernest (iFire) Lee <fire@users.noreply.github.com>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2023-12-18 22:03:30 +01:00
Thaddeus Crews
5cf0d772bc
Change container_element_type to vector container
2023-12-05 08:51:49 -06:00
Jordyfel
ef5dcccde7
Stop caching packed scenes in GDScript cache
2023-11-29 12:52:55 +02:00
Danil Alexeev
6e996a597f
GDScript: Fix `UNSAFE_CAST` warning
2023-10-27 12:42:00 +03:00
Danil Alexeev
b04263644c
Core: Allow methods of built-in `Variant` types to be used as Callables
2023-10-25 15:53:52 +03:00
Danil Alexeev
7f4721a941
GDScript: Fix non-static call is allowed in static var lambda body
2023-10-20 20:43:07 +03:00
Rémi Verschelde
109cb8e697
Merge pull request #83455 from Lunarisnia/fix/gdscript-error-typo
...
Fix grammar typo in GDScript error message
2023-10-17 16:13:02 +02:00
Lunarisnia
981c6c94c0
Fix grammar typo in GDScript error message
2023-10-17 01:33:37 +07:00
Rémi Verschelde
ddb7969cb6
Merge pull request #83257 from dalexeev/gds-fix-unresolved-type-for-incomplete-expressions
...
GDScript: Fix unresolved datatype for incomplete expressions
2023-10-16 18:44:27 +02:00
Danil Alexeev
0c2202c56e
GDScript: Fix incorrect error message for utility functions
2023-10-16 14:09:57 +03:00
Danil Alexeev
3ac61aadd7
GDScript: Fix unresolved datatype for incomplete expressions
2023-10-13 12:52:14 +03:00
Danil Alexeev
9e2273abc7
GDScript: Add error when exporting node in non [Node]-derived classes
2023-10-05 13:50:26 +03:00
Rémi Verschelde
7c1abe8599
Merge pull request #82789 from dalexeev/gds-fix-unresolved-type-for-incomplete-bin-op
...
GDScript: Fix unresolved datatype for incomplete binary operator
2023-10-05 10:10:33 +02:00
Danil Alexeev
2c5636c135
GDScript: Fix unresolved datatype for incomplete binary operator
2023-10-04 17:07:37 +03:00
Danil Alexeev
6767de9b69
GDScript: Fix `native_type` is empty for autoload without script
2023-10-04 16:09:18 +03: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 -04:00
Danil Alexeev
ba96d4f631
GDScript: Fix `UNSAFE_CALL_ARGUMENT` warning for `Variant` constructors
2023-09-30 13:57:09 +03:00
Yuri Sizov
b25f1f9c79
Merge pull request #82477 from dalexeev/gds-covariance-and-contravariance
...
GDScript: Add return type covariance and parameter type contravariance
2023-09-28 20:04:37 +02: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 +02: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 +02:00
Danil Alexeev
cb8b89fd95
GDScript: Add return type covariance and parameter type contravariance
2023-09-28 12:27:36 +03:00
Yuri Sizov
aa474c9feb
Merge pull request #75988 from dalexeev/gds-unsafe-call-argument
...
GDScript: Improve call analysis
2023-09-27 19:07:46 +02: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 -03:00
A Thousand Ships
517e9f8aef
[Modules] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable
2023-09-26 16:44:52 +02:00
Rémi Verschelde
9b0b441cf3
Merge pull request #82139 from dalexeev/gds-add-inferred-declaration-warning
...
GDScript: Add `INFERRED_DECLARATION` warning
2023-09-26 16:36:39 +02:00
Chia-Hsiang Cheng
ceda13720b
Check if any global script class is shadowed by a variable
2023-09-26 16:47:17 +08:00
Danil Alexeev
4ce27301d3
GDScript: Add `INFERRED_DECLARATION` warning
2023-09-22 23:13:52 +03:00
Danil Alexeev
10b00bc2ea
GDScript: Prevent constructing and inheriting engine singletons
2023-09-22 17:30:00 +03: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 +03:00
Danil Alexeev
3c35e7f1d6
GDScript: Make array literal typed if `for` loop variable type is specified
2023-09-21 11:25:59 +03:00
Rémi Verschelde
712ebe7d8a
Merge pull request #81332 from dalexeev/gds-fix-update-array-literal-in-weak-context
...
GDScript: Don't make array literal typed in weak type context
2023-09-20 13:09:23 +02:00
Danil Alexeev
c35cb51d74
GDScript: Fix subscript resolution for constant non-metatypes
2023-09-19 22:26:06 +03:00
ocean (they/them)
729c9b4d4b
GDScript: Add check for `super()` methods not being implemented
2023-09-17 16:21:28 -04:00
Rémi Verschelde
e5ac7cf034
Merge pull request #81577 from anvilfolk/thecycleeeeeeeeeeeeesaaaaaaaaaaaaah
...
GDScript: Fix compilation of expressions compiling other classes
2023-09-16 21:23:18 +02:00
ryanabx
ceda960131
Remove REDUNDANT_FOR_VARIABLE_TYPE
...
Remove REDUNDANT_FOR_VARIABLE_TYPE
2023-09-12 20:04:32 -05:00
ocean (they/them)
d330f5642e
GDScript: Fix compilation of expressions compiling other classes
...
This PR is part of ongoing work on fixing cyclic dependencies in the GDScript
compiler.
2023-09-12 11:18:33 -04:00
ryanabx
14edf044af
Add "untyped_declaration" warning
2023-09-11 09:39:10 -05:00
Danil Alexeev
242d3d81e9
GDScript: Don't make array literal typed in weak type context
2023-09-05 11:32:16 +03:00
Danil Alexeev
462d8f4752
GDScript: Fix `get_*_list()` methods return incorrect info
2023-09-04 00:21:03 +03:00
Yuri Sizov
b6c4efe1b1
Merge pull request #80964 from dalexeev/gds-allow-use-local-consts-as-types
...
GDScript: Allow use local constants as types
2023-08-25 21:26:44 +02:00
Danil Alexeev
68a567bd13
GDScript: Allow use local constants as types
2023-08-25 17:04:04 +03:00
Danil Alexeev
89429b0273
GDScript: Fix lambda resolution with cyclic references
2023-08-25 16:29:11 +03:00
Danil Alexeev
6c59ed9485
GDScript: Add static typing for `for` loop variable
2023-08-17 20:54:34 +03:00
Rémi Verschelde
4f00f925b3
Merge pull request #78552 from dalexeev/gds-check-get-node-in-static-func
...
GDScript: Check `get_node()` shorthand in static functions
2023-08-17 11:20:32 +02:00
Danil Alexeev
fb45cab133
GDScript: Fix "Identifier not found" error when accessing inner class from inside
2023-08-11 11:22:01 +03:00
Danil Alexeev
0f27c4ad80
GDScript: Check `get_node()` shorthand in static functions
2023-08-09 17:11:38 +03:00
Danil Alexeev
d53fc92b4c
GDScript: Fix bug with identifier shadowed below in current scope
2023-07-26 11:26:57 +03:00
Yuri Sizov
0e1c9531b5
Merge pull request #75620 from jpcerrone/fix_shadow_warnings_not_going_away_after_ignoring
...
Fix for not being able to ignore shadowing warnings on class scope
2023-07-25 21:25:45 +02:00
jpcerrone
13c73500ab
Fix for not being able to ignore shadowing warnings on class scope
2023-07-24 17:22:12 -03:00
rune-scape
83b01708b2
Script editor: Show depended script errors
2023-07-24 15:49:39 +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
Yuri Sizov
f1e79e2581
Make container element type comparison safe
2023-06-20 17:04: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
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
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
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
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
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
7da3110e6b
GDScript: Fix `validate_call_arg()` for unresolved datatype
2023-05-15 12:13:52 +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
Yuri Sizov
a7276f1ce0
Merge pull request #75691 from dalexeev/gds-fix-signature-generation
...
GDScript: Misc fixes and improvements for signature generation
2023-04-14 20:01:27 +02:00
Danil Alexeev
66279b98b6
GDScript: Add missing member type check when resolving `extends`
2023-04-10 17:16:07 +03:00
Danil Alexeev
9df96e97ea
GDScript: Misc fixes and improvements for signature generation
...
* Use type hints for `@GlobalScope` enums.
* Use plain `int` for `BitMask<T>`.
* Fix type hints for typed arrays.
* Use `Variant` and `void` type hints.
* Discard unnecessary class prefix.
2023-04-07 10:43:21 +03: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
Dmitrii Maganov
638aa4f811
GDScript: Fix wrong unsafety mark for binary operator
2023-02-26 01:35:53 +02:00
Dmitrii Maganov
55c5774be9
GDScript: Fix range regression
2023-02-24 00:35:11 +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
Dmitrii Maganov
2a08739f30
GDScript: Fix error message for unfound type
2023-02-21 23:00:29 +02:00
Rémi Verschelde
253396ba39
Merge pull request #73693 from vnen/gdscript-fix-script-signature-check
...
GDScript: Fix override signature check of script inheritance
2023-02-21 21:19:39 +01: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