[Issue 12247] in contract in interfaces is not checked

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 18 13:30:57 UTC 2023


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

--- Comment #5 from FeepingCreature <default_357-line at yahoo.de> ---
Hm, apologies, nevermind - that seems unrelated.

Right now, "no in-contract" is equivalent to "in (true)". 

`I::foo(int i) in (i > 7)` creates an in-contract of "at least i > 7 must be
permitted for foo".
`Impl::foo(int i)` has no additional in-contract, so it allows in all values,
causing the behavior in this bug report.

preview=inclusiveincontracts does not affect this. The only thing it would
affect is if you wrote `Impl::foo(int i) in (false)`, which today would succeed
if called with, say, `8`, because 8 would pass the interface in-contract, and
it only has to pass the in-contract of any of the override parents (because
they are implicitly inclusive). But `in (true)`, which writing no in-contract
implicitly is, works with either behavior.

Sorry for the spam, feel free to delete both comments.

--


More information about the Digitalmars-d-bugs mailing list