GDScript: Fix non-static call is allowed in static var lambda body

This commit is contained in:
Danil Alexeev
2023-10-17 12:46:41 +03:00
parent f333e4acf5
commit 7f4721a941
11 changed files with 95 additions and 17 deletions
@@ -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
@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot call non-static function "non_static_func()" from static function "static_func()".
@@ -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
@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot call non-static function "non_static_func()" from static function "static_func()".
@@ -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
@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot call non-static function "non_static_func()" from a static variable initializer.
@@ -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
@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Cannot call non-static function "non_static_func()" from static function "@static_var_setter()".
@@ -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.