Bug 712 – incorrect scope of class level mixins if interfaces are involved
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2006-12-22T07:21:52Z
Last change time
2019-05-16T08:57:56Z
Keywords
wrong-code
Assigned to
Walter Bright
Creator
Thomas Kühne
Comments
Comment #0 by thomas-dloop — 2006-12-22T07:21:52Z
(Originally posted by John C <[email protected]> on 2006-01-24
as news:[email protected])
#
# 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.dhttp://dstress.kuehne.cn/run/m/mixin_15_B.dhttp://dstress.kuehne.cn/run/m/mixin_15_C.d
Comment #1 by razvan.nitu1305 — 2019-05-16T08:57:56Z