Thread overview
[Issue 17930] [Contract Programming] 23.3 In, Out and Inheritance
Oct 23, 2017
Rob
Oct 23, 2017
Rob
Oct 23, 2017
Rob
Oct 23, 2017
Rob
Oct 25, 2017
Rob
Oct 25, 2017
Rob
October 23, 2017
https://issues.dlang.org/show_bug.cgi?id=17930

Rob <resmith5@outlook.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |contracts
           Severity|enhancement                 |minor

--
October 23, 2017
https://issues.dlang.org/show_bug.cgi?id=17930

--- Comment #1 from Rob <resmith5@outlook.com> ---
*** Issue 17929 has been marked as a duplicate of this issue. ***

--
October 23, 2017
https://issues.dlang.org/show_bug.cgi?id=17930

--- Comment #2 from Rob <resmith5@outlook.com> ---
In addition to


class Base {

   myFunc()
   {

   }
}

class Derived : Base {
   myFunc(int a)
   in
   {
      assert(a >= 0);
   }
   body
   {

   }
}

getting a compile error. In the following situation:

class Base2 {
   myFunc(int a)
   in
   {
      assert(a >= 0);
   }
   body
   {

   }
}

class Derived2 : Base2 {
   myFunc(int a)
   {

   }
}

calling Derived2.myFunc is subject to the constraint in Base2.myFunc. That behavior should probably be noted in the documentation.

--
October 23, 2017
https://issues.dlang.org/show_bug.cgi?id=17930

--- Comment #3 from Rob <resmith5@outlook.com> ---
Forgot return types on functions. Also, the function in Derived2 should have "override".

--
October 25, 2017
https://issues.dlang.org/show_bug.cgi?id=17930

--- Comment #4 from Rob <resmith5@outlook.com> ---
Created attachment 1664
  --> https://issues.dlang.org/attachment.cgi?id=1664&action=edit
demonstrate the requirement for contracts in base in order to have them in
derived

--
October 25, 2017
https://issues.dlang.org/show_bug.cgi?id=17930

--- Comment #5 from Rob <resmith5@outlook.com> ---
Sorry, please disregard comments 2 and 3, was mistaken about base class method contract applying to a derived method with no contract.

--
December 15
https://issues.dlang.org/show_bug.cgi?id=17930

--- Comment #6 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dlang.org/issues/4071

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--