https://d.puremagic.com/issues/show_bug.cgi?id=12305
Summary: infer context from "this" of aliased methods
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Vladimir Panteleev <[email protected]> 2014-03-06
16:44:54 EET ---
////// 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
}
//////////////////////////
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------