Rémi Verschelde
0acc4276b6
Merge pull request #82952 from AbelToy/gds-export-array
...
Allow `@export`ed Arrays to set property hints for their elements
2024-03-06 09:49:53 +01:00
Abel Toy
882441a0ad
Support Array and PackedArray in @export_*
2024-03-06 16:17:54 +09:00
A Thousand Ships
1e61e42250
[GDScript] Fix some test file paths
2024-03-04 19:11:28 +01:00
Rémi Verschelde
7be96a55c4
Merge pull request #86973 from HolonProduction/tests-batch-1
...
Add tests for `get_node` autocompletion
2024-03-04 13:32:55 +01:00
20kdc
24181d1055
GDScript: Adjust STATIC_CALLED_ON_INSTANCE warning to not default to the native type, and to not trigger on self-calls
...
Not defaulting to the native type rationale:
Defaulting to the native type is less than useful, as:
* There are very few native types that are extensible and have static methods.
* Defaulting to the native type does not account for a method being script-defined.
While the "real fix" would be to carefully track the source of the method, the get_function_signature method is already complicated enough.
This will at least ensure the resulting code should always be valid.
Not triggering on self-calls rationale:
Found in PR comment https://github.com/godotengine/godot/pull/85918#issuecomment-1935864459
```
static func example():
pass
func example2():
example() # self-call on static function
```
Disabling this warning on self-calls is:
* Consistent with other languages
* Important for anonymous classes (where the output code is unusable)
2024-03-01 17:14:59 +03:00
HolonProduction
a2e7c64dc4
Cleanup
2024-03-01 13:06:37 +01:00
HolonProduction
1f42455e0a
Debugging additions
2024-03-01 11:38:49 +01:00
HolonProduction
fc7d7d3dae
Add test for get_node
autocompletion
2024-03-01 11:24:06 +01:00
Danil Alexeev
d90c9db27f
Core: Add Callable.create
static method for Variant
callables
2024-02-29 10:45:00 +03: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 +01:00
Rémi Verschelde
77666286b7
Merge pull request #88020 from emre0altan/match-null-crashes-GDScript-compiler
...
GDScript: Set `has_type` false if it is `BUILTIN` but `Variant::NIL`
2024-02-23 22:18:55 +01:00
emre0altan
081fa324fd
set has_type false if it is BUILTIN but Variant::NIL
2024-02-11 13:47:12 +00:00
George Marques
b4d0a09f15
GDScript: Reintroduce binary tokenization on export
...
This adds back a function available in 3.x: exporting the GDScript
files in a binary form by converting the tokens recognized by the
tokenizer into a data format.
It is enabled by default on export but can be manually disabled. The
format helps with loading times since, the tokens are easily
reconstructed, and with hiding the source code, since recovering it
would require a specialized tool. Code comments are not stored in this
format.
The `--test` command can also include a `--use-binary-tokens` flag
which will run the GDScript tests with the binary format instead of the
regular source code by converting them in-memory before the test runs.
2024-02-08 11:20:05 -03:00
Danil Alexeev
2bf25954b4
GDScript: Add is not
operator
2024-02-04 17:36:53 +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
Rémi Verschelde
745f8e112f
Revert "Add UID support to GDScript files"
...
This reverts commit c7f68a27ec
.
We still think GDScript files need UIDs to allow safe refactoring,
but we're still debating what form those should take exactly.
So far there seems to be agreement that it shouldn't be done via an
annotation as implemented here, so we're reverting this one for now,
to revisit the feature in a future PR.
2024-01-29 21:00:26 +01:00
Rémi Verschelde
baf87e2717
Merge pull request #87294 from vnen/allow-free-callable
...
Allow `free()` to be used as Callable
2024-01-18 16:35:14 +01:00
Rémi Verschelde
d3003c48b3
Merge pull request #67132 from KoBeWi/This_commit_message_is_auto-generated._Do_not_modify_it-
...
Add UID support to GDScript files
2024-01-18 16:33:14 +01: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 -03:00
kobewi
c7f68a27ec
Add UID support to GDScript files
2024-01-17 22:30:56 +01:00
HolonProduction
92a7c26806
Allow specifying a scene in completion tests
2024-01-08 22:38:41 +01:00
Rémi Verschelde
b88535fe23
Merge pull request #85178 from HolonProduction/completion-tests
...
Add unit test runner for autocompletion
2024-01-08 11:51:03 +01:00
Danil Alexeev
b31acb0cd5
GDScript: Allow utility functions to be used as Callable
2024-01-05 21:16:53 +03:00
HolonProduction
af4cbaf751
Add unit test runner for autocompletion
2024-01-05 17:49:51 +01:00
Rémi Verschelde
150f2a75b2
Merge pull request #83120 from dalexeev/gds-allow-property-getter-empty-parentheses
...
GDScript: Allow empty parentheses for property getter declaration
2024-01-04 16:39:16 +01: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
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
Danil Alexeev
3a3a2011f4
GDScript: Add @export_storage
annotation
2023-12-19 20:56:30 +03:00
Danil Alexeev
10dcb21d8b
GDScript: Fix accessing static function as Callable
in static context
2023-12-12 22:19:39 +03: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
Danil Alexeev
0c2202c56e
GDScript: Fix incorrect error message for utility functions
2023-10-16 14:09:57 +03:00
Danil Alexeev
668ba2d1a5
GDScript: Allow empty parentheses for property getter declaration
2023-10-11 09:54:17 +03: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 -03:00
Danil Alexeev
9e2273abc7
GDScript: Add error when exporting node in non [Node]-derived classes
2023-10-05 13:50:26 +03:00
Danil Alexeev
ed0b3c08e1
Core: Fix Object::has_method()
for script static methods
2023-10-04 19:44:32 +03:00
Rémi Verschelde
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
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
Jakub Janšta
74c937079c
Add type_string() utility
2023-10-02 17:41:20 +02: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
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
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
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
16e860bcb3
GDScript: Fix duplication of inherited script properties
2023-09-23 15:30:23 +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
Rémi Verschelde
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
Rémi Verschelde
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
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
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
Danil Alexeev
b1eb737719
GDScript: Fix some lambda bugs
2023-09-14 14:22:23 +03:00
ryanabx
ceda960131
Remove REDUNDANT_FOR_VARIABLE_TYPE
...
Remove REDUNDANT_FOR_VARIABLE_TYPE
2023-09-12 20:04:32 -05:00
Rémi Verschelde
5c43e4c1ef
Fix various typos with codespell
...
Using 2.2.6.dev180+ge3a2cfbd.
2023-09-12 08:54:18 +02:00
Danil Alexeev
2964c7d51c
GDScript: Add raw string literals (r-strings)
2023-09-11 18:34:33 +03:00
BooksBaum
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
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
e71ec0b5eb
Merge pull request #80365 from dalexeev/gds-allow-mix-indent-on-blank-lines
...
GDScript: Allow mixed indentation on blank lines
2023-08-17 11:25:04 +02: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
00ad9e484e
GDScript: Allow mixed indentation on blank lines
2023-08-17 10:54:43 +03: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
f19377160c
GDScript: Fix regression with native signal not found
2023-08-02 15:42:36 +03:00
Yuri Sizov
3de7dd902c
Merge pull request #79880 from dalexeev/gds-fix-id-shadowing-below
...
GDScript: Fix bug with identifier shadowed below in current scope
2023-07-31 21:01:36 +02: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 +02:00
Danil Alexeev
d53fc92b4c
GDScript: Fix bug with identifier shadowed below in current scope
2023-07-26 11:26:57 +03:00
jpcerrone
13c73500ab
Fix for not being able to ignore shadowing warnings on class scope
2023-07-24 17:22:12 -03:00
Aaron Franke
6a8a9cd279
Change GDScript tests to use InstancePlaceholder as the example abstract
2023-07-15 18:28:08 -05: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
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
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