uqbar-project / wollok

Wollok Programming Language
GNU General Public License v3.0
60 stars 16 forks source link

Weird Bracket ("}") in "Bad message" error #1487

Open javierfernandes opened 6 years ago

javierfernandes commented 6 years ago

Given this

class Persona {
    var edad = 10
}

If I try to use it like this

const p = new Persona()
p.edad

Gives this error

>>> p.edad
ERROR: Bad message: edad} (line: 2)

On one side there is "}" character. On the other side, maybe it could be nice if this "syntax" gets handled in the runtime as a wollok exception. Kind of how other languages handle the "NullPointerException". Instead of being a Platform error that looks differently (?)

fdodino commented 6 years ago

I think Wollok parser is intercepting this expression. There was a similar issue (#1216) but we couldn't find a proper solution.

fdodino commented 5 years ago

Related also to #877

fdodino commented 5 years ago

Well, '}' is due to #877, detecting "====" vs. "===". When user types no () for a message, there is a "}" implemented by console:

>>> WollokCodeHighLightLineStyleListener
    val programHeader = "program repl {" + System.lineSeparator
    val programFooter =  System.lineSeparator + "}"

Even recognizing this different errors, linker part has not been achieved, so generating a DNU is very hard (you have a WMemberCallFeature but memberCallTarget points to a WVariableReferenceImpl with a null ref instance variable).

I'll put this issue in a Nice To Have column