godot-console
godot-console copied to clipboard
No constructor of "int" matches the signature "int(null)".
Godot version: Godot 4.0 beta 10 addon version: godot 4 branch 3b61520 running the project will result an error in IntType.gd Line 12
removing the int constructor will resolve the issue
Thanks for reporting! Will fix
Removing the integer cast will make the code incorrect as the function is supposed to return an int.
There's something interesting i've just learned. GDScript's static analyzer can determine function's return type based on its code, return type specifier isn't necessary. Thus the following function will have return type of null:
# @param Variant value
# @returns String|null
func _reextract(value):
var rematch = self._regex.search(value)
if rematch and rematch is RegExMatch:
return rematch.get_string()
return null
Which is the reason for this error. I got rid of the error by doing this instead:
if rematch and rematch is RegExMatch:
return rematch.get_string()
else:
return null