Parsing AddressExpression buggy #604

SebastianS90 opened this Issue Mar 25, 2016 · 0 comments


None yet

2 participants


I found some messed up parsing in parseAddressExpression. Note the highlighted lines. The method matches something like &foo((->)

I got the following program compiling:

import whiley.lang.System

type fun is function()->int

function foo() -> int:
    return 42

method main(System.Console console):
    fun x = &foo((->)

It prints 42.

Even though I could not find it in the specification, I guess that this expression is to use a function/method as a value, like lambda expressions. The optional parameters contain types (not expressions) to pick the right function when names are overloaded. A return type cannot be given, as it is generally not used for method lookup.

I'll push a fix for this soon. Such that it has the syntax &ident or &ident(t1, t2, t3)

And you might want to consider a path instead of an ident there. But that would be a different issue, feel free to file one if you want that feature.

@DavePearce DavePearce closed this in #605 Mar 28, 2016
@DavePearce DavePearce modified the milestone: v0.3.40 May 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment