Commit Graph

42 Commits

Author SHA1 Message Date
5909f9f075 GDScript: Fix issues with typed arrays 2023-01-31 11:54:41 +02:00
a3dae9e548 Merge pull request #72285 from vnen/gdscript-variable-match
GDScript: Allow variables in match patterns
2023-01-29 02:45:48 +01:00
c68b2358d5 GDScript: Allow variables in match patterns
To restore an ability available in 3.x and reduce compatibility changes.
2023-01-28 19:53:27 -03:00
31e0ae2012 GDScript: Fix constant conversions 2023-01-29 00:01:53 +02:00
b004f8180e GDScript: Allow constant expressions in annotations 2023-01-25 18:43:56 +03:00
41e5f5b093 Merge pull request #71349 from vonagam/disallow-infer-on-weak
GDScript: Disallow type inference with untyped initializer
2023-01-25 14:42:20 +01:00
a1e0281b45 GDScript: Disallow type inference with untyped initializer 2023-01-13 20:51:29 +02:00
40613ebd21 GDScript: Fix typing of iterator in for loop 2023-01-13 15:36:11 +02:00
aaa5158ff9 Merge pull request #70733 from vonagam/fix-assigning-untyped
GDScript: Fix some issues with assignments that involve untyped things
2023-01-12 20:08:55 +01:00
274d49790d GDScript: Fix extending abstract classes, forbid their construction 2023-01-12 17:47:10 +02:00
38c214d483 GDScript: Fix some issues with assignments that involve untyped things 2023-01-12 17:07:45 +02:00
5980abbcec GDScript: Fix getting type from PropertyInfo for Variant arguments 2023-01-12 16:47:06 +02:00
44d1d72af1 Add GDScript .editorconfig rules
- Uniformize `.gd` unit test files indentation to tabs (where needed)
2023-01-10 12:25:35 -05:00
c894edd4cb Merge pull request #71140 from vonagam/fix-const-index-subscript-type
GDScript: Fix type for index subscript on constant
2023-01-10 07:58:29 +01:00
ff505c9875 GDScript: Fix type for index subscript on constant 2023-01-10 07:10:00 +02:00
fb175d92da Fix GDScript base and outer classes, signals and functions lookup order
- Add outer class lookup test
- Add signal lookup test

Co-authored-by: Dmitrii Maganov <vonagam@gmail.com>
2023-01-09 20:12:10 -05:00
d3fc9d9e41 Merge pull request #71051 from vonagam/consts-are-deep-start
GDScript: Begin making constants deep, not shallow or flat
2023-01-09 23:22:59 +01:00
366ec895b1 Assorted enum and native type fixes 2023-01-09 11:08:07 -05:00
5e2ac1a31e GDScript: Begin making constants deep, not shallow or flat 2023-01-08 07:29:10 +02:00
532ffc30bd GDScript: Fix typing of lambda functions 2023-01-06 16:38:22 +02:00
a1d06749f1 Unify typing of variables, constants and parameters in GDScript 2023-01-06 01:10:04 +02:00
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
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
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
9507f65e25 GDScript: Disallow return with value in void functions 2022-12-29 03:06:13 +02:00
f67aa3e46d GDScript: Fix return type of constructor call for extending class 2022-12-27 23:02:12 +02:00
d93dbab054 Add MethodInfo to signal datatype 2022-12-21 22:49:51 -05:00
1bbb2b4159 Fix outer class lookup 2022-12-17 17:57:00 -05:00
2dfc6d5b69 GDScript: Allow out of order member resolution 2022-12-14 21:44:05 -05:00
e79be6ce07 Unify String and StringName 2022-12-05 21:46:47 -05:00
d1e4146462 Improve parent signature error 2022-12-01 15:16:16 +01:00
13be0ab733 Fix ability to overload "script" variable 2022-11-17 17:21:12 -05:00
b3704e664d Fixes GDScript define nested dictionary and array as constants #50285 2022-04-19 08:57:23 -04:00
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
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
960a26f6c0 GDScript: Fix parsing default parameter values from function calls 2022-01-13 19:28:39 -05:00
45f546c1d8 GDScript: Make setter parameter type same as variable type 2021-10-12 09:39:23 -03:00
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
72c07708e8 GDScript: Don't allow builtin type names as identifiers 2021-09-29 11:23:16 -03:00
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
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
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