Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDScript error messages use word Nil which doesn't exist in GDScript #61461

Open
miv391 opened this issue May 27, 2022 · 2 comments
Open

GDScript error messages use word Nil which doesn't exist in GDScript #61461

miv391 opened this issue May 27, 2022 · 2 comments

Comments

@miv391
Copy link
Contributor

miv391 commented May 27, 2022

Godot version

v4.0.alpha8.official [cc3ed63]

System information

Windows 10

Issue description

There are several error messages which use word Nil, but there are no Nils in GDScript. I suggest that those error messages should be changed to use the correct term null.

Some error messages also somewhat incorrectly talk about Nil/null being a type while it actually isn't. I have made a proposal to fix the null/void types. This bug report is however just about fixing the confusing error messages.

Steps to reproduce

example 1

var a: int = null

Current error message:

Trying to assign value of type 'Nil' to a variable of type 'int'.

This is especially bad error message as a type null/Nil doesn't actually exist. Better error message would be:

Trying to assign 'null' to a variable of type 'int'. Only assigning 'int' is allowed.

example 2

var a = null
a.foo()

Current error message:

Invalid call. Nonexistent function 'foo' in base 'Nil'.

Better error message could be something like this:

'a' is 'null' so its methods cannot be called.

There are surely more error messages which use word Nil, but these are ones I have noticed so far.

Minimal reproduction project

No response

@Calinou
Copy link
Member

Calinou commented May 27, 2022

See #46241.

Nil is technically a Variant type (albeit it's not exposed for use in scripting), with only one value: null. The error message is valid, but I agree it's confusing.

@miv391
Copy link
Contributor Author

miv391 commented May 27, 2022

Nil is technically a Variant type (albeit it's not exposed for use in scripting), with only one value: null. The error message is valid, but I agree it's confusing.

Yes, it is confusing. Neither of these don't work:

	var a: Nil = null
	var a: null = null

Of course, I wouldn't expect the first line to work if Nil is not exposed to scripting, but the documentation says

null is an empty data type that contains no information and can not be assigned any other value.

(apparently incorrectly) that null is a type, so I might expect that the second line would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants