Bug 15799 – Misleading error message against the contract followed by semicolon in interface
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-03-15T00:34:00Z
Last change time
2016-10-01T11:45:11Z
Keywords
diagnostic, pull, rejects-valid
Assigned to
nobody
Creator
jiki
Comments
Comment #0 by jiki — 2016-03-15T00:34:31Z
I've hit this three times, and each time I wondered "The grammer gets changed? "
Too misleading message.
interface I {
void funA();
void funB(int n)
in {
assert(n);
}; // --- unexpected semicolon
}
Error: missing body { ... } after in or out
It's sure that the last semicolon is unexpected.
And I know this error is proper for _class_.
However, when turning funA into funB, we likely forget to remove the semicolon.
As a result, it is possible for people to mistake "Interface with contract is illegal".