-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83486 from dalexeev/gds-fix-call-non-static-in-st…
…atic-var-lambda GDScript: Fix non-static call is allowed in static var lambda body
- Loading branch information
Showing
11 changed files
with
95 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
modules/gdscript/tests/scripts/analyzer/errors/static_func_call_non_static_in_lambda.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# GH-83468 | ||
|
||
func non_static_func(): | ||
pass | ||
|
||
static func static_func(): | ||
var f := func (): | ||
var g := func (): | ||
non_static_func() | ||
g.call() | ||
f.call() | ||
|
||
func test(): | ||
pass |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/static_func_call_non_static_in_lambda.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Cannot call non-static function "non_static_func()" from static function "static_func()". |
15 changes: 15 additions & 0 deletions
15
...les/gdscript/tests/scripts/analyzer/errors/static_func_call_non_static_in_lambda_param.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# GH-83468 | ||
|
||
func non_static_func(): | ||
pass | ||
|
||
static func static_func( | ||
f := func (): | ||
var g := func (): | ||
non_static_func() | ||
g.call() | ||
): | ||
f.call() | ||
|
||
func test(): | ||
pass |
2 changes: 2 additions & 0 deletions
2
...es/gdscript/tests/scripts/analyzer/errors/static_func_call_non_static_in_lambda_param.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Cannot call non-static function "non_static_func()" from static function "static_func()". |
14 changes: 14 additions & 0 deletions
14
modules/gdscript/tests/scripts/analyzer/errors/static_var_init_call_non_static_in_lambda.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# GH-83468 | ||
|
||
func non_static_func(): | ||
pass | ||
|
||
static var static_var = func (): | ||
var f := func (): | ||
var g := func (): | ||
non_static_func() | ||
g.call() | ||
f.call() | ||
|
||
func test(): | ||
pass |
2 changes: 2 additions & 0 deletions
2
modules/gdscript/tests/scripts/analyzer/errors/static_var_init_call_non_static_in_lambda.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Cannot call non-static function "non_static_func()" from a static variable initializer. |
15 changes: 15 additions & 0 deletions
15
...dscript/tests/scripts/analyzer/errors/static_var_init_call_non_static_in_lambda_setter.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# GH-83468 | ||
|
||
func non_static_func(): | ||
pass | ||
|
||
static var static_var: | ||
set(_value): | ||
var f := func (): | ||
var g := func (): | ||
non_static_func() | ||
g.call() | ||
f.call() | ||
|
||
func test(): | ||
pass |
2 changes: 2 additions & 0 deletions
2
...script/tests/scripts/analyzer/errors/static_var_init_call_non_static_in_lambda_setter.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Cannot call non-static function "non_static_func()" from static function "@static_var_setter()". |
2 changes: 1 addition & 1 deletion
2
modules/gdscript/tests/scripts/analyzer/errors/static_var_init_non_static_call.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
GDTEST_ANALYZER_ERROR | ||
Cannot call non-static function "non_static()" for static variable initializer. | ||
Cannot call non-static function "non_static()" from a static variable initializer. |