gracelang / minigrace

Self-hosting compiler for the Grace programming language
39 stars 22 forks source link

Mis-placed annotation does not generate a syntax error #317

Open apblack opened 4 years ago

apblack commented 4 years ago

Look at this (erroneous) source code:

method dialectError is confidential (aString) {
    errormessages.CompilationError.raise (aString) with (sourcePosition.emptyRange)
}

I added the annotation is confidential in the wrong place. This did not raise a syntax error, but only a name resolution error when aString was considered to be undefined. It seems as though the parameter list (aString) was completely ignored.

kjx commented 4 years ago

This isn’t a syntax error. It’s a declaration of a method dialectError annotated confidential(_) passing in aString as the parameter of the annotation.

Whether anything handles that correctly, I doubt - Kernan ignores all annotations I think - but that’s what it is

apblack commented 4 years ago

Excellent — that explains why I did not get a syntax error message. We should get a message that confidential(_) is not declared as an annotation, but that check may not be in minigrace yet.