1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00
Commit Graph

105 Commits

Author SHA1 Message Date
Aaron Franke
b73597292b Improve error messages for lambda functions without a body 2025-08-18 06:29:20 -07:00
Aaron Franke
1085200f51 GDScript: Replace abstract keyword with @abstract annotation
Co-authored-by: Danil Alexeev <dalexeev12@yandex.ru>
2025-06-23 12:24:45 -07:00
Danil Alexeev
ee121ef80e GDScript: Add support for variadic functions 2025-06-09 21:53:05 +03:00
Danil Alexeev
a7cf2069d5 GDScript: Add abstract methods
Co-authored-by: ryanabx <ryanbrue@hotmail.com>
2025-06-09 20:11:58 +03:00
Aaron Franke
067704f1cd Add a keyword for abstract classes in GDScript
Co-authored-by: Danil Alexeev <danil@alexeev.xyz>
2025-05-02 00:03:04 -07:00
Rémi Verschelde
682c5c7d49 GDScript: Fix failing tests due to collision with #99490 formatting change 2024-11-29 23:10:02 +01:00
Rémi Verschelde
b3a44a5567 Merge pull request #99490 from dalexeev/gds-tests-track-multiple-errors
GDScript: Support tracking multiple analyzer and runtime errors in tests
2024-11-29 22:02:02 +01:00
Danil Alexeev
03b05cf9ac Core: Fix built-in enum constant bindings 2024-11-22 14:03:21 +03:00
Danil Alexeev
f86dcd4e67 GDScript: Support tracking multiple analyzer and runtime errors in tests 2024-11-21 22:09:50 +03:00
Thaddeus Crews
9853a69144 Implement typed dictionaries 2024-09-04 10:27:26 -05:00
rune-scape
6e8fa6dd50 GDScript: Fix common mismatched external parser errors 2024-07-31 12:54:16 -07:00
Danil Alexeev
8122a27eac GDScript: Fix access non-static members in static context 2024-05-01 19:55:40 +03: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 +02: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
Danil Alexeev
6e996a597f GDScript: Fix UNSAFE_CAST warning 2023-10-27 12:42:00 +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
Danil Alexeev
0c2202c56e GDScript: Fix incorrect error message for utility functions 2023-10-16 14:09:57 +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
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
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
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
ocean (they/them)
729c9b4d4b GDScript: Add check for super() methods not being implemented 2023-09-17 16:21:28 -04:00
Rémi Verschelde
5c43e4c1ef Fix various typos with codespell
Using 2.2.6.dev180+ge3a2cfbd.
2023-09-12 08:54:18 +02: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
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
Aaron Franke
6a8a9cd279 Change GDScript tests to use InstancePlaceholder as the example abstract 2023-07-15 18:28:08 -05: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
Danil Alexeev
aebbbda080 GDScript: Fix some bugs with static variables and functions 2023-06-16 22:52:11 +03: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
Danil Alexeev
3bf72be625 GDScript: Fix calling static func from non-static is allowed 2023-05-17 10:25:03 +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
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
66279b98b6 GDScript: Add missing member type check when resolving extends 2023-04-10 17:16:07 +03: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
4e34cf238a GDScript: Change parser representation of class extends 2023-03-13 01:40:13 +02:00
Danil Alexeev
ea5fd3d732 Fix GDScript code style regarding colon 2023-03-05 17:03:20 +03:00
Dmitrii Maganov
2a08739f30 GDScript: Fix error message for unfound type 2023-02-21 23:00:29 +02: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
ocean (they/them)
c45970739e Fix crash by freed object assign to typed variable 2023-02-16 15:17:46 -05:00