Commit Graph

692 Commits

Author SHA1 Message Date
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
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 +01:00
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
3a3a2011f4 GDScript: Add @export_storage annotation 2023-12-19 20:56:30 +03:00
10dcb21d8b GDScript: Fix accessing static function as Callable in static context 2023-12-12 22:19:39 +03:00
bc1949d797 Correctly check scripts that must inherit EditorPlugin
Also updates some error messages related to this kind of check
across the codebase.
2023-11-23 16:24:43 +01:00
6e996a597f GDScript: Fix UNSAFE_CAST warning 2023-10-27 12:42:00 +03:00
b04263644c Core: Allow methods of built-in Variant types to be used as Callables 2023-10-25 15:53:52 +03:00
7f4721a941 GDScript: Fix non-static call is allowed in static var lambda body 2023-10-20 20:43:07 +03:00
0c2202c56e GDScript: Fix incorrect error message for utility functions 2023-10-16 14:09:57 +03:00
668ba2d1a5 GDScript: Allow empty parentheses for property getter declaration 2023-10-11 09:54:17 +03:00
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 -03:00
9e2273abc7 GDScript: Add error when exporting node in non [Node]-derived classes 2023-10-05 13:50:26 +03:00
ed0b3c08e1 Core: Fix Object::has_method() for script static methods 2023-10-04 19:44:32 +03:00
e41582f42f Merge pull request #82547 from dalexeev/gds-fix-unsafe-call-arg-variant-constructors
GDScript: Fix `UNSAFE_CALL_ARGUMENT` warning for `Variant` constructors
2023-10-03 17:25:28 +02:00
6de06138c0 Merge pull request #79425 from vnen/gdscript-load-classes-for-debug-tests
GDScript: Load global classes when running debug tests
2023-10-03 17:11:01 +02:00
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
74c937079c Add type_string() utility 2023-10-02 17:41:20 +02:00
ba96d4f631 GDScript: Fix UNSAFE_CALL_ARGUMENT warning for Variant constructors 2023-09-30 13:57:09 +03:00
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
78483a1df2 Merge pull request #82186 from dalexeev/gds-fix-property-duplication
GDScript: Fix duplication of inherited script properties
2023-09-28 20:04:18 +02:00
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
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
cb8b89fd95 GDScript: Add return type covariance and parameter type contravariance 2023-09-28 12:27:36 +03:00
aa474c9feb Merge pull request #75988 from dalexeev/gds-unsafe-call-argument
GDScript: Improve call analysis
2023-09-27 19:07:46 +02:00
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
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
ceda13720b Check if any global script class is shadowed by a variable 2023-09-26 16:47:17 +08:00
16e860bcb3 GDScript: Fix duplication of inherited script properties 2023-09-23 15:30:23 +03:00
4ce27301d3 GDScript: Add INFERRED_DECLARATION warning 2023-09-22 23:13:52 +03:00
10b00bc2ea GDScript: Prevent constructing and inheriting engine singletons 2023-09-22 17:30:00 +03:00
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
3c35e7f1d6 GDScript: Make array literal typed if for loop variable type is specified 2023-09-21 11:25:59 +03:00
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
971f678442 Merge pull request #79510 from dalexeev/gds-fix-const-non-metatype-subscript
GDScript: Fix subscript resolution for constant non-metatypes
2023-09-20 13:09:17 +02:00
21b132616b Merge pull request #74995 from dalexeev/gds-r-strings
GDScript: Add raw string literals (r-strings)
2023-09-20 13:09:13 +02:00
c35cb51d74 GDScript: Fix subscript resolution for constant non-metatypes 2023-09-19 22:26:06 +03:00
729c9b4d4b GDScript: Add check for super() methods not being implemented 2023-09-17 16:21:28 -04:00
6c1be30836 Merge pull request #81605 from dalexeev/gds-fix-some-lambda-bugs
GDScript: Fix some lambda bugs
2023-09-16 21:23:42 +02:00
b1eb737719 GDScript: Fix some lambda bugs 2023-09-14 14:22:23 +03:00
ceda960131 Remove REDUNDANT_FOR_VARIABLE_TYPE
Remove REDUNDANT_FOR_VARIABLE_TYPE
2023-09-12 20:04:32 -05:00
5c43e4c1ef Fix various typos with codespell
Using 2.2.6.dev180+ge3a2cfbd.
2023-09-12 08:54:18 +02:00
0545ed5c71 Merge pull request #81355 from ryanabx/features/enforce-static-typing
Add an optional `untyped_declaration` warning
2023-09-12 08:49:57 +02:00
2964c7d51c GDScript: Add raw string literals (r-strings) 2023-09-11 18:34:33 +03:00
0202a36a7a Language Server: Improve hovered symbol resolution, fix renaming bugs, implement reference lookup
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
Co-Authored-By: BooksBaum <15612932+booksbaum@users.noreply.github.com>
2023-09-11 09:46:34 -05:00
14edf044af Add "untyped_declaration" warning 2023-09-11 09:39:10 -05:00
242d3d81e9 GDScript: Don't make array literal typed in weak type context 2023-09-05 11:32:16 +03:00
462d8f4752 GDScript: Fix get_*_list() methods return incorrect info 2023-09-04 00:21:03 +03:00
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
68a567bd13 GDScript: Allow use local constants as types 2023-08-25 17:04:04 +03:00