Commit graph

71 commits

Author SHA1 Message Date
Rémi Verschelde
4e360ac612
Merge pull request #70702 from vnen/gdscript-error-on-assign-void
GDScript: Error when assigning return value of void function
2023-01-03 12:23:00 +01:00
Rémi Verschelde
e4c1103af4
Merge pull request #70656 from vonagam/fix-void-returns
GDScript: Disallow return with value in void functions
2023-01-03 12:20:33 +01:00
George Marques
bc739a4687
GDScript: Make using return of void function an error
Remove the `VOID_ASSIGNMENT` warning since those cases will be errors
now.
2022-12-30 13:35:38 -03:00
Dmitrii Maganov
9507f65e25 GDScript: Disallow return with value in void functions 2022-12-29 03:06:13 +02:00
Dmitrii Maganov
f67aa3e46d GDScript: Fix return type of constructor call for extending class 2022-12-27 23:02:12 +02:00
ocean (they/them)
d93dbab054 Add MethodInfo to signal datatype 2022-12-21 22:49:51 -05:00
Adam Scott
1bbb2b4159 Fix outer class lookup 2022-12-17 17:57:00 -05:00
rune-scape
2dfc6d5b69 GDScript: Allow out of order member resolution 2022-12-14 21:44:05 -05:00
rune-scape
e79be6ce07 Unify String and StringName 2022-12-05 21:46:47 -05:00
kobewi
d1e4146462 Improve parent signature error 2022-12-01 15:16:16 +01:00
ocean (they/them)
13be0ab733 Fix ability to overload "script" variable 2022-11-17 17:21:12 -05:00
PastMoments
b3704e664d Fixes GDScript define nested dictionary and array as constants #50285 2022-04-19 08:57:23 -04:00
George Marques
1ebcb58e69
GDScript: Check if method signature matches the parent
To guarantee polymorphism, a method signature must be compatible with
the parent. This checks if:

1. Return type is the same.
2. The subclass method takes at least the same amount of parameters.
3. The matching parameters have the same type.
4. If the subclass takes more parameters, all of the extra ones have a
default value.
5. If the superclass has default values, so must have the subclass.

There's a few test cases to ensure this holds up.
2022-03-06 11:16:20 -03:00
George Marques
ad6e2e82a9
GDScript: Consolidate behavior for assigning enum types
This makes sure that assigning values to enum-typed variables are
consistent. Same enum is always valid, different enum is always
invalid (without casting) and assigning `int` creates a warning
if there is no casting.

There are new test cases to ensure this behavior doesn't break in
the future.
2022-02-03 13:32:16 -03:00
strank
960a26f6c0 GDScript: Fix parsing default parameter values from function calls 2022-01-13 19:28:39 -05:00
George Marques
45f546c1d8
GDScript: Make setter parameter type same as variable type 2021-10-12 09:39:23 -03:00
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
George Marques
72c07708e8
GDScript: Don't allow builtin type names as identifiers 2021-09-29 11:23:16 -03:00
Hugo Locurcio
c6ca09dc6f
Add more integration tests to the GDScript test suite
This also fixes a typo in the `bitwise_float_right_operand.gd` test.
2021-09-15 19:57:39 +02:00
George Marques
5d31ce4b16
GDScript: Allow string keys on Lua-style dictionaries
Which is useful when the key isn't a valid identifier, such as keys with
spaces or numeric keys.
2021-09-15 09:56:24 -03:00
Hugo Locurcio
c0083c0f90
Add dozens of new integration tests to the GDScript test suite
This also ignores `.out` files in the file format static checks.
2021-09-14 18:42:08 +02:00