You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-15 13:51:40 +00:00
Remove script class checks when getting function signature
This commit is contained in:
committed by
Rémi Verschelde
parent
3f02cf7ced
commit
0fef203b1f
@@ -0,0 +1,5 @@
|
||||
const TestClass = preload("gdscript_duplicate_class.notest.gd")
|
||||
|
||||
func test():
|
||||
# (TestClass as GDScript).duplicate() exists
|
||||
TestClass.duplicate()
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_ANALYZER_ERROR
|
||||
Cannot call non-static function "duplicate()" on a class directly. Make an instance instead.
|
||||
@@ -0,0 +1 @@
|
||||
extends Node
|
||||
@@ -0,0 +1,6 @@
|
||||
const TestClass = preload("gdscript_duplicate_class.notest.gd")
|
||||
|
||||
func test():
|
||||
# TestClass.duplicate() fails
|
||||
@warning_ignore("return_value_discarded")
|
||||
(TestClass as GDScript).duplicate()
|
||||
@@ -0,0 +1 @@
|
||||
GDTEST_OK
|
||||
@@ -0,0 +1 @@
|
||||
extends Node
|
||||
@@ -0,0 +1,13 @@
|
||||
# https://github.com/godotengine/godot/issues/71994
|
||||
|
||||
func test():
|
||||
pass
|
||||
|
||||
class A extends RefCounted:
|
||||
pass
|
||||
|
||||
class B extends A:
|
||||
# Parsing `duplicate()` here would throw this error:
|
||||
# Parse Error: The function signature doesn't match the parent. Parent signature is "duplicate(bool = default) -> Resource".
|
||||
func duplicate():
|
||||
pass
|
||||
@@ -0,0 +1 @@
|
||||
GDTEST_OK
|
||||
@@ -0,0 +1,19 @@
|
||||
const PreloadClass = preload("static_duplicate_preload.notest.gd")
|
||||
const PreloadClassAlias = PreloadClass
|
||||
|
||||
func test():
|
||||
var dup_preload_one = PreloadClass.duplicate()
|
||||
print(dup_preload_one == Vector2.ONE)
|
||||
|
||||
var dup_preload_two = (PreloadClass as GDScript).duplicate()
|
||||
print(dup_preload_two is GDScript)
|
||||
|
||||
var dup_preload_alias_one = PreloadClassAlias.duplicate()
|
||||
print(dup_preload_alias_one == Vector2.ONE)
|
||||
|
||||
var dup_preload_alias_two = (PreloadClassAlias as GDScript).duplicate()
|
||||
print(dup_preload_alias_two is GDScript)
|
||||
|
||||
var PreloadClassAsGDScript = PreloadClass as GDScript
|
||||
var dup_preload_class_as_gdscript_one = PreloadClassAsGDScript.duplicate()
|
||||
print(dup_preload_class_as_gdscript_one is GDScript)
|
||||
@@ -0,0 +1,9 @@
|
||||
GDTEST_OK
|
||||
preload duplicate
|
||||
true
|
||||
true
|
||||
preload duplicate
|
||||
true
|
||||
true
|
||||
preload duplicate
|
||||
false
|
||||
@@ -0,0 +1,5 @@
|
||||
extends RefCounted
|
||||
|
||||
static func duplicate() -> Vector2:
|
||||
print("preload duplicate")
|
||||
return Vector2.ONE
|
||||
Reference in New Issue
Block a user