February 16, 2012 [Issue 7517] New: Interface contracts broken | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=7517 Summary: Interface contracts broken Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: renezwanenburg@gmail.com --- Comment #0 from Rene Zwanenburg <renezwanenburg@gmail.com> 2012-02-16 06:18:13 PST --- interface I { void enable() in { assert(!enabled); } out { assert( enabled); } void disable() in { assert( enabled); } out { assert(!enabled); } @property bool enabled() const; } class C : I { void enable() { _enabled = true; } void disable() { _enabled = false; } @property bool enabled() const { return _enabled; } bool _enabled; } void foo() { I i = new C; i.enable(); } enable's in contract is not being called. After setting _enabled to true an exception is thrown saying C does not implement opCmp(). When removing the out contract from the interface, or the disable() function from the interface and implementation (even though it's never being used anywhere in the application), the code will run without exceptions but the contracts will still not be called. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 05, 2012 [Issue 7517] Interface contracts broken | ||||
---|---|---|---|---|
| ||||
Posted in reply to Rene Zwanenburg | http://d.puremagic.com/issues/show_bug.cgi?id=7517 Stewart Gordon <smjg@iname.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg@iname.com Depends on| |6856 --- Comment #1 from Stewart Gordon <smjg@iname.com> 2012-03-05 02:41:20 PST --- This is closely related to, if not a duplicate of, issue 6856. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation