www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15799] New: Misleading error message against the contract

https://issues.dlang.org/show_bug.cgi?id=15799

          Issue ID: 15799
           Summary: Misleading error message against the contract followed
                    by semicolon in interface
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: jiki red.email.ne.jp

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".

--
Mar 14 2016