Open ergl opened 2 years ago
It should be possible to know that we have a "lambda type thing" at the point of the error and change the message to "couldn't find 'string' in 'lambda f'" or something like that.
I mentioned in the sync: It's easy to hide the dollar sign name, but it's more tricky to find something useful to put there for the general case.
It may be best to just to list the methods available on the type:
Error:
[main.pony:4:6](): couldn't find 'string' in (anonymous type)
f.string()
^
[main.pony:4:6](): it has a method named `apply`
let f = {() => None}
^
(note that for object literals it may be multiple methods)
The following code fails to compile, as expected:
However, the error message says:
Internally to the compiler (I believe) we don't have a proper name for lambdas, so it's not clear what would be the appropriate type to put in the error message.
The piece of code responsible for this is
lookup_nominal
insidelookup.c
.The above happens for explicit lambdas, object literals and partial application.