Curious compiler error message.

3 replies to this topic
Posted 1+ years ago #1
ziggy

Code:

Function Main()
	Local variable:MyClass
	variable
End

Class MyClass
End

The error message is sort of funy:
Error : Identifier 'variable' not found - perhaps you meant 'variable'?

Just a minor cosmetic thingy, but shoudn't it be something like: A class instance can't be invoked, or the like?

 
Posted 7 months ago #2
Citty

[variable] might no be identified

 
Posted 7 months ago #3
Goodlookinguy

Just a minor cosmetic thingy, but shoudn't it be something like: A class instance can't be invoked, or the like?

No, because it could just be null. Accessing a null variable does not mean accessing its fields and methods. The error C#.NET gives, a tad more appropriately, is "Only assignment, call, increment, decrement, and new object expressions can be used as a statement".

Edit: Didn't realize this was a revived thread. I read it as only being hours ago and not years ago. The error reported by Monkey X now still doesn't make much sense, but at least it doesn't say what it used to say. Now all it reports is "Error : Identifier 'variable' not found".

 
Posted 7 months ago #4
Citty

Let me be more specific. The compiler thinks that "variable" is unidentified so it is best that you identify it instead of leaving it