October 08, 2020 [Issue 21298] New: Missing error when overriding interface method without in contract with class method with contract | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21298 Issue ID: 21298 Summary: Missing error when overriding interface method without in contract with class method with contract Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: minor Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: default_357-line@yahoo.de Consider the following code: ``` interface I { void foo(int i); } class C : I { override void foo(int i) in (i > 0) { } } ``` If `I` was a class, the compiler would rightly inform us that "function C.foo cannot have an in contract when overridden function I.foo does not have an in contract". However, since I is an interface, this error doesn't trigger. But it should, of course, for the same reason. -- |
Copyright © 1999-2021 by the D Language Foundation