[Issue 712] New: incorrect scope of class level mixins if interfaces are involved

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 22 05:21:52 PST 2006


http://d.puremagic.com/issues/show_bug.cgi?id=712

           Summary: incorrect scope of class level mixins if interfaces are
                    involved
           Product: D
           Version: 0.177
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: thomas-dloop at kuehne.cn


(Originally posted by John C <johnch_atms at hotmail.com> on 2006-01-24
as news:dr4t3d$1f24$1 at digitaldaemon.com)

#
# template T(){
#    void test(){
#       writefln("T.test");
#    }
# }
#
# interface I{
#    void test();
# }
#
# class C : I{
#    mixin T!();
#
#    void test(){
#       writefln("C.test");
#    }
# }
#
# void main(){
#    C c = new C();
#    c.test();
#    I i = new C();
#    i.test();
# }
#

output:
> C.test
> T.test

expected output:
> C.test
> C.test

http://www.digitalmars.com/d/mixin.html
#
# The declarations in a mixin are 'imported' into the surrounding scope.
# If the name of a declaration in a mixin is the same as a declaration in
# the surrounding scope, the surrounding declaration overrides the mixin one:
#

test cases:
http://dstress.kuehne.cn/run/m/mixin_15_A.d
http://dstress.kuehne.cn/run/m/mixin_15_B.d
http://dstress.kuehne.cn/run/m/mixin_15_C.d


-- 



More information about the Digitalmars-d-bugs mailing list