[records] Confusing compilation error when record components are omitted

Tagir Valeev amaembo at gmail.com
Thu Dec 5 07:26:41 UTC 2019


Hello!

My colleague experiments with records support. He made a fresh build
from amber records branch and wrote this code:

public record Record {
}

Compiler produced the following error message:

error: class, interface, enum, or record expected
public record Record {
       ^
1 error

It's pretty confusing to see the compiler pointing on the word
'record' and saying that 'record' is expected. The real problem is the
absence of parentheses after the record name. I think such kind of
mistake could be done by many newcomers. Probably a better compilation
error should be displayed in this case?

With best regards,
Tagir Valeev.


More information about the amber-dev mailing list