Mercurial > projects > dstress
changeset 289:92afe4ae392b
alias inside of with/scope
Ilya Zaitseff <sark7@mail333.com>
2005-02-14
news:opsl6xo4fhaaezs2@robingood
nntp://news.digitalmars.com/digitalmars.D.bugs/2982
author | thomask |
---|---|
date | Fri, 18 Feb 2005 23:09:04 +0000 |
parents | 568fa9d15b60 |
children | d8df37d1b51b |
files | run/alias_15.d run/alias_16.d |
diffstat | 2 files changed, 58 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/alias_15.d Fri Feb 18 23:09:04 2005 +0000 @@ -0,0 +1,29 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Ilya Zaitseff <sark7@mail333.com> +// @date@ 2005-02-14 +// @uri@ news:opsl6xo4fhaaezs2@robingood +// @url@ nntp://news.digitalmars.com/digitalmars.D.bugs/2982 + +module dstress.run.alias_15; + +class A{ + int foo; +} + +class B{ + A a; +} + +int main(){ + B b=new B(); + assert(b.a.foo==0); + with(b){ + alias b.a.foo bar; + bar++; + } + assert(b.a.foo==1); + return 0; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/alias_16.d Fri Feb 18 23:09:04 2005 +0000 @@ -0,0 +1,29 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Ilya Zaitseff <sark7@mail333.com> +// @date@ 2005-02-14 +// @uri@ news:opsl6xo4fhaaezs2@robingood +// @url@ nntp://news.digitalmars.com/digitalmars.D.bugs/2982 + +module dstress.run.alias_16; + +class A{ + int foo; +} + +class B{ + A a; +} + +int main(){ + B b=new B(); + assert(b.a.foo==0); + { + alias b.a.foo bar; + bar++; + } + assert(b.a.foo==1); + return 0; +} \ No newline at end of file