Bug 12305 – infer context from "this" of aliased methods

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-06T06:44:54Z
Last change time
2024-12-13T18:17:53Z
Keywords
pull
Assigned to
No Owner
Creator
Vladimir Panteleev
Moved to GitHub: dmd#18789 →

Comments

Comment #0 by dlang-bugzilla — 2014-03-06T06:44:54Z
////// testStruct.d ////// struct A { void fun() { } void caller(T)(T t) { t.callee(); // NG } } struct B { alias callee = A.fun; } void main() { A a; B b; a.caller(b); } ////////////////////////// The above currently does not work. If you replace t.callee() with T.callee(), then it compiles. However, that prohibits generic programming when "callee" is an actual method of "T". Note that this currently works with nested classes: /////// testClass.d ////// class A { void fun() { } class B { alias fun = A.fun; } } void main() { A a = new A; A.B b = a.new B; b.fun(); // OK } //////////////////////////
Comment #1 by dlang-bugzilla — 2014-03-06T07:57:07Z
Comment #2 by robert.schadek — 2024-12-13T18:17:53Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18789 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB