Closed flofriday closed 1 year ago
The problem lies in the parser... it parses 2.(toString() + " two")
instead of (2.toString()) + " two"
Ok I solved the problem. The current precendence was determined at the wrong place, so it wasn't right. Fix was a oneliner.
Now we get the following typechecker error:
1| print(2.toString() + " two")
^^^^^^^^^^
Function calls are only valid for identifiers, not for `2.toString`
@flofriday we probably should disable this type check for identifiers right? I don't even know why it says for identifier only since A().call()
for example is valid...
True, yes disable that. A couple of weeks I moved that check from the parser to the typechecket (and made it more lax) but I don't think it should be there at all.
Actually this constraint is true, in the above example, the parsing predendence was still wrong, since it parsed the dereference before the call. The constraint just says that it is only possible to call a function by a name. This wouldn't be the case if we would have higher order function, but right now this holds true.
Example
Note
You have to ignore the three lines before the error, its just some debug output.
Also the error highlighting is kinda messed up which shouldn't happen.