Commit graph

1746 commits

Author SHA1 Message Date
ZuBsPaCe
551ceb590b GDScript: Report property type errors
Inline getters & setters are now FunctionNodes.
Their names are set in the parser, not in the compiler.
GDScript-Analyzer will now run through getter and setter.
Also report wrong type or signature errors regarding getset properties.
Added GDScript tests for getters and setters.
#53102
2021-10-08 22:06:15 +02:00
Max Hilbrunner
5733c13f53
Merge pull request #53536 from Faless/mp/4.x_rpc_config
[Net] Add call_local argument to Node.rpc_config.
2021-10-08 14:15:01 +02:00
George Marques
b010f96c89
Merge pull request #53336 from briansemrau/gdscript-i'm-not-my-own-local-class
[GDScript 2.0] fix script base class self-assignment
2021-10-08 09:10:19 -03:00
Fabio Alessandrelli
54ec66a700 [Net] Rename RPCConfig.sync to call_local.
For consistency with the other user facing changes.
2021-10-08 12:39:09 +02:00
George Marques
3a856b4fcc
GDScript: Use getter return type for the property type
The PropertyInfo hints are more relevant for the inspector. The getter
return type is more reliable and less likely to be incorrect and it is
what's going to be called in the end.
2021-10-07 20:22:19 -03:00
Rémi Verschelde
49e7e049ab
Merge pull request #53422 from KoBeWi/add_LUA_to_Godot 2021-10-07 23:37:37 +02:00
George Marques
082f624ef4
GDScript: Fix method ptrcall on release 2021-10-07 15:08:21 -03:00
Rémi Verschelde
6eb2094d4d
Merge pull request #53494 from mhilbrunner/stop-drop-and-dont-lie
Fix outdated no_call_local, use call_remote
2021-10-07 08:29:25 +02:00
George Marques
dfe3a2fad0
GDScript: Set status on parsing steps beforehand
To avoid potential dependency cycles. If any happens it will not get
into infinite recursion anymore and errors will cascade later on.
2021-10-06 21:24:27 -03:00
Max Hilbrunner
44b68f08b4 Fix outdated no_call_local, use call_remote 2021-10-06 23:51:57 +02:00
Rémi Verschelde
98b81ad35c
Merge pull request #53479 from vnen/gdscript-subscript-object-self 2021-10-06 19:48:23 +02:00
Rémi Verschelde
ba0a103e29
Merge pull request #53478 from vnen/gdscript-avoid-hard-inference 2021-10-06 19:31:56 +02:00
George Marques
1f55bd190c
GDScript: Allow subscript on self and object types 2021-10-06 12:01:34 -03:00
George Marques
6bdb28f5e4
GDScript: Avoid hard errors on inferred types
Since inference isn't always correct, they are now treated as unsafe
instead of errors.

This also removes inferred type when a variable is reassigned. Since
it's not aware of branching, the types might become invalid in a later
context.
2021-10-06 11:42:19 -03:00
George Marques
d6c799006a
GDScript: Make all warnings enabled in test generation
The test generation doesn't initialize the language (since it's already
initialized in main), but it still needs the warning enabled so it
matches the actual tests.
2021-10-06 11:39:00 -03:00
Rémi Verschelde
862994a8ef
doc: Update links to latest documentation after content reorganization 2021-10-06 13:48:48 +02:00
kobewi
9e5fdbc79d Fix LUA-style assignment in Dictionary 2021-10-05 12:17:13 +02:00
Brian Semrau
c18a27a9cd GDScript fix wrong base class assignment 2021-10-04 20:38:08 -04:00
George Marques
7725ebf3d2
GDScript: Use path cache when checking preloaded scripts
The path itself might not always be set in some cases, especially when
the script is just created and is already in the resource cache. Using
get_path() in this case gets the correct resource path.

This also adds a null check for safety in case the path is incorrect or
missing, to avoid a crash in the engine.
2021-10-04 20:48:39 -03:00
George Marques
84956fee4b
GDScript: Fix member assignment with operation
It was wrongly updating the assigned value with the result of the
operation.
2021-10-04 14:09:54 -03:00
Rémi Verschelde
bb201c5887
Merge pull request #53303 from akien-mga/53295-gdscript-completion-quote-style 2021-10-04 17:17:27 +02:00
Rémi Verschelde
4a4995524c
Merge pull request #53338 from briansemrau/gdscript-handle-for-with-null-list 2021-10-04 17:11:43 +02:00
Rémi Verschelde
b85dfd990e
GDScript completion: Handle quote style ad-hoc to remove editor dependency
`core` and `scene` shouldn't depend on `editor`, so they can't query this style
setting in `get_argument_options`. But we can handle it after the fact in
GDScript's completion code.

Also cleans up a couple extra unused invalid includes in `core`.
2021-10-04 16:16:05 +02:00
kobewi
cb28469281 Allow void as return type for constructors 2021-10-03 21:16:54 +02:00
Brian Semrau
dc046e5cbe GDScript Check for null list in for loop 2021-10-02 13:53:56 -04:00
Fabio Alessandrelli
366e374f76
Merge pull request #53290 from Faless/mp/4.x_opts_names
[Net] Rename RPC constants and annotation arguments.
2021-10-01 21:35:08 +02:00
Fabio Alessandrelli
24a949ea11 [Net] Rename RPC constants and annotation arguments.
any -> any_peer
sync -> call_local
ordered -> unreliable_ordered

Multiplayer.RPC_MODE_ANY -> RPC_MODE_ANY_PEER
Multiplayer.TRANSFER_MODE_ORDERED -> TRANSFER_MODE_UNRELIABLE_ORDERED
2021-10-01 18:14:38 +02:00
Francois Belair
572979d011 Fix empty line hover; fix open non-res:// script 2021-10-01 11:26:26 -04:00
Rémi Verschelde
06c1b40b84
Merge pull request #38397 from Calinou/doc-range-backwards-example 2021-10-01 11:58:30 +02:00
Lightning_A
c63b18507d Use range iterators for Map 2021-09-30 15:09:12 -06:00
Hugo Locurcio
810d8f06b7
Add an example on iterating an array backwards
This closes https://github.com/godotengine/godot-docs/issues/3472.
2021-09-30 20:29:57 +02:00
Rémi Verschelde
d2b8560d7a
Revert "GdScript: Use reduced constant expression result when doing binary operations. Fixes #50293"
This reverts commit 6207708607.

It broke a GDScript test (which didn't exist back when the PR was made,
so was missed prior to the merge).

It choked on:
```
prints("a", test_instance.a, test_instance.a == Named.VALUE_A)
```
With:
```
Invalid operands "VALUE_A (enum value)" and "int" for "==" operator.
```
2021-09-30 18:57:59 +02:00
Rémi Verschelde
7f8e50801e
Merge pull request #51818 from MarianoGnu/gdscript2-enum-fixes 2021-09-30 18:35:49 +02:00
Rémi Verschelde
27d4e2f09f
Merge pull request #53216 from vnen/gdscript-builtin-type-not-id 2021-09-29 17:04:24 +02:00
George Marques
72c07708e8
GDScript: Don't allow builtin type names as identifiers 2021-09-29 11:23:16 -03:00
George Marques
991f4d8527
GDScript: Fix assignment with operation for properties 2021-09-29 10:54:16 -03:00
Rémi Verschelde
c1f59139b4
Merge pull request #53092 from Razoric480/lsp-report-_init 2021-09-29 15:47:31 +02:00
Francois Belair
7468dd65a5 Make LSP report _init instead of Object::new 2021-09-29 08:42:01 -04:00
Rémi Verschelde
ea0a9e6ed3
Merge pull request #52800 from akien-mga/gdscript-remove-exp_range 2021-09-29 13:33:59 +02:00
Pedro J. Estébanez
0fa574c051 Fix check for freed object during cast 2021-09-27 19:35:26 +02:00
Pedro J. Estébanez
ee238b2a4d Fix inverted error messages about null object 2021-09-27 13:58:46 +02:00
Francois Belair
044daf9b8d Remove duplicate WorkspaceEdit from LSP 2021-09-25 15:17:19 -04:00
Rémi Verschelde
14dcb97556
Merge pull request #50378 from Razoric480/apply-edit-40 2021-09-25 20:43:17 +02:00
Rémi Verschelde
0abe464162
Merge pull request #52849 from KoBeWi/know_no_binds 2021-09-25 00:10:56 +02:00
kobewi
7bf5fc709e Remove binds from Signal.connect 2021-09-24 17:07:33 +02:00
Rémi Verschelde
679f70c1e1
Merge pull request #52906 from vnen/gdscript-show-error-on-yield 2021-09-21 20:36:39 +02:00
Rémi Verschelde
b3b4860d2e
Merge pull request #52905 from vnen/gdscript-single-line-declaration 2021-09-21 20:35:36 +02:00
George Marques
262d6c6bef
GDScript: Show specific error when "yield" is used
To help people porting code, it gives a hint to use "await" instead of a
generic error.
2021-09-21 14:38:14 -03:00
George Marques
e5ebc9710d
GDScript: Allow classes declaration to be done in single line
Incidentally, allow multiple statements in single line functions when
using semicolon as a terminator.
2021-09-21 14:14:46 -03:00
George Marques
bab0afc821
GDScript: Allow multiple lines in signal parameters declaration 2021-09-21 13:40:39 -03:00