Danil Alexeev
8122a27eac
GDScript: Fix access non-static members in static context
2024-05-01 19:55:40 +03:00
Rémi Verschelde
c4733e8003
Merge pull request #90860 from vnen/gdscript-get-dependencies
...
GDScript: Implement `get_dependencies()`
2024-04-29 12:30:12 +02:00
Rémi Verschelde
296758a8f8
Merge pull request #90552 from vnen/gdscript-constructor-callable-release
...
GDScript: Assume constructor to be accessible from class
2024-04-29 12:30:08 +02:00
George Marques
8b7fc225f0
GDScript: Resolve types from autoload scenes
...
When the autoload is a scene, it now extracts the script from it and
use it to further infer nested types.
2024-04-26 10:46:19 -03:00
Rémi Verschelde
e8eca0b3f0
Merge pull request #90601 from rune-scape/rune-gdscript-dependant-parser-ref-errors
...
GDScript: Fix out of date errors in depended scripts
2024-04-22 22:18:15 +02:00
rune-scape
6b88c86cec
GDScript: invalidate GDScriptParserRef when reloading
2024-04-18 14:05:58 -07:00
George Marques
dc73440f89
GDScript: Implement get_dependencies()
...
The parser and analyzer now track the dependencies of the script and
return the list when the resource loader ask for them.
What is considered a dependency:
- Any `preload()` call.
- The base script this one extends.
- Any identifier, including types, that refers to global scripts.
- Any autoload singleton reference.
2024-04-18 11:54:37 -03:00
Rémi Verschelde
978d206f34
Merge pull request #90794 from vnen/gdscript-no-unused-constant-warning-with-underscore
...
GDScript: Suppress unused constant warning with underscore
2024-04-18 15:17:13 +02:00
George Marques
a3b3a20ac0
GDScript: Suppress unused constant warning with underscore
...
The warning message mentions that local constants prefixed with `_` does
not generate the warning. This commit actually implements this warning
suppression.
2024-04-18 09:58:23 -03:00
George Marques
f9048fcd7d
GDScript: Warn when enum variable has no default
...
The default will always be set to `0`, so if it's not a valid value in
the enum, the warning is shown.
2024-04-16 11:46:59 -03:00
George Marques
030995c10d
GDScript: Allow casting enum to int
...
An enum value is always an integer so the cast is valid. The code here
now consider this case to avoid giving an error message.
2024-04-12 11:49:21 -03:00
George Marques
e761982979
GDScript: Assume constructor to be accessible from class
...
Since the constructor is accessed directly from the class, even if not
marked `static`, it can be retrieved as a Callable without an instance.
2024-04-11 20:28:46 -03:00
Rémi Verschelde
67076c167d
Merge pull request #90448 from vnen/gdscript-infer-string-format
...
GDScript: Infer type with string format operator
2024-04-10 17:49:49 +02:00
Rémi Verschelde
8611fd8400
Merge pull request #90442 from vnen/gdscript-dont-warn-using-default-builtin
...
GDScript: Don't warn on unassigned for builtin-typed variables
2024-04-10 17:49:44 +02:00
George Marques
877802e252
GDScript: Don't warn on unassigned for builtin-typed variables
...
If the type of a variable is a built-in Variant type, then it will
automatically be assigned a default value based on the type. This means
that the explicit initialization may be unnecessary. Thus this commit
removes the warning in such case.
This also changes the meaning of the unassigned warning to happen when
the variable is used before being assigned, not when it has zero
assignments.
2024-04-10 11:59:57 -03:00
George Marques
4bdba718c5
GDScript: Infer type with string format operator
...
If the left value type is known to be String, assume the format operator
(`%`) will return a string, since it works with any type in the right
hand side. This is also used by type inference even if the right hand
type is unknown at compile time.
2024-04-10 11:49:30 -03:00
Rémi Verschelde
f8ca571efe
Merge pull request #84043 from dalexeev/gds-fix-unsafe-cast-warning
...
GDScript: Fix `UNSAFE_CAST` warning
2024-04-09 22:24:55 +02:00
Jamie Hill-Daniel
164b34a734
Don't pass `self` when calling a static function from a non-static context
2024-04-04 21:15:17 +00:00
Danil Alexeev
ef1909fca3
GDScript: Fix `@warning_ignore` annotation issues
2024-03-12 19:00:06 +03: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
Danil Alexeev
8ffc50ee8c
GDScript: Canonicalize script path in FQCN
2024-02-26 10:46:24 +03:00
Rémi Verschelde
ee5ace10b7
Merge pull request #85501 from /remove-packed-scene-cache
2024-02-25 11:49:27 +01:00
Danil Alexeev
a2e3e31e80
GDScript: Fix extension comparison for exported scripts
2024-02-15 17:53:24 +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
Yuri Sizov
72756133e0
Merge pull request #85224 from HolonProduction/identifier-type-prefer-annotated
...
Prefer identifiers annotated type if assigned type is incompatible to it
2024-01-24 14:07:52 +01:00
Rémi Verschelde
b5dcb5f58a
Merge pull request #85215 from HolonProduction/type-from-property-class-name
...
Handle global classes when resolving type from `PropertyInfo`
2024-01-18 09:33:22 +01:00
HolonProduction
0203b3c310
Prefer identifiers annotated type if assigned type is incompatible to it
2024-01-17 22:32:00 +01:00
HolonProduction
4ab985d138
Handle global classes when resolving type from `PropertyInfo`
2024-01-17 21:39:51 +01:00
Danil Alexeev
b31acb0cd5
GDScript: Allow utility functions to be used as `Callable`
2024-01-05 21:16:53 +03:00
Muller-Castro
96a95cb974
Add const lvalue ref to container parameters
2024-01-05 14:49:57 -03: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
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
Yuri Sizov
38d8ca0dc1
Merge pull request #85703 from TitanNano/jovan/gdscript_foreign_script_properties
...
Make GDScriptAnalyzer aware of properties from other languages
2023-12-19 13:02:19 +01:00
Jovan Gerodetti
030aa41a99
GDScriptAnalyzer is unaware of properties from other Languages
...
Co-authored-by: K. S. Ernest (iFire) Lee <fire@users.noreply.github.com>
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2023-12-18 22:03:30 +01:00
Thaddeus Crews
5cf0d772bc
Change container_element_type to vector container
2023-12-05 08:51:49 -06:00
Jordyfel
ef5dcccde7
Stop caching packed scenes in GDScript cache
2023-11-29 12:52:55 +02: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
Rémi Verschelde
109cb8e697
Merge pull request #83455 from Lunarisnia/fix/gdscript-error-typo
...
Fix grammar typo in GDScript error message
2023-10-17 16:13:02 +02:00
Lunarisnia
981c6c94c0
Fix grammar typo in GDScript error message
2023-10-17 01:33:37 +07:00
Rémi Verschelde
ddb7969cb6
Merge pull request #83257 from dalexeev/gds-fix-unresolved-type-for-incomplete-expressions
...
GDScript: Fix unresolved datatype for incomplete expressions
2023-10-16 18:44:27 +02:00
Danil Alexeev
0c2202c56e
GDScript: Fix incorrect error message for utility functions
2023-10-16 14:09:57 +03:00
Danil Alexeev
3ac61aadd7
GDScript: Fix unresolved datatype for incomplete expressions
2023-10-13 12:52:14 +03:00
Danil Alexeev
9e2273abc7
GDScript: Add error when exporting node in non [Node]-derived classes
2023-10-05 13:50:26 +03:00
Rémi Verschelde
7c1abe8599
Merge pull request #82789 from dalexeev/gds-fix-unresolved-type-for-incomplete-bin-op
...
GDScript: Fix unresolved datatype for incomplete binary operator
2023-10-05 10:10:33 +02:00
Danil Alexeev
2c5636c135
GDScript: Fix unresolved datatype for incomplete binary operator
2023-10-04 17:07:37 +03:00
Danil Alexeev
6767de9b69
GDScript: Fix `native_type` is empty for autoload without script
2023-10-04 16:09:18 +03: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
Danil Alexeev
ba96d4f631
GDScript: Fix `UNSAFE_CALL_ARGUMENT` warning for `Variant` constructors
2023-09-30 13:57:09 +03:00