Mercurial > projects > dstress
changeset 1128:02b54d874f0f
[Issue 325] New: Overriding members and overloading with alias causes bogus error messages in with().
Chris Miller <chris@dprogramming.com>
2006-09-06
news:bug-325-3@http.d.puremagic.com/issues/
author | thomask |
---|---|
date | Thu, 07 Sep 2006 07:51:37 +0000 |
parents | 08057f3259c9 |
children | ebdd9f048c3d |
files | run/w/with_15_A.d run/w/with_15_B.d run/w/with_15_C.d run/w/with_15_D.d |
diffstat | 4 files changed, 170 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/w/with_15_A.d Thu Sep 07 07:51:37 2006 +0000 @@ -0,0 +1,43 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Chris Miller <chris@dprogramming.com> +// @date@ 2006-09-06 +// @uri@ news:bug-325-3@http.d.puremagic.com/issues/ +// @desc@ [Issue 325] New: Overriding members and overloading with alias causes bogus error messages in with(). + +module dstress.run.w.with_15_A; + +class Base{ + int data; + + void foo(int i){ + data = i; + } + int foo(){ + return data; + } +} + +class Derived : Base{ + alias Base.foo foo; + + override void foo(int i){ + super.data = 2 * i; + } +} + +int main(){ + Derived d = new Derived(); + with(d){ + foo = 1; + } + + if(d.foo() != 2){ + assert(0); + } + + return 0; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/w/with_15_B.d Thu Sep 07 07:51:37 2006 +0000 @@ -0,0 +1,43 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Chris Miller <chris@dprogramming.com> +// @date@ 2006-09-06 +// @uri@ news:bug-325-3@http.d.puremagic.com/issues/ +// @desc@ [Issue 325] New: Overriding members and overloading with alias causes bogus error messages in with(). + +module dstress.run.w.with_15_B; + +class Base{ + int data; + + void foo(int i){ + data = i; + } + int foo(){ + return data; + } +} + +class Derived : Base{ + override void foo(int i){ + super.data = 2 * i; + } + + alias Base.foo foo; +} + +int main(){ + Derived d = new Derived(); + with(d){ + foo = 1; + } + + if(d.foo() != 2){ + assert(0); + } + + return 0; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/w/with_15_C.d Thu Sep 07 07:51:37 2006 +0000 @@ -0,0 +1,42 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Chris Miller <chris@dprogramming.com> +// @date@ 2006-09-06 +// @uri@ news:bug-325-3@http.d.puremagic.com/issues/ +// @desc@ [Issue 325] New: Overriding members and overloading with alias causes bogus error messages in with(). + +module dstress.run.w.with_15_C; + +class Base{ + int data; + + void foo(int i){ + data = i; + } + int foo(){ + return data; + } +} + +class Derived : Base{ + override void foo(int i){ + super.data = 2 * i; + } + + alias Base.foo foo; +} + +int main(){ + Derived d = new Derived(); + d.foo(3); + with(d){ + if(foo != 6){ + assert(0); + } + } + + return 0; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/w/with_15_D.d Thu Sep 07 07:51:37 2006 +0000 @@ -0,0 +1,42 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Chris Miller <chris@dprogramming.com> +// @date@ 2006-09-06 +// @uri@ news:bug-325-3@http.d.puremagic.com/issues/ +// @desc@ [Issue 325] New: Overriding members and overloading with alias causes bogus error messages in with(). + +module dstress.run.w.with_15_D; + +class Base{ + int data; + + void foo(int i){ + data = i; + } + int foo(){ + return data; + } +} + +class Derived : Base{ + alias Base.foo foo; + + override void foo(int i){ + super.data = 2 * i; + } +} + +int main(){ + Derived d = new Derived(); + d.foo(3); + with(d){ + if(foo != 6){ + assert(0); + } + } + + return 0; +} +