Commit Graph

3281 Commits

Author SHA1 Message Date
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
Danil Alexeev aff767ef07
Fix expected argument count for `Callable` call errors 2023-09-29 20:00:10 +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
A Thousand Ships 517e9f8aef [Modules] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-26 16:44:52 +02:00
Rémi Verschelde 9b0b441cf3
Merge pull request #82139 from dalexeev/gds-add-inferred-declaration-warning
GDScript: Add `INFERRED_DECLARATION` warning
2023-09-26 16:36:39 +02:00
Chia-Hsiang Cheng ceda13720b Check if any global script class is shadowed by a variable 2023-09-26 16:47:17 +08:00
Rémi Verschelde 0c626bdfb0
Merge pull request #82294 from dalexeev/gds-fix-gdsnc-crash
GDScript: Fix crash with `GDScriptNativeClass`
2023-09-26 08:31:26 +02:00
Rémi Verschelde e4cfd4e26a
Merge pull request #82195 from AThousandShips/radian_fix
Replace `radians` range hint with `radians_as_degrees`
2023-09-25 17:18:38 +02:00
Rémi Verschelde 3e15c8f285
Merge pull request #81833 from 0x4448/fix-autocomplete-quotes
Fix autocomplete quotes
2023-09-25 17:18:23 +02:00
Rémi Verschelde 7a29189858
Merge pull request #81200 from RandomShaper/gd_vm_msvc
Optimize GDScript VM codegen for MSVC
2023-09-25 17:18:19 +02:00
Rémi Verschelde d759f91f8d
Merge pull request #81101 from 398utubzyt/dotnet/abstract-class-support
C#: Add abstract class support
2023-09-25 17:18:05 +02:00
Rémi Verschelde 1a0e653d7f
Merge pull request #78573 from dalexeev/editor-create-script-class-name
Editor: Remove unused Class Name field from Create Script dialog
2023-09-25 17:17:46 +02:00
Pedro J. Estébanez 9c15e2f24b Optimize GDScript VM codegen for MSVC 2023-09-25 16:32:36 +02:00
Danil Alexeev 16b024ba82
GDScript: Fix crash with `GDScriptNativeClass` 2023-09-25 17:09:20 +03:00
A Thousand Ships e45927b2f2 Replace `radians` range hint with `radians_as_degrees` 2023-09-25 08:50:19 +02:00
Danil Alexeev 16e860bcb3
GDScript: Fix duplication of inherited script properties 2023-09-23 15:30:23 +03:00
Danil Alexeev 4ce27301d3
GDScript: Add `INFERRED_DECLARATION` warning 2023-09-22 23:13:52 +03:00
Danil Alexeev 10b00bc2ea
GDScript: Prevent constructing and inheriting engine singletons 2023-09-22 17:30:00 +03:00
0x4448 7ea4247c3d Omit quotes from completion if triggered with quote
Typing a single or double quote in an external editor triggers
auto-completion. The returned CompletionItem should not include
quotes since they're already in the editor.

CompletionParams was missing context in to_json() and this is
required to detect whether a quote was typed.
2023-09-21 17:37:32 -07:00
Danil Alexeev 426ccba70e
GDScript DocGen: Fix and improve appearance of metatypes and values 2023-09-21 20:44:34 +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 888d3252ba
Merge pull request #81881 from lotuspar/patch-1
Rewrite a small comment in GDScript tokenizer code
2023-09-20 13:09:44 +02:00
Rémi Verschelde 281439ce20
Merge pull request #81699 from dalexeev/gds-fix-and-improve-doc-comment-parsing
GDScript: Fix and improve doc comment parsing
2023-09-20 13:09:32 +02: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
Gio b6f1dbb340 Rewrite a bit of comment in tokenizer code
gdscript_tokenizer.cpp: `change` -> `changes`
2023-09-19 21:38:52 +08:00
Rémi Verschelde e207595de9
Merge pull request #81844 from ryanabx/features/specify-lsp-port
Add `--lsp-port` as a command line argument
2023-09-19 09:04:30 +02:00
ryanabx a5b7c4c415 Add `--lsp-port` as a command line argument 2023-09-18 08:51:15 -05: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 c63e0aefcf
Merge pull request #79366 from dalexeev/gds-signal-info-and-callback
Editor: Improve signal callback generation
2023-09-17 14:45:47 +02: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
Rémi Verschelde e5ac7cf034
Merge pull request #81577 from anvilfolk/thecycleeeeeeeeeeeeesaaaaaaaaaaaaah
GDScript: Fix compilation of expressions compiling other classes
2023-09-16 21:23:18 +02:00
Danil Alexeev 072e9c5c82
GDScript: Fix and improve doc comment parsing 2023-09-16 17:31:50 +03:00
398utubzyt 2df37a237a C#: Abstract script class support 2023-09-15 20:35:25 -07:00
Danil Alexeev d991cc4998
GDScript: Fix POT generator crash on assignee with index 2023-09-14 17:41:05 +03:00
Yuri Sizov 1437b3a226 Merge pull request #81599 from ShadowApex/shadowapex/fix-extendparser-signals
Fix dumping of signal API parameters
2023-09-14 15:21:56 +02:00
Danil Alexeev b1eb737719
GDScript: Fix some lambda bugs 2023-09-14 14:22:23 +03:00
William Edwards 188132884d Fix dumping of signal API parameters 2023-09-12 18:43:31 -07:00
ryanabx ceda960131 Remove REDUNDANT_FOR_VARIABLE_TYPE
Remove REDUNDANT_FOR_VARIABLE_TYPE
2023-09-12 20:04:32 -05:00
ocean (they/them) d330f5642e GDScript: Fix compilation of expressions compiling other classes
This PR is part of ongoing work on fixing cyclic dependencies in the GDScript
compiler.
2023-09-12 11:18:33 -04:00
Danil Alexeev 26ce861910
Editor: Remove unused Class Name field from Create Script dialog 2023-09-12 12:49:56 +03:00
Rémi Verschelde 5c43e4c1ef
Fix various typos with codespell
Using 2.2.6.dev180+ge3a2cfbd.
2023-09-12 08:54:18 +02:00
Rémi Verschelde 0545ed5c71
Merge pull request #81355 from ryanabx/features/enforce-static-typing
Add an optional `untyped_declaration` warning
2023-09-12 08:49:57 +02:00
Rémi Verschelde b539bfb263
Merge pull request #81201 from anvilfolk/rpc
GDScript: Fix subclass methods not inheriting RPC info
2023-09-12 08:49:33 +02:00
Danil Alexeev 4b5daf06ef
Editor: Improve signal callback generation 2023-09-11 18:45:39 +03:00
Danil Alexeev 2964c7d51c
GDScript: Add raw string literals (r-strings) 2023-09-11 18:34:33 +03:00
ocean (they/them) 711ffabcfe GDScript: fix subclass methods not inheriting RPC info 2023-09-11 11:10:07 -04: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
ryanabx 14edf044af Add "untyped_declaration" warning 2023-09-11 09:39:10 -05:00
Rémi Verschelde 13f0ab88f2
Merge pull request #81079 from dalexeev/gds-fix-get-method-list
GDScript: Fix `get_*_list()` methods return incorrect info
2023-09-11 15:36:52 +02:00
Aaron Franke 6f7eccc758
Add a type conversion method to Variant Utility and expose to scripting 2023-09-08 10:12:48 -05:00
Yuri Sizov d8ff69d53c Extract ScriptInstance to simplify includes
This allows to include script_instance.h directly in the
generated gdvirtual.gen.inc, and remove excessive includes
from the codebase.

This should also allow Resource to use GDVIRTUAL macros,
which wasn't possible previously due to a circular dependency.
2023-09-06 22:54:38 +02: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 Rubinsky 35802374ac Add coloring for completion of vector components 2023-08-30 21:13:25 +03:00
Markus Sauermann c4705a590b Fix Object::notification order
Previously the `p_reversed` parameter didn't influence the order
in a correct way.
Also script overridden _notification functions were not called in
the correct order.

To fix this some `notification` functions had to add a `p_reversed`
parameter.

This made it necessary to adjust cpp-bindings.

Co-authored-by: David Snopek <dsnopek@gmail.com>
2023-08-30 00:15:55 +02:00
Rémi Verschelde 76d318dbd1
Merge pull request #75778 from KoBeWi/_vp
Expose `_validate_property()` for scripting
2023-08-29 12:41:27 +02:00
Rémi Verschelde 91c5273ec5
Merge pull request #75656 from YuriSizov/core-iconic-builtins
Add a script method to get its class icon
2023-08-29 12:41:03 +02:00
kobewi 67db4693eb Expose _validate_property() for scripting 2023-08-28 15:18:48 +02:00
Rémi Verschelde fc37fd7b98
Merge pull request #81039 from MewPurPur/fix-hex-number-highlighting-after-separator
Fix highlighting of hex numbers with separators
2023-08-28 12:10:11 +02:00
MewPurPur d3946242f4 Fix highlighting of hex numbers with separators 2023-08-28 09:52:40 +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
Yuri Sizov 2c77f07aaa Add a script method to get its class icon
Co-authored-by: Danil Alexeev <danil@alexeev.xyz>
2023-08-24 13:05:41 +02:00
Rémi Verschelde e43370d0fa
Merge pull request #80686 from azuloo/lsp-thread-connection-error
Fixes LSP connection error when launched in a separate thread
2023-08-21 19:26:43 +02:00
Rémi Verschelde 7d3bee73e4
Merge pull request #80247 from dalexeev/gds-for-loop-var-static-typing
GDScript: Add static typing for `for` loop variable
2023-08-21 19:26:32 +02:00
Rémi Verschelde 9becff0c54
Merge pull request #80745 from dalexeev/gds-improve-docgen
GDScript: Improve DocGen
2023-08-21 08:22:31 +02:00
Danil Alexeev 34d432807f
GDScript: Improve DocGen 2023-08-19 19:54:43 +03:00
Rémi Verschelde a017e9c698
Merge pull request #80119 from MewPurPur/svg-opacities-standardization
Optimize and fix up some SVGs
2023-08-18 09:30:23 +02: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
azuloo a5710d468b Fixes LSP connection error when launched in a separate thread 2023-08-16 16:29:28 +03:00
Rémi Verschelde 6b5e44f3ca
Merge pull request #80510 from dalexeev/gds-fix-access-inner-class-from-inside
GDScript: Fix "Identifier not found" error when accessing inner class from inside
2023-08-14 15:28:57 +02:00
Rémi Verschelde e1bb9b523d
Merge pull request #80506 from sepTN/fix-lambda-get_method
Fix `get_method` from named lambda
2023-08-14 09:36:35 +02:00
MewPurPur 93318d2dd5 Optimize and fix up some SVGs 2023-08-13 17:48:17 +03:00
Markus Sauermann fa8fec2cc1 Fix superfluous `"` in error message 2023-08-13 00:38:10 +02:00
Septian 793cc080cb Fix `get_method` from named lambda 2023-08-11 20:31:08 +07: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
Rémi Verschelde 40363a88bd
Merge pull request #80283 from ajreckof/fix-completion-option-location-not-found
Fix completion option location not found
2023-08-07 14:53:10 +02:00
Rémi Verschelde 87c91dc452
Merge pull request #79761 from dalexeev/gds-hl-comment-markers
GDScript: Highlight comment markers (`TODO`, `FIXME`, etc.)
2023-08-07 14:49:09 +02:00
Rémi Verschelde faaf27f284
Fix various typos with codespell
Also includes typo fixes from #79993, #80068, #80276, and #80303.

Co-authored-by: betalars <contact@betalars.de>
Co-authored-by: spaceyjase <429978+spaceyjase@users.noreply.github.com>
Co-authored-by: Swarkin <102416174+Swarkin@users.noreply.github.com>
Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-08-07 13:09:47 +02:00
Danil Alexeev 54231682ba
GDScript: Highlight comment markers (`TODO`, `FIXME`, etc.) 2023-08-07 11:33:51 +03:00
ajreckof 4b724c9252 Fix completion option location not found 2023-08-05 02:15:45 +02:00
Rémi Verschelde 95d71dbad1
Merge pull request #80165 from dalexeev/gds-fix-native-signal-not-found
GDScript: Fix regression with native signal not found
2023-08-03 14:46:48 +02:00
Rémi Verschelde 5e1671afd9
Merge pull request #78540 from anvilfolk/gdresloaderr
GDScript: Add error message when a GDScript resource fails to load.
2023-08-03 14:46:33 +02:00
Danil Alexeev f19377160c
GDScript: Fix regression with native signal not found 2023-08-02 15:42:36 +03:00
Yuri Sizov f37d192860 Merge pull request #80109 from timothyqiu/not-markdown
Fix invalid use of markdown syntax in classref
2023-08-01 20:04:00 +02:00
Yuri Sizov 79e28e0914 Merge pull request #80020 from dalexeev/gds-pot-gen-const-string
GDScript: Add constant string support for POT generator
2023-08-01 20:03:56 +02:00
Yuri Sizov f6e02dc437 Merge pull request #79990 from vnen/gdscript-assume-op-types
GDScript: Optimize operators by assuming the types
2023-08-01 17:25:52 +02:00
Yuri Sizov 68a49c4959 Merge pull request #79935 from dalexeev/gds-validate-node-path-annotation
GDScript: Add validation for `@export_node_path` annotation arguments
2023-08-01 17:25:44 +02:00
Haoyu Qiu c4b5161ed1 Fix invalid use of markdown syntax in classref
Also:
* changed `[b]true[/b]` to `[code]true[/code]`
* use `[i]` for mathematical constant "e"
* use `[b]` for button text & menu item text
* improve markups about "tap1" and "tap2" in AudioEffectDelay
2023-08-01 22:44:31 +08: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 41efc7cb86 Merge pull request #78941 from dalexeev/gds-doc-comments-deprecated-and-experimental
GDScript: Add `@deprecated` and `@experimental` doc comment tags
2023-07-31 21:01:08 +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
Yuri Sizov 62b4643d85 Merge pull request #73226 from AThousandShips/gdscript_tok_improvement
Improve GDScript identifier tokenization
2023-07-31 21:00:57 +02:00
ocean (they/them) cca57171c1 Add error message when a GDScript resource fails to load.
Currently, GDScripts who are only loaded through `ResourceLoader::load()`,
like Autoloads, do not have a pathway to announce there is an error in their
code. This contributes to significant confusion in error projects when
autoloads are involved. At least partially closes #78230.
2023-07-31 13:16:29 -04:00
Danil Alexeev ae42c23e09
GDScript: Add constant string support for POT generator 2023-07-29 19:24:48 +03:00
George Marques c1bca65d09
GDScript: Optimize operators by assuming the types
This assumes that operators are called usually with the same type of
operands as the first time. So it stores the types of the first run and
if matched it uses an optimized path by calling the validated operator
function directly. Otherwise it uses the regular untyped evaluator.

With this change, if operators do use the same type they run quite
faster. OTOH, if the types mismatch it takes longer to run than they
would with the previous code.
2023-07-28 13:08:21 -03:00
Danil Alexeev 5b4403c9a5
GDScript: Add validation for `@export_node_path` annotation arguments
Co-authored-by: George Marques <george@gmarqu.es>
2023-07-26 20:36:47 +03:00
Juan Linietsky 5e512b705e Support threads in the script debugger
* This implementation adds threads on the side of the client (script debugger).
* Some functions of the debugger are optimized.
* The profile is also now thread safe using atomics.
* The editor can switch between multiple threads when debugging.

This PR adds threaded support for the script language debugger. Every thread has its own thread local data and it will connect to the debugger using multiple thread IDs.
This means that, now, the editor can receive multiple threads entering debug mode at the same time.
2023-07-26 12:06:45 +02:00
Danil Alexeev d53fc92b4c
GDScript: Fix bug with identifier shadowed below in current scope 2023-07-26 11:26:57 +03:00
Yuri Sizov 0e1c9531b5 Merge pull request #75620 from jpcerrone/fix_shadow_warnings_not_going_away_after_ignoring
Fix for not being able to ignore shadowing warnings on class scope
2023-07-25 21:25:45 +02:00
jpcerrone 13c73500ab Fix for not being able to ignore shadowing warnings on class scope 2023-07-24 17:22:12 -03:00
Yuri Sizov 74d20fe17e Merge pull request #75216 from rune-scape/rune-dependancy-errors
Script editor (GDScript): Show depended script errors
2023-07-24 19:32:20 +02:00
Yuri Sizov 2bd904e3db Merge pull request #73196 from Vilcrow/fix-lookup-symbol
Fix jumping to function definition using `Ctrl+LMB` or the "Lookup Symbol" button
2023-07-24 19:32:12 +02:00
rune-scape 83b01708b2 Script editor: Show depended script errors 2023-07-24 15:49:39 +02:00
Yuri Sizov de0f7935dd Merge pull request #79524 from aaronfranke/gds-test-inst-placeholder
Change GDScript tests to use InstancePlaceholder as the example abstract class
2023-07-21 17:15:32 +02:00
Fredia Huya-Kouadio d17811c814 Re-architect how Android plugins are packaged and handled at export time
The previous packaging format for Godot Android plugins consisted of the plugin's `gdap` config file accompanied by binaries defined in the `gdap` file.
This format is now deprecated (starting with Godot 4.2), and instead Godot Android plugins are now packaged as `EditorExportPlugin` plugins.

The `EditorExportPlugin` class has been updated with the following methods to provide the necessary set of functionality:
- `_supports_platform`: returns true if the plugin supports the given platform
- `_get_android_dependencies`: retrieve the set of android dependencies (e.g: `org.godot.example:my-plugin:0.0.0`) provided by the plugin
- `_get_android_dependencies_maven_repos`: retrieve the urls of the maven repos for the provided android dependencies
- `_get_android_libraries`: retrieve the local paths of the android libraries (AAR files) provided by the plugin
- `_get_android_manifest_activity_element_contents`: update the contents of the `<activity>` element in the generated Android manifest
- `_get_android_manifest_application_element_contents`: update the contents of the `<application>` element in the generated Android manifest
- `_get_android_manifest_element_contents`: update the contents of the `<manifest>` element in the generated Android manifest
2023-07-18 19:14:53 +02:00
Yuri Sizov 2c55214068
Merge pull request #79205 from anvilfolk/populate-class-members
GDScript: Solve `_populate_class_members()` cyclic dependency problem
2023-07-17 19:15:16 +02:00
Aaron Franke 6a8a9cd279
Change GDScript tests to use InstancePlaceholder as the example abstract 2023-07-15 18:28:08 -05:00
Yuri Sizov d5a30f7af8 Merge pull request #79163 from anvilfolk/fullscripterror
GDScript: Add static analysis error reporting in GDScriptCache::get_full_script()
2023-07-14 18:49:32 +02:00
George Marques 80ba1e0614
GDScript: Load global classes when running debug tests
So when running compiler debug tests it works with dependencies within a
project.
2023-07-13 13:05:42 -03:00
S.V.I. Vilcrow 56e2fad319 Fixed the jumping to function definition using 'Ctrl+LMB' and the 'Lookup Symbol' button. 2023-07-12 21:30:35 +03:00
George Marques cbfe2b61b6
GDScript: Properly track extents of constants and patterns
Even in the case of errors.
2023-07-12 10:57:11 -03:00
Rémi Verschelde 8a06ec979e
Change explicit 'Godot 4.0' references to 'Godot 4'
Fixes #79276.
2023-07-10 13:08:11 +02:00
ocean (they/them) 7d29ac0bf2 GDScript: solve `_populate_class_members()` cyclic dependency problem 2023-07-08 15:34:20 -04:00
Danil Alexeev c1b450566a
GDScript: Add `@deprecated` and `@experimental` doc comment tags 2023-07-08 18:13:19 +03:00
ocean (they/them) 955049670f GDScript: Add static analysis error reporting in GDScriptCache::get_full_script() 2023-07-07 11:16:22 -04:00
Rémi Verschelde 69dbbcc313
Merge pull request #79092 from akien-mga/doctool-remove-version-attribute
Doctool: Remove version attribute from XML header
2023-07-07 08:34:55 +02:00
Rémi Verschelde b3c2b52025
Merge pull request #78953 from anvilfolk/enum-desc
Fix regression with GDScript enum descriptions now showing up in documentation.
2023-07-07 08:31:44 +02:00
Rémi Verschelde 81064cc239
Doctool: Remove version attribute from XML header
We don't use that info for anything, and it generates unnecessary diffs
every time we bump the minor version (and CI failures if we forget to
sync some files from opt-in modules (mono, text_server_fb).
2023-07-06 10:08:21 +02:00
Rémi Verschelde 346f1ab86b
Bump version to 4.2-dev
Keep on waitin'
2023-07-05 22:07:03 +02:00
ocean (they/them) d48636c3bf Fix regression with enum descriptions now showing up in documentation. 2023-07-02 11:29:52 -04:00
Gilles Roudière 538c4b62b7 Explain a bit more RPCs options 2023-06-27 11:25:15 +02:00
Rémi Verschelde af16013905
Merge pull request #78571 from MewPurPur/include-extension-info
Document file extensions of GDScript, CSharpScript, and Shader
2023-06-22 18:32:25 +02:00
MewPurPur 8848c395b6 Add information about file extension to GDScript, CSharpScript, and Shader 2023-06-22 18:56:08 +02:00
Danil Alexeev 84c8946565
GDScript: Remove unnecessary name check in `_get_property_list()` 2023-06-22 12:41:44 +03:00
Rémi Verschelde f2ce0b6741
Merge pull request #78521 from jpcerrone/fix_static_vars_refs
Fix errors destroying script with static variables
2023-06-21 21:52:15 +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
jpcerrone 8ce8216d17 Fix errors destroying script with static variables
Fixes #78376
After #78138 'script_list' is now cleared in 'GDScriptLanguage::finish'
Because of that, we can safely remove the removal from that list that
happens on 'GDScript::~GDScript'.
2023-06-21 12:33:21 -03:00
今井きなみ bf04c55175 Fix lambda parsing continuing on subsequent lines #73273 2023-06-21 12:56:57 +02:00
Yuri Sizov f1e79e2581 Make container element type comparison safe 2023-06-20 17:04: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
Danil Alexeev 5d3f5e8cf2
GDScript: Fix crash in disassembler 2023-06-19 23:50:33 +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 5f9175f969
Merge pull request #76954 from Rindbee/return-null-on-fail-load-script
Returns null and does not cache when the source code of the script fails to load
2023-06-19 21:17:47 +02:00
Rémi Verschelde cfae05094a
Merge pull request #72824 from dalexeev/gds-invalid-char-error
GDScript: Fix invalid character error message
2023-06-19 15:39:58 +02:00
Ben 0803467334
Fix "Go to definition" for GDScript type hints
Fixes #68475.
2023-06-19 15:29:25 +02:00
Fabio Alessandrelli 116f783db7
Merge pull request #76207 from dalexeev/clarify-rpc-docs
Clarify `@rpc` annotation arguments docs
2023-06-18 21:34:34 +02:00
Rémi Verschelde fcc39d498b
Merge pull request #75051 from AleryBerry/fix-error-message-lua-style
GDScript: Fix error message for LUA-style dictionary
2023-06-18 16:28:36 +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
Rémi Verschelde 11ee6fcef0
Merge pull request #68311 from RobertMasek/fix-go-to-definition
Fix functionality of Go To Definition for properties set/get
2023-06-18 16:26:42 +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 3b4504afea
Merge pull request #75944 from akien-mga/style-modules-includes
Style: Harmonize header includes in modules
2023-06-15 15:26:14 +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
Rindbee cbce374f68 Returns null and does not cache when the source code of the script fails to load
This usually means that an `ERR_FILE*` error occurred.

Previously, using `GDScriptCache::get_full_script()` would ignore errors during loading.
Now, all errors are not ignored.

Judging in which period the error occurred, it can be judged based on the return value:
1. null + err : Error during script loading (load_source_code()).
2. script + err: Error during script parsing.
2023-06-15 21:06:10 +08:00
Rémi Verschelde 25b2f1780a
Style: Harmonize header includes in modules
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module ("local" includes) should be listed
first in their own block using relative paths, before Godot's "core" includes
which use "absolute" (project folder relative) paths, and finally thirdparty
includes.

Includes in `#ifdef`s come after their relevant section, i.e. the overall
structure is:

- Local includes
  * Conditional local includes
- Core includes
  * Conditional core includes
- Thirdparty includes
  * Conditional thirdparty includes
2023-06-15 14:35:45 +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
Rémi Verschelde 72b8d397d0
GDScript: Further restrict test error output for C++ errors
MSVC and GCC/Clang also have different function names...
2023-06-14 13:28:52 +02:00
Rémi Verschelde c40adf027d
GDScript: Only include script file path in test error output
Errors originating in C++ files cause unnecessary diffs whenever the engine is updated
(line number changes, etc.) and would cause CI failures due to different formatting
of the file path on Windows (backslashes, worked around here anyway) and when using
SCU builds (`../scu` insert).
2023-06-14 10:54:49 +02:00
Rémi Verschelde 5145098e6e
Merge pull request #78138 from KoBeWi/are_we_clear
Clear SelfList when destroying GDScriptLanguage
2023-06-14 09:25:34 +02:00
Rémi Verschelde 8b62c52d1c
Merge pull request #75419 from vonagam/fix-super-classes-in-array-literals
GDScript: Allow elements of a parent class in a typed array literal
2023-06-14 09:23:32 +02:00
Danil Alexeev ddd9aa11b3
Clarify `@rpc` annotation arguments docs 2023-06-13 21:33:48 +03:00
Rémi Verschelde eb86dabee0
Merge pull request #77151 from dalexeev/gds-fix-call-static-from-non-static
GDScript: Fix calling static func from non-static is allowed
2023-06-13 18:54:19 +02:00
kobewi c646f7df70 Clear SelfList when destroying GDScriptLanguage 2023-06-12 16:04:26 +02:00
Rémi Verschelde 577ab3c565
Merge pull request #75746 from ajreckof/order_autocomplete
Sort code autocompletion with rules
2023-06-08 18:14:31 +02:00
Danil Alexeev 049a49cac0
GDScript: Fix doc comment parsing (newlines and spaces) 2023-06-05 16:00:46 +03:00
Danil Alexeev f3bf75fbb4
GDScript: Reset local variables on exit from block 2023-06-02 13:20:19 +03:00
Ninni Pipping 5e3c625e24 Add more info on the nature of NAN 2023-05-30 15:38:10 +02:00
Yuri Sizov 490a76edc8
Merge pull request #76526 from MewPurPur/improve-docs-top-sections-CORE
Overhaul the top sections of the class reference (Core classes)
2023-05-29 17:08:40 +02:00
Haoyu Qiu 3e88c4cd5c Fix extraction of chained tr() calls 2023-05-27 10:38:37 +08:00
ajreckof 006e899bb3 sort code completions with rules
Fixups

Add levenshtein distance for comparisons, remove kind sort order, try to improve as many different use cases as possible

Trying again to improve code completion

Sort code autocompletion options by similarity based on input

To make it really brief, uses a combination `String.similiary`, the category system introduced in a previous PR, and some filtering to yield more predictable results, instead of scattering every completion option at seemingly random.

It also gives much higher priority to strings that contain the base in full, closer to the beginning or are perfect matches.

Also moves CodeCompletionOptionCompare to code_edit.cpp

Co-Authored-By: Micky <66727710+Mickeon@users.noreply.github.com>
Co-Authored-By: Eric M <41730826+EricEzaM@users.noreply.github.com>
2023-05-23 05:12:34 +02:00
ocean (they/them) 25c90836fd GDScript: do not warn of return value discarded for super() inside _init()
DO NOT BATCH MERGE WITH #77324, WILL RESULT IN BROKEN CI

Currently, calling super() inside _init() throws a
RETURN_VALUE_DISCARDED warning. The analyzer identifies super() as being a
constructor, which therefore returns an object of the relevant class.
However, super() isn't really a constructor by itself: in this case, it
is _part_ of the constructor, and so doesn't "return" a value.

A test case for this is already in #77324, which contains the warning. I
am duplicating it here, without the warning, and it should conflict with
the other PR.
2023-05-22 09:29:34 -04:00
Rémi Verschelde 06d337af80
Merge pull request #75943 from adamscott/fix-missing-script-type-nullptr-check
Add missing `script_type` `nullptr` check
2023-05-22 13:48:32 +02:00
VolTer 04562662d3 Overhaul the top sections of the class reference (Core classes) 2023-05-19 07:04:48 +02:00
Max Hilbrunner ad21fb0f92 Docs: Point to @GDScript in GDscript (script impl) 2023-05-17 13:47:33 +02:00
Danil Alexeev 3bf72be625
GDScript: Fix calling static func from non-static is allowed 2023-05-17 10:25:03 +03:00
Danil Alexeev 7da3110e6b
GDScript: Fix `validate_call_arg()` for unresolved datatype 2023-05-15 12:13:52 +03:00
Danil Alexeev c2fbb40e9a
GDScript: Fix warning ignoring for member variables 2023-05-12 17:43:58 +03:00
smix8 a6ac305f96 Rework Navigation Avoidance
Rework Navigation Avoidance.
2023-05-10 05:01:58 +02:00
Rémi Verschelde 1d87b36760
Merge pull request #76824 from Calinou/doc-export-pck-binary-resource-conversion
Document caveats related to exported project binary resource conversion
2023-05-09 19:28:46 +02:00
Rémi Verschelde c2ba89d9d1
Merge pull request #76790 from achernik/master
LSP: don't send empty completion command
2023-05-09 19:28:42 +02:00
Rémi Verschelde 10ed1d87df
Merge pull request #76490 from dsnopek/dump-gdscript-docs
Dump API docs from inline GDScript comments using --doctool --gdscript-docs PATH
2023-05-09 19:28:30 +02:00
David Snopek a64137d5dd Dump API docs from inline GDScript comments using --doctool --gdscript-docs PATH 2023-05-08 11:00:29 -05:00
Hugo Locurcio febc674f48
Document caveats related to exported project binary resource conversion 2023-05-08 07:02:00 +02:00
Александр Черник 5715d3eb59 LSP: don't send empty completion command 2023-05-06 20:56:15 +01:00
Max Hilbrunner 921d231ad6
Merge pull request #76664 from Xenoparrot/simple-typos 2023-05-06 15:41:55 +02:00
Clay John 610877e326
Merge pull request #72288 from MewPurPur/use-string-repeat
Use `String.repeat()` to optimize several String methods
2023-05-05 09:56:48 -07:00
Max Hilbrunner ce75c46331
Merge pull request #76650 from Koyper/gdscript_range_docs 2023-05-05 17:09:56 +02:00
UltraBIF 8106d33d0f Fixed various typos across the docs 2023-05-02 18:24:32 -04:00
Koyper bcce315a9a Update @GDScript.xml range docs to iterate backwards. 2023-05-01 11:03:48 -05:00
VolTer 6b84e258d2 Use String.repeat() in more places 2023-05-01 02:27:46 +02:00
Rémi Verschelde f37fc4e708
Merge pull request #76412 from dalexeev/gds-reorganize-warnings
GDScript: Reorganize and unify warnings
2023-04-28 18:45:48 +02:00
Rémi Verschelde 0762f20410
Merge pull request #75732 from vonagam/fix-duplicate-condition
GDScript: Fix unnecessary duplication of pointed out lines
2023-04-28 18:45:25 +02:00
Rémi Verschelde f374390fc1
Merge pull request #75014 from vonagam/assert-literal-false
GDScript: Allow usage of literal false in assert without a warning
2023-04-28 18:45:00 +02:00
Danil Alexeev 13310f3557
GDScript: Reorganize and unify warnings 2023-04-28 18:25:11 +03:00
Rémi Verschelde 7780926b25
GDScript: Fix template_debug compilation with TOOLS/DEBUG macro mismatch 2023-04-28 11:09:12 +02:00
George Marques 0ba6048ad3
Add support for static variables in GDScript
Which allows editable data associated with a particular class instead of
the instance. Scripts with static variables are kept in memory
indefinitely unless the `@static_unload` annotation is used or the
`static_unload()` method is called on the GDScript.

If the custom function `_static_init()` exists it will be called when
the class is loaded, after the static variables are set.
2023-04-27 09:51:44 -03:00
Rémi Verschelde 352ebe9725
Merge pull request #76483 from vnen/gdscript-dont-fail-returning-freed-object
GDScript: Don't fail when freed object is return
2023-04-27 08:47:04 +02:00
Rémi Verschelde 58439ac22c
Merge pull request #74053 from vnen/gdscript-fix-disassembler-lambda-crash
GDScript: Fix wrong increment for disassembly of lambda
2023-04-27 08:46:40 +02:00
Rémi Verschelde 35f6a1387c
Merge pull request #76488 from YuriSizov/docs-validate-code-params
Validate code tags in documentation for potential params
2023-04-27 08:20:42 +02:00
Rémi Verschelde 80568be36f
Merge pull request #76481 from vnen/gdscript-test-gen-default-path
GDScript: Use default path in test generator if not provided
2023-04-27 08:19:54 +02:00
Yuri Sizov 391eccca76 Validate code tags in documentation for potential params
Adds a check to make_rst to look for matches
between the text inside of the [code][/code] tag
and known param identifiers.
Fixes most of what was revealed.
2023-04-26 21:36:04 +02:00
Yuri Sizov 26fb911f79
Merge pull request #72095 from anvilfolk/gd-docs
Improve GDScript documentation generation & behavior
2023-04-26 16:54:25 +02:00
Ninni Pipping f68beeb7fa Improvements to GDScript identifier tokenization 2023-04-26 16:29:04 +02:00
George Marques 221deb1cc1
GDScript: Use default path in test generator if not provided
Since it's almost always used with the same path, assume it is running
from the Godot source root.
2023-04-26 11:12:47 -03:00
George Marques abbdf80643
GDScript: Don't fail when freed object is return
This is check is a bit too eager. The user should be able to handle the
return value even if it's a freed object.
2023-04-26 10:57:22 -03:00
Rémi Verschelde 45cd5dcad3
Merge pull request #75885 from AThousandShips/compound_fix
[GDScript] Fix incorrect compound assignment
2023-04-25 16:17:02 +02:00
Rémi Verschelde a98997bb45
Merge pull request #76404 from sodaJar/gdrep
Fix wrong file name on function call error
2023-04-25 10:00:19 +02:00
Rémi Verschelde 15d952147c
Merge pull request #74101 from RandomShaper/fix_gds_obj_temps
Fix edge cases of object lifetime when signals involved
2023-04-25 09:58:17 +02:00
Rémi Verschelde d45c6fd591
Merge pull request #76095 from adamscott/fix-rename-lsp-variables
[LSP] Fix GDScript inner method variable rename
2023-04-24 16:44:44 +02:00
Rémi Verschelde 54b0e8123e
Merge pull request #75605 from anvilfolk/type-base
Make GDScript type not found errors more informative.
2023-04-24 16:43:32 +02:00
sodaJar 464a299d2e Fix wrong file on function call error 2023-04-24 15:30:51 +02:00
Adam Scott 10fe6f14bb Fix GDScript LSP variable rename 2023-04-22 14:35:34 -04:00
ocean (they/them) 6783ff69c0 Improve and fix GDScript documentation generation & behavior
Removes documentation generation (docgen) from the GDScript compiler to
its own file. Adds support for GDScript enums and signal parameters and
quite a few other assorted fixes and improvements.
2023-04-21 10:17:30 -04:00
Rémi Verschelde bf62af334b
Merge pull request #76286 from MystMagus/gdscript-mixed-tabs-and-spaces-fix
Fix for mixed tabs and spaces in gdscript
2023-04-20 18:08:47 +02:00
MistMage fecbc12d17 Fix for mixed tabs and spaces in gdscript 2023-04-20 12:08:23 +02:00
Danil Alexeev dbc3c82043
GDScript: Add some checks for `@tool` and `@icon` 2023-04-20 07:44:10 +03:00
Yuri Sizov f3033da97d
Merge pull request #76170 from HolonProduction/string-highlight
Fix multi-line string highlighting with single quotes.
2023-04-18 18:01:02 +02:00
Yuri Sizov 9882af4880
Merge pull request #76197 from dalexeev/fix-error-macro-misuses
Fix misuses of error macros
2023-04-18 16:11:37 +02:00
Yuri Sizov e31d391d56
Merge pull request #76090 from adamscott/fix-typo-lsp-parse-func-parameters
[LSP] Fix typo in parse function parameters
2023-04-18 15:57:08 +02:00
RedMser 2330ffb5a1 Add GDScript template to RichTextEffect 2023-04-18 14:02:04 +02:00
Danil Alexeev 36bedd341a
Fix misuses of error macros 2023-04-18 10:20:48 +03:00
Yuri Sizov 6596a6c1b5
Merge pull request #72979 from dalexeev/gds-annotation-parsing
GDScript: Fix and improve annotation parsing
2023-04-17 17:14:58 +02:00
Yuri Sizov d220680bd0
Merge pull request #62830 from ajreckof/access-identifier-keywords
fix access to identifiers that are reserved keywords
2023-04-17 17:12:10 +02:00
HolonProduction bdb7045e2c Fix multi-line string highlighting with single quotes. 2023-04-17 15:58:39 +02:00
Adam Scott 879791e305 Fix typo when parsing LSP function parameters 2023-04-15 09:05:53 -04:00
ajreckof ab9f60dd1a fix access to identifiers that are reserved keywords 2023-04-14 20:37:24 +02:00
Danil Alexeev 5038a336be
GDScript: Fix and improve annotation parsing 2023-04-14 21:28:46 +03:00
Yuri Sizov a7276f1ce0
Merge pull request #75691 from dalexeev/gds-fix-signature-generation
GDScript: Misc fixes and improvements for signature generation
2023-04-14 20:01:27 +02:00
Yuri Sizov afca0b8fdd
Merge pull request #75879 from dalexeev/gds-fix-extends-crash
GDScript: Add missing member type check when resolving `extends`
2023-04-14 13:21:54 +02:00
Ninni Pipping e5365da03c [GDScript] Fix incorrect compound assignment
Reverts in-place compound assignments

Added test to ensure correctness
2023-04-14 11:28:44 +02:00
Adam Scott 1236302388 Add missing `script_type` `nullptr` check
Co-authored-by: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
2023-04-11 12:36:28 -04:00
Pedro J. Estébanez 2f4168daeb Fix edge cases of object lifetime when signals involved 2023-04-11 17:27:39 +02:00
George Marques 59b8c70007 GDScript: Don't use pool for reference types
Since they need to be properly initialized and finalized to adjust the
reference counter.
2023-04-11 16:46:31 +02:00
Fabio Alessandrelli 4ab0b38940
Merge pull request #75850 from rsubtil/bugfix-lsp_dap_connection_poll
Poll LSP/DAP clients for connection status updates
2023-04-11 10:19:24 +02:00
Danil Alexeev 66279b98b6
GDScript: Add missing member type check when resolving `extends` 2023-04-10 17:16:07 +03:00
VolTer f832eb92e4 Fix mistakes in documentation and GDScript errors 2023-04-10 10:00:09 +02:00
Ricardo Subtil 4be4eeea3a Poll LSP/DAP clients for connection status updates 2023-04-09 12:36:01 +01:00
Danil Alexeev 9df96e97ea
GDScript: Misc fixes and improvements for signature generation
* Use type hints for `@GlobalScope` enums.
* Use plain `int` for `BitMask<T>`.
* Fix type hints for typed arrays.
* Use `Variant` and `void` type hints.
* Discard unnecessary class prefix.
2023-04-07 10:43:21 +03:00
Dmitrii Maganov 5dc717c5fd GDScript: Fix unnecessary duplication of pointed out lines 2023-04-06 06:12:32 +03:00
ocean (they/them) 5d164df4e1 Make type not found errors more informative.
This PR removes a check for whether a datatype is a meta type when
generating a datatype's to_string() result. This means that error
messages that fail to find the type will now print their class names,
which is much more useful when trying to identify errors.
2023-04-02 18:30:30 -04:00
Araraura e1c0df7048
Fix typo and slightly reword in @GDScript.xml
Fix "the every following property" to "then every following property" and change "is added" to "will be added".
2023-03-31 20:30:29 +00:00
Dmitrii Maganov 8655d979a1 GDScript: Allow elements of a parent class in a typed array literal 2023-03-28 13:47:24 +03:00
AleryBerry 0550f3682b GDScript: Fix error message for Lua-style dictionary 2023-03-20 21:45:06 +00:00
Yuri Sizov a008a06fcb
Merge pull request #72056 from resistor/master
[GDScript] Perform update-and-assign operations in place when possible.
2023-03-20 19:16:30 +01:00
Yuri Sizov 215893ebca
Merge pull request #74949 from dalexeev/gds-fix-await-warning
GDScript: Fix false positive `REDUNDANT_AWAIT` warning
2023-03-20 19:14:15 +01:00
Yuri Sizov 5461b9976c
Merge pull request #74844 from vonagam/change-class-extends-parsing
GDScript: Change parser representation of class extends
2023-03-20 19:13:23 +01:00
Yuri Sizov a5f34744a2
Merge pull request #74842 from vonagam/fix-builtin-shadow
GDScript: Fix missing warning for shadowing of built-in types
2023-03-20 19:10:13 +01:00
Hugo Locurcio 4e4555bea5
Improve Color8 documentation
This documents in which situations Color8 is most suited and its
precision limitations.
2023-03-19 17:42:15 +01:00
Dmitrii Maganov 5d0b183822 GDScript: Allow usage of literal false in assert without a warning 2023-03-17 05:37:56 +02:00
Danil Alexeev c0eeb32e38
GDScript: Fix false positive `REDUNDANT_AWAIT` warning 2023-03-16 14:04:14 +03:00
Dmitrii Maganov 4e34cf238a GDScript: Change parser representation of class extends 2023-03-13 01:40:13 +02:00
Dmitrii Maganov 703274fd04 GDScript: Fix missing warning for shadowing of built-in types 2023-03-13 00:49:34 +02:00
George Marques d76b3f2a4c
GDScript: Allow boolean operators between any types
To make consistent with previous behavior. Mostly to be used in
conditions for `if` and `while`.
2023-03-10 16:01:17 -03:00
Dmitrii Maganov e289a4ab2c GDScript: Fix autocomplete inside a block with a type test condition 2023-03-09 23:53:27 +02:00
Yuri Sizov 496bd94c21 Prevent cache corruption when saving resources in the editor 2023-03-08 19:46:55 +01:00
Rémi Verschelde 9eaaeef76d
Merge pull request #73410 from MewPurPur/Fixin-error-spam-2-Electric-Boogaloo
Fix error spam when naming a func at the end of the script
2023-03-08 08:54:57 +01:00
VolTer 07dd627728 Fix error spam when naming a func at the end of the script 2023-03-07 23:42:40 +01:00
Rémi Verschelde 2a5fc1fe6c
Merge pull request #74306 from dalexeev/gds-var-colon-style
Fix GDScript code style regarding colon
2023-03-06 10:49:11 +01:00
Danil Alexeev ea5fd3d732
Fix GDScript code style regarding colon 2023-03-05 17:03:20 +03:00
Rémi Verschelde a0134f7fbc
Merge pull request #74147 from vonagam/fix-call-await-check-in-compiler
GDScript: Fix checking if a call is awaited in compiler
2023-03-05 13:23:27 +01:00
Rémi Verschelde 326c0f324a
Merge pull request #74184 from MewPurPur/fix-number-highlighting-in-wrong-places
Make GDScript Number highlighting stricter
2023-03-03 11:07:04 +01:00
VolTer 952703d921 Make GDScript number highlighting stricter 2023-03-01 21:27:32 +01:00
Dmitrii Maganov 55a2ad25bf GDScript: Fix checking if a call is awaited in compiler 2023-03-01 09:31:35 +02:00
Rémi Verschelde 1c1524a651
Bump version to 4.1-dev
Can't stop, won't stop, they said, huh?
2023-03-01 01:44:37 +01:00
Rémi Verschelde 491ded1898
Minor typo and docs URL fixes 2023-02-28 13:38:01 +01:00
George Marques 5b49382d38
GDScript: Fix wrong increment for disassembly of lambda 2023-02-27 11:19:22 -03:00
voidedWarranties bd5ab9f9b4 Remove unused `ScriptLanguage` methods 2023-02-26 22:30:56 -08:00
Rémi Verschelde c0f1ed57c4
Merge pull request #73915 from vonagam/fix-conversions-from-native-member
GDScript: Fix conversions from native members accessed by identifier
2023-02-26 19:02:27 +01:00
Rémi Verschelde 1bd0b296e1
Merge pull request #73964 from vonagam/fix-coroutine-compiler-type
GDScript: Fix address type for coroutine results
2023-02-26 16:00:17 +01:00
Rémi Verschelde 92d47f84fe
Merge pull request #73957 from vonagam/fix-binary-op-safety
GDScript: Fix wrong unsafety mark for binary operator
2023-02-26 15:59:54 +01:00
Rémi Verschelde c118790eb9
Merge pull request #73899 from vnen/gdscript-init-defaults-beforehand
GDScript: Initialize all defaults beforehand in implicit constructor
2023-02-26 15:59:27 +01:00
Dmitrii Maganov 4efaf15605 GDScript: Fix address type for coroutine results 2023-02-26 08:30:46 +02:00
Dmitrii Maganov 638aa4f811 GDScript: Fix wrong unsafety mark for binary operator 2023-02-26 01:35:53 +02:00
George Marques eba984a44f
Revert "GDScript: Fix groups and categories been seen as members"
This reverts commit 6f2a8434c6.

The commit introduces a bug where it creates spurious entries for member
information.
2023-02-25 13:40:31 -03:00
Dmitrii Maganov 281c8c75d3 GDScript: Fix conversions from native members accessed by identifier 2023-02-25 10:53:36 +02:00
George Marques 0e6aa6fc38
GDScript: Initialize all defaults beforehand in implicit constructor
Set all the default values for typed variables before actually trying to
initialize them, including `@onready` ones.

This ensures that if validated calls are being used there will be a
value of the correct type, even if the resolution is done out of order
or deferred because of `@onready`.
2023-02-24 22:01:06 -03:00
George Marques defa46bfd1
GDScript: Don't use validated call for vararg methods
Since they may have runtime type validation, we cannot use the validated
call.
2023-02-24 14:06:02 -03:00
Rémi Verschelde a6baebc7c2
Fixup GDScript test using non-deterministic ids
Follow-up to #73870.
2023-02-24 14:31:36 +01:00
Rémi Verschelde 7e00cc1f7a
Merge pull request #73870 from vnen/gdscript-dont-reference-group-properties
GDScript: Fix groups and categories been seen as members
2023-02-24 14:08:20 +01:00
George Marques 6f2a8434c6
GDScript: Fix groups and categories been seen as members 2023-02-24 10:03:12 -03:00
Dmitrii Maganov 55c5774be9 GDScript: Fix range regression 2023-02-24 00:35:11 +02:00
Rémi Verschelde 76d80c2cba
Merge pull request #73798 from vonagam/fix-bad-continue-in-lambda
GDScript: Fix parsing unexpected break/continue in lambda
2023-02-23 13:54:56 +01:00
Dmitrii Maganov b0b1eaeb6d GDScript: Fix parsing unexpected break/continue in lambda 2023-02-23 10:49:06 +02:00
Dmitrii Maganov 7ee011051a GDScript: Fix usage of enum value as range argument 2023-02-23 10:38:53 +02:00
mashumafi 2a12213c31 Fix: Typed arrays aren't working with + 2023-02-22 18:42:26 -05:00
Danil Alexeev a98a0f5d34
Document `@GDScript.is_instance_of` method 2023-02-22 17:06:55 +03:00
Rémi Verschelde 56622b8ec3
Merge pull request #73709 from vonagam/fix-error-message-unfound-type
GDScript: Fix error message for unfound type
2023-02-21 23:36:29 +01:00
Rémi Verschelde d4bec5855e
Merge pull request #73705 from anvilfolk/doublewoopsie
Added check for null objects in gdscript typed assign.
2023-02-21 23:36:06 +01:00
Rémi Verschelde 49c1902a04
Merge pull request #73689 from vnen/gdscript-fix-inheritance-native-class
GDScript: Fix setting native type with script inheritance
2023-02-21 23:35:18 +01:00
Dmitrii Maganov 2a08739f30 GDScript: Fix error message for unfound type 2023-02-21 23:00:29 +02:00
ocean (they/them) 9ddf482a06 Added check for null objects in gdscript typed assign. 2023-02-21 15:29:07 -05:00
Rémi Verschelde 253396ba39
Merge pull request #73693 from vnen/gdscript-fix-script-signature-check
GDScript: Fix override signature check of script inheritance
2023-02-21 21:19:39 +01:00
Rémi Verschelde 31726fa945
Merge pull request #73680 from vnen/gdscript-div-by-zero-crash-fix
GDScript: Avoid validated division operation to test for zero
2023-02-21 21:19:15 +01:00
George Marques 1731010774
GDScript: Fix override signature check of script inheritance
Avoid treating the super class as a meta type for signature check, since
it is looking at the instance level for that.
2023-02-21 14:37:08 -03:00
George Marques d076c76551
GDScript: Fix setting native type with script inheritance
Sometimes the inheritance tree is compiled out of order and the base
don't have yet a native type set. This is now changed to not rely on the
base script but use the native type set in the datatype, which is
already resolved by the analyzer.
2023-02-21 14:09:10 -03:00
George Marques 0866e6af2d
GDScript: Avoid validated division operation to test for zero
The validated operations for integer division and modulo do not check
for division by zero. This avoids validated operation in these cases to
make sure the check is performed and avoid crashing the engine.
2023-02-21 11:12:45 -03:00
George Marques 91b93465d5
GDScript: Fix crash when autoload script can't be found 2023-02-21 10:45:24 -03:00
mashumafi 8eb837dc3d Add test for const class references 2023-02-20 23:01:32 -05:00
mashumafi b39b4010bd Fix: Get constructor as Callable 2023-02-20 22:05:54 -05:00
George Marques c9e49c487d
GDScript: Limit recursion depth for completion functions
Avoid crashing if the completion gets stuck in infinite recursion while
trying to guess the expression type.
2023-02-20 14:55:13 -03:00
Rémi Verschelde 2057d7344e
Merge pull request #73590 from vnen/gdscript-global-scope-enums
Make global scope enums accessible as types in GDScript
2023-02-20 15:41:45 +01:00
Rémi Verschelde ea2bc9795c
Merge pull request #73544 from mashumafi/fix-func-arg-null
Fix: Func with typed args error when arg is null
2023-02-20 15:41:40 +01:00
Rémi Verschelde 561d949739
Merge pull request #73489 from vonagam/type-check-node
GDScript: Rework type check
2023-02-20 15:41:36 +01:00
Rémi Verschelde 6bf63a3542
Merge pull request #73291 from vonagam/fix-unsafe-weak-binop
GDScript: Fix missing unsafety mark for binary op with weak variables
2023-02-20 15:41:32 +01:00
mashumafi 30d4d3fa5e Fix: Func with typed args error when arg is null 2023-02-19 21:47:48 -05:00
George Marques 75f16b8167
Make global scope enums accessible as types in GDScript
Add functions to CoreConstant so enums can be properly deduced. Also add
the enums in release builds to make consistent with ClassDB enums and
avoid differences in script compilation between debug and release.
2023-02-19 13:00:07 -03:00
Yuri Sizov 78cd5d813b
Merge pull request #73501 from anvilfolk/oopsiedaisy
Fix inability to assign null regression
2023-02-18 04:38:47 +03:00
Yuri Sizov 24344de4f5
Merge pull request #73448 from RandomShaper/fix_sticky_stack
Avoid GDScript bookkeeping from referencing objects longer than necessary
2023-02-17 23:22:20 +03:00
Pedro J. Estébanez 5e9400fa50 Avoid GDScript bookkeeping from referencing objects longer than necessary 2023-02-17 18:59:17 +01:00
Dmitrii Maganov 8fe023ad93 GDScript: Rework type check 2023-02-17 19:57:18 +02:00
ocean (they/them) 9eb4d1e4bf Fix inability to assign null regression
Co-authored-by: Dmitry Maganov <vonagam@gmail.com>
2023-02-17 11:45:56 -05:00
Yuri Sizov 6212da66e8
Merge pull request #72867 from vnen/gdscript-limit-call-depth
GDScript: Add limit to call depth
2023-02-17 17:00:46 +03:00
Yuri Sizov 6e0dd6beca
Merge pull request #72925 from vonagam/fix-enum-typed-array-error
GDScript: Fix error about enum typed arrays
2023-02-17 16:47:50 +03:00
Rémi Verschelde 68807165f4
Merge pull request #73398 from anvilfolk/fix-getter
Fix unset getter return types resulting in strange behavior
2023-02-17 00:31:42 +01:00
Rémi Verschelde a845553898
Merge pull request #73364 from anvilfolk/fix-freed
Fix crash by freed object assign to typed variable
2023-02-17 00:31:19 +01:00
ocean (they/them) c45970739e Fix crash by freed object assign to typed variable 2023-02-16 15:17:46 -05:00
Dmitrii Maganov 5972ba17a4 GDScript: Fix infer on read-only property 2023-02-16 15:50:17 +02:00
ocean (they/them) 94dfac8da7 Add return type for GDScript getters 2023-02-15 17:54:38 -05:00
Danil Alexeev d15511725a
GDScript: Fix `MIN_INT` not representable as numeric literal 2023-02-15 17:41:46 +03:00
Danil Alexeev 8d3e682f52
GDScript: Fix default value of exported enum variable 2023-02-14 18:07:50 +03:00
Dmitrii Maganov df6aae2eca GDScript: Fix missing unsafety mark for binary op with weak variables 2023-02-14 17:01:21 +02:00
Micky 436bbfebe2 Tweak `@GlobalScope` & `GDScript`'s documentation 2023-02-14 13:26:18 +01:00
Dmitrii Maganov 9cb2da89d6 GDScript: Fix usage of ints with typed array of floats 2023-02-13 22:06:38 +02:00
Rémi Verschelde d405392847
Revert "Fixed the jumping to function definition using 'Ctrl+LMB'."
This reverts commit 7eb6367d5c.

Fixes #73058.
Fixes #73167.

This caused regressions, we'll retry with fixes for 4.1.
2023-02-13 17:58:59 +01:00
pkowal be4d8a7b2e
Improve GDScript error for method call on null/previously freed instance
Fixes #53878.
2023-02-12 21:52:05 +01:00
Rémi Verschelde cb2e73d578
Merge pull request #73033 from akien-mga/gdscript-fix-gd4-renames-build
Clean up ProjectConverter3To4 architecture, move renames map to separate file
2023-02-11 22:05:38 +01:00
Rémi Verschelde 532381562e
Merge pull request #72654 from RandomShaper/ptrcall_ret_raw_obj
Avoid losing references to objects in the native-scripting boundary
2023-02-11 15:35:01 +01:00
Rémi Verschelde e19e6b09b9
Clean up ProjectConverter3To4 architecture, move renames map to separate file
This allows properly limiting what features depend on the RegEx module
(doing the actual conversion) and what features only require the renames
data (GDScript suggestions).

Also better excludes the conversion command line options when actually
disabling deprecated code.

Fixes #73029.
2023-02-10 14:35:22 +01:00
Danil Alexeev 220898a69f
GDScript: Remove `treat_warnings_as_errors` project setting 2023-02-10 10:16:33 +03:00
Rémi Verschelde dc7f08b556
Merge pull request #72971 from vnen/gdscript-multiline-comment
GDScript: Allow strings as multiline comments
2023-02-09 16:19:03 +01:00
Rémi Verschelde 6fca54a81b
Merge pull request #72975 from vnen/gdscript-no-ascii-spoof-check
GDScript: Be more lenient with identifiers
2023-02-09 16:12:09 +01:00
George Marques 03ea77407c
GDScript: Be more lenient with identifiers
- Allow identifiers similar to keywords if they are in ASCII range.
- Allow constants to be treated as regular identifiers.
- Allow keywords that can be used as identifiers in expressions.
2023-02-09 11:19:05 -03:00
George Marques f95967c299
GDScript: Allow strings as multiline comments
Bring back the behavior in 3.x that was left out by oversight.
2023-02-09 10:16:00 -03:00
Rémi Verschelde b12bf7ff02
Merge pull request #69550 from Rindbee/fix-script-editor-not-reload-via-lsp
Fix internal editor not updating when using external editor via LSP
2023-02-09 14:01:33 +01:00
Dmitrii Maganov cedc5fa823 GDScript: Fix error about enum typed arrays 2023-02-09 00:31:40 +02:00
kobewi e822182bb7 Fix null message in assert() 2023-02-08 20:19:24 +01:00
George Marques 34f0a2ca46
GDScript: Add limit to call depth
The hard limit is set at 2048 depth which seems sensible between
legitimate recursive calls while still avoiding a crash because of a
stack overflow in most of the cases.

Note that it is still possible to reach the stack limit and get an
overflow before reaching a call depth. This is intended as a half-way
measure to stop crashing in most cases, since there's no reliable nor
portable way to check the amount of stack memory left.
2023-02-07 17:09:40 -03:00
Rémi Verschelde bd267c911b
Merge pull request #72493 from dalexeev/gds-export-flags
GDScript: Improve validation and documentation of `@export_flags`
2023-02-07 19:38:21 +01:00
Rémi Verschelde 3f95b39cb3
Merge pull request #72789 from Vilcrow/fix-jump-to-definition
Fixed the jumping to function definition using 'Ctrl+LMB'.
2023-02-07 19:37:50 +01:00
Danil Alexeev c8e3d8b5d5
GDScript: Improve validation and documentation of `@export_flags` 2023-02-07 19:32:08 +03:00
Markus Sauermann 826e54fa73 Some code simplifications
1. `number_width` isn't used later
2. `return_type` is used only once
3. AudioServer::get_singleton()->get_channel_count() always returns a channel_count of 1 or larger
4. negative `aa->backward` conditional
5. `current_canvas` == `find_world_2d()->get_canvas()`
6. identical if `render_shadows`
2023-02-07 14:30:16 +01:00
Danil Alexeev 54770ba9c5
GDScript: Fix invalid character error message 2023-02-07 10:56:10 +03:00
S.V.I. Vilcrow 7eb6367d5c Fixed the jumping to function definition using 'Ctrl+LMB'. 2023-02-07 05:29:48 +03:00
Yuri Sizov 945207885b
Merge pull request #72546 from vonagam/fix-typed-array-can-reference
GDScript: Fix can_reference check for typed arrays
2023-02-06 23:32:47 +03:00
Yuri Sizov c0edea37ef
Merge pull request #72677 from dalexeev/gds-await-infer-type
GDScript: Fix `await` type inference
2023-02-06 23:32:28 +03:00
Yuri Sizov 7b86a082be
Merge pull request #72804 from vnen/gdscript-no-onready-without-node
GDScript: Fix inheritance check of @onready for inner classes
2023-02-06 23:03:44 +03:00
Danil Alexeev 685db28e29
GDScript: Fix `await` type inference 2023-02-06 23:02:14 +03:00
Yuri Sizov 9d16250353
Merge pull request #70002 from poohcom1/fix/static-subscript-autocomplete
Fix code-completion suggesting non-static members for custom classes
2023-02-06 23:02:12 +03:00
Yuri Sizov de4369ca4b
Merge pull request #72708 from KoBeWi/PackedMultilineStringArray
Fix @export_multiline for PackedStringArray
2023-02-06 23:01:16 +03:00
Dmitrii Maganov 8400308ab3 GDScript: Fix can_reference check for typed arrays 2023-02-06 22:00:16 +02:00
George Marques ed5ddab7e5
GDScript: Fix inheritance check of @onready for inner classes 2023-02-06 14:52:13 -03:00
Rémi Verschelde 2fdaf2919c
GDScript: Fix recently merged test not ignoring warnings 2023-02-06 18:19:34 +01:00
Rémi Verschelde eee343210d
Merge pull request #72330 from MinusKube/unreachable_code_bug
Fix unreachable code warning for elif block
2023-02-06 17:49:37 +01:00
Yuri Sizov d201df1ffa
Merge pull request #72512 from vonagam/fix-ternary-type-source
GDScript: Fix type certainty for result of ternary operator
2023-02-06 19:41:27 +03:00
Rémi Verschelde 8a37fad281
Merge pull request #72794 from vnen/gdscript-no-onready-without-node
GDScript: Don't allow @onready without inheriting Node
2023-02-06 15:41:02 +01:00
George Marques 3941af3d91
GDScript: Don't allow @onready without inheriting Node 2023-02-06 10:45:38 -03:00
Danil Alexeev 31749de128
GDScript: Better handling of `@rpc` annotation and autocompletion 2023-02-05 21:21:37 +03:00
Yuri Sizov 13f0158e49
Merge pull request #72608 from vnen/gdscript-warning-default-error
GDScript: Add warnings that are set to error by default (take 2)
2023-02-05 16:00:26 +03:00
kobewi 2b71ede967 Fix @export_multiline for PackedStringArray 2023-02-04 17:06:58 +01:00
Yuri Sizov 8753b07b05
Merge pull request #71860 from GeroVeni/master
Improve docs for rpc annotations
2023-02-04 18:43:15 +03:00
GeroVeni 54f2226ce5 Improve docs for rpc annotations 2023-02-04 13:28:41 +00:00
Pedro J. Estébanez 0bcc7bb5c7 Avoid losing references to objects in the native-scripting boundary 2023-02-03 17:48:41 +01:00
Rémi Verschelde 604493eb6e
Merge pull request #65910 from KoBeWi/gdsus
Cleanup function state connections when destroying instance
2023-02-03 16:13:06 +01:00
Rémi Verschelde a43ec333c4
Merge pull request #72398 from vnen/gdscript-setter-chain
GDScript: Improve usability of setter chains
2023-02-02 16:28:07 +01:00
George Marques 273bf7210f
GDScript: Add warnings that are set to error by default
- Adds a list of default levels for all warning so they can be set
  individually.
- Add warnings set by default to error for:
  - Using `get_node()` without `@onready`.
  - Using `@onready` together with `@export`.
  - Inferring a static type with a Variant value.
  - Overriding a native engine method.
- Adjust how annotations to ignore warnings are treated so they also
  apply to method parameters.
- Clean up a bit how ignored warnings are set. There were two sets but
  only one was actually being used.
- Set all warnings to the `WARN` level for tests, so they they can be
  properly tested.
- Fix enum types in native methods signatures being set to `int`.
- Fix native enums being treated as Dictionary by mistake.
- Make name of native enum types use the class they are defined in, not
  the direct super class of the script. This ensures they are always
  equal even when coming from different sources.
- Fix error for signature mismatch that was only showing the first
  default argument as having a default. Now it shows for all.
2023-02-02 12:07:25 -03:00
George Marques 5fc7918594
GDScript: Improve usability of setter chains
- Consider PackedArrays non-shared since they are copied on C++/script
  boundaries.
- Add error messages in the analyzer when assigning to read-only
  properties.
- Add specific error message at runtime when assignment fails because
  the property is read-only.
2023-02-02 10:20:35 -03:00
Eric M 9b93bdb4e7 Fix crash in gdscript when autocompleting virtual function and signature does not match base. 2023-02-02 22:52:08 +10:00
Rémi Verschelde 824784f80b
Merge pull request #72557 from vonagam/fix-make-value-protection
GDScript: Fix getting reduced value of incomplete subscript for autocomplete
2023-02-02 09:49:37 +01:00
Danil Alexeev 4311836be2
GDScript: Fix crash in export group annotations 2023-02-02 08:37:39 +03:00
Dmitrii Maganov 7b04e3865a GDScript: Fix getting reduced value of incomplete subscript 2023-02-02 02:15:26 +02:00
Dmitrii Maganov 1a810ff45e GDScript: Fix type certainty for result of ternary operator 2023-02-01 14:52:29 +02:00
Rémi Verschelde 061b046401
Merge pull request #72499 from vonagam/fix-typed-array-disassembly
GDScript: Fix disassembly of typed array assignment and construction
2023-02-01 11:03:25 +01:00
Rémi Verschelde afe3b94ab2
Revert "GDScript: Add warnings that are set to error by default"
This reverts commit a166833bfa.

This caused multiple regressions.
Needs to be redone with more testing before merge.

Fixes #72501.
2023-02-01 10:54:22 +01:00
Dmitrii Maganov 56aedb256e GDScript: Fix disassembly of typed array assignment and construction 2023-02-01 11:18:54 +02:00
Rémi Verschelde e101305950
Merge pull request #72487 from vnen/gdscript-warning-default-error
GDScript: Add warnings that are set to error by default
2023-02-01 08:23:42 +01:00
Rémi Verschelde 9aeda3b282
Merge pull request #72490 from resistor/disasm
Fix disassembly of OPCODE_CONSTRUCT_TYPED_ARRAY.
2023-02-01 08:02:04 +01:00
Rémi Verschelde ab2f8ab6ce
Merge pull request #72371 from dalexeev/remove-gds-str-duplicate
Remove `@GDScript.str` (duplicate of `@GlobalScope.str`)
2023-02-01 07:25:02 +01:00
Owen Anderson 835309c0a5 Fix disassembly of OPCODE_CONSTRUCT_TYPED_ARRAY.
Found while inspecting the bytecode for godot-benchmarks.
2023-01-31 21:52:51 -06:00
George Marques a166833bfa
GDScript: Add warnings that are set to error by default
- Adds a list of default levels for all warning so they can be set
  individually.
- Add warnings set by default to error for:
  - Using `get_node()` without `@onready`.
  - Using `@onready` together with `@export`.
  - Inferring a static type with a Variant value.
  - Overriding a native engine method.
- Adjust how annotations to ignore warnings are treated so they also
  apply to method parameters.
- Clean up a bit how ignored warnings are set. There were two sets but
  only one was actually being used.
- Set all warnings to the `WARN` level for tests, so they they can be
  properly tested.
- Fix enum types in native methods signatures being set to `int`.
- Fix native enums being treated as Dictionary by mistake.
- Make name of native enum types use the class they are defined in, not
  the direct super class of the script. This ensures they are always
  equal even when coming from different sources.
- Fix error for signature mismatch that was only showing the first
  default argument as having a default. Now it shows for all.
2023-02-01 00:05:14 -03:00
Rémi Verschelde 925784df03
Merge pull request #72454 from dalexeev/gds-fix-icon-annotation
GDScript: Fix `@icon` annotation
2023-01-31 15:58:49 +01:00
Rémi Verschelde 6d9c9d30b9
Merge pull request #72206 from vnen/gdscript-allow-void-return-shorthand
GDScript: Allow void functions to return calls to other void functions
2023-01-31 15:55:35 +01:00
Rémi Verschelde 361f3f1721
Merge pull request #57520 from jordigcs/gd-rename-map
Add hint for identifiers renamed from 3.x to 4.0
2023-01-31 15:55:25 +01:00
Danil Alexeev 83cb968965
GDScript: Fix `@icon` annotation 2023-01-31 17:43:54 +03:00
George Marques a47d4d57ca
GDScript: Allow void functions to return calls to other void functions 2023-01-31 11:37:30 -03:00
Rémi Verschelde e768e02b78
Merge pull request #72444 from reduz/fix-global-class-parsing
Fix global script class parsing.
2023-01-31 13:20:00 +01:00
Juan Linietsky 1bbe0a2b2f Fix global script class parsing.
* Broke with #72226
* Restored previous version of the code, made it even more error tolerant.
* Added a warning to **not** change the code.

Fixes #72226.
2023-01-31 12:43:25 +01:00
Rémi Verschelde 99a44f8469
Merge pull request #69248 from vonagam/fixing-typed-arrays
GDScript: Fix typed arrays
2023-01-31 11:04:21 +01:00
Dmitrii Maganov 5909f9f075 GDScript: Fix issues with typed arrays 2023-01-31 11:54:41 +02:00
Rémi Verschelde b6a8b8e8f7
Merge pull request #72212 from anvilfolk/gdtestnames
Add option to print filenames in GDScript unit testing
2023-01-31 10:53:28 +01:00
ocean (they/them) 199e5dbb1e Add option to print filenames in GDScript unit testing 2023-01-30 22:20:45 -05:00
Rémi Verschelde dc7fb30485
Merge pull request #72400 from vnen/gdscript-match-release-consistency
GDScript: Fix match branches return check on release
2023-01-30 20:27:12 +01:00
George Marques 65407dd42d
GDScript: Fix match branches return check on release
The check for existence of `return` only existed on debug builds for
match branches. This could lead on an invalid error after exporting. Now
this is checked on relase too, so it works the same as the editor.
2023-01-30 15:18:36 -03:00
Dmitrii Maganov 011b3895db GDScript: Fix vararg method calls with exact arguments 2023-01-30 19:38:07 +02:00
Rémi Verschelde af57bdb193
Merge pull request #72305 from dalexeev/gfs-fix-export-enum
GDScript: Fix `@export_enum` works only with `int`
2023-01-30 14:47:12 +01:00
Danil Alexeev be4f36b87e
Remove `@GDScript.str` (duplicate of `@GlobalScope.str`) 2023-01-30 14:29:07 +03:00
Danil Alexeev d4b78c352f
GDScript: Fix `@export_enum` works only with `int` 2023-01-30 12:30:37 +03:00
Rémi Verschelde a2817eca03
Merge pull request #72175 from dalexeev/gds-fix-export-group-annotations
GDScript: Fix broken export group annotations
2023-01-30 10:00:54 +01:00
MinusKube 2b60d9d6e1 Fix unreachable code warning for elif block 2023-01-29 20:29:23 +01:00
Haoyu Qiu 5a283bdbcd Allow unicode identifier in GDScript syntax highlighter 2023-01-29 13:17:05 +08:00
Rémi Verschelde a3dae9e548
Merge pull request #72285 from vnen/gdscript-variable-match
GDScript: Allow variables in match patterns
2023-01-29 02:45:48 +01:00
Rémi Verschelde 9420116f6c
Merge pull request #72286 from vnen/gdscript-native-static-call-crash
GDScript: Avoid calling non-static methods on native classes
2023-01-29 02:23:55 +01:00
Rémi Verschelde 4011a0915e
Merge pull request #71844 from vonagam/fix-constant-conversions
GDScript: Fix constant conversions
2023-01-29 02:18:57 +01:00
George Marques aee7b7363b
GDScript: Avoid calling non-static methods on native classes 2023-01-28 20:33:01 -03:00
George Marques 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
Dmitrii Maganov 31e0ae2012 GDScript: Fix constant conversions 2023-01-29 00:01:53 +02:00
Dmitrii Maganov 6194a7e0fa GDScript: Fix implicit conversions for function returns 2023-01-28 23:56:07 +02:00
Rémi Verschelde 218bef90af
GDScript: Fix test from #69163 after annotations change 2023-01-28 17:01:19 +01:00
Rémi Verschelde cc6e8379d4
Merge pull request #69163 from vonagam/variant-safe-lines
GDScript: Fix wrong marking of some lines related to Variant as unsafe
2023-01-28 15:40:19 +01:00
Danil Alexeev 1d68ce2cce
GDScript: Fix broken export group annotations 2023-01-27 16:25:15 +03:00
Dmitrii Maganov abe6d67232 GDScript: Fix test for read-only state of constants 2023-01-27 05:28:08 +02:00
Rémi Verschelde a5c211641f
Merge pull request #71634 from dalexeev/gds-annotations-analyzer
GDScript: Allow constant expressions in annotations
2023-01-26 01:07:00 +01:00
Rémi Verschelde 944b44243d
Merge pull request #72008 from vonagam/fix-property-access-unsafe-mark
GDScript: Fix marking of line with unsafe property access as unsafe
2023-01-26 01:04:57 +01:00
Owen Anderson 22a0c200c6 [GDScript] Perform update-and-assign operations in place when possible.
This turns two bytecode operations into one by using the assignment
destination directly as the output of the binary operator. This manifests
in operations like `+=`.
2023-01-25 10:22:04 -06:00
Danil Alexeev b004f8180e
GDScript: Allow constant expressions in annotations 2023-01-25 18:43:56 +03:00
George Marques e93266b9ff
Merge pull request #71120 from jordigcs/ternary
Closes https://github.com/godotengine/godot/issues/71065
2023-01-25 12:23:11 -03:00
Rémi Verschelde 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
Dmitrii Maganov 3c308f42e2 GDScript: Fix marking of line with unsafe property access as unsafe 2023-01-25 01:45:40 +02:00
jordi bb9a00889a Add hint for identifiers renamed since Godot 3 2023-01-24 12:33:55 -06:00
Danil Alexeev 13215638a9
Clarify error message about script-level annotation 2023-01-24 13:10:45 +03:00
George Marques ba9491f870
Merge pull request #70948 from vnen/gdscript-ptr-method-name-in-debug 2023-01-23 12:24:15 -03:00
Rémi Verschelde 81fe3715b8
Merge pull request #71914 from vnen/gdscript-no-continue-match
GDScript: Remove function of `continue` for match statement
2023-01-23 15:35:55 +01:00
George Marques 80e06b29e7
GDScript: Add names for disassembling function pointers
When instructions use function pointers, it's not possible to retrieve
their original names in the disassembly. This stores the names in
vectors (in debug builds) so they can be shown.
2023-01-23 11:04:31 -03:00
Rémi Verschelde 5726bf578d
Merge pull request #71676 from vnen/gdscript-unicode-identifiers
Add support for Unicode identifiers in GDScript and Expression
2023-01-23 10:24:33 +01:00
George Marques 9462ae4783
GDScript: Remove function of `continue` for match statement
The keyword is confusing and rarely is used in the intended way. It is
removed now in favor of a future feature (pattern guards) to avoid
breaking compatibility later.
2023-01-22 18:45:24 -03:00
Rindbee 64edc7a5c2 Fix internal editor not updating when using external editor via LSP 2023-01-22 18:27:22 +08:00
George Marques 7548e043fc
Add support for Unicode identifiers in GDScript
This is using an adapted version of UAX#31 to not rely on the ICU
database (which isn't available in builds without TextServerAdvanced).
It allows most characters used in diverse scripts but not everything.
2023-01-21 13:39:40 -03:00
Rémi Verschelde ebd0b40f6e
Merge pull request #71687 from reduz/support-script-class-name-in-efs
Support script global resource name in EditorFileSystem
2023-01-21 16:54:23 +01:00
Juan Linietsky dddd8d43f6 Support script global resource name in EditorFileSystem
* Works for binary and text files.
* Makes EditorQuickOpen work with custom resources again.
* Information is cached and easily accessible.

Properly fixes #66179. Supersedes #66215 and supersedes #62417

**WARNING**: This required breaking backwards binary compatibility (.res and .scn files). Files saved after this PR is merged will no longer open in any earlier versions of Godot.
2023-01-21 14:19:27 +01:00
Adam Wardell e9d8c261a5 call update_exports from LSP didSave function
exports in the inspector were not properly appearing when a gdscript was saved using an external IDE
this commit adds a call to GDScript::UpdateExports toward the end of GDScriptTextDocument::didSave
2023-01-20 19:16:53 -08:00
George Marques 7e5c2f945d
Remove references to compiled GDScript in export
This feature was removed from GDScript so it should not be present on
the interface nor in the saved export presets.
2023-01-20 15:09:07 -03:00
jordi 2e488072d0 Allow standalone ternary expressions 2023-01-19 14:27:57 -06:00
Adam Scott 807b7ed557 Update `@icon` definition to add a note 2023-01-18 19:48:01 -05:00
ocean (they/them) 4854e723be Fix unnammed enum crash regression 2023-01-18 09:35:48 -05:00