AndreVanDelft / scala

The SubScript extension to the Scala programming language
http://www.subscript-lang.org/
12 stars 1 forks source link

Method call after annotation requires to be enclosed in braces, sadly #64

Open AndreVanDelft opened 9 years ago

AndreVanDelft commented 9 years ago

According to the syntax the following is legal: @{test}: println However, because of a quick hack with annotations, the method call needs to be enclosed in braces, FTTB: @{test}: {println} The reason is that during the parser phase, for the annotation some code is generated of the form DSL._at(_here: N_annotation[N_call[Any], T_call[Any]]) whereas it can only become known at compile time whether the RHS operand of @: is a script call or a method call; in the latter case the parser should have had generated ...N_code_normal[Any]..., but it could not know that then.

This bug may be repaired using a major design in the compiler: the parser should not do transformations; there should be proper ASTs for all subscript constructs, and only in the typer phase these should be transformed to regular Scala code.