D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8259 - AssociativeArray seen through with alias parameter and UFCS
Summary: AssociativeArray seen through with alias parameter and UFCS
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-17 10:28 UTC by Jacob Carlborg
Modified: 2012-06-20 04:28 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jacob Carlborg 2012-06-17 10:28:26 UTC
The following code shows that depending on how a function is called,
UFCS or regular syntax, the type of T is inferred differently. If I
remove the alias parameter the code behaves as expected. 

string foo (alias p, T) (T t)
{
     return typeof(t).stringof;
}

void main ()
{
     string[string] aa;

     auto x = foo!(3 > 4)(aa);
     auto y = aa.foo!(3 > 4);

     assert(x == y);

     writeln("x=", x);
     writeln("y=", y);
}

In the above code the assert is triggered. If I remove the assert the
code prints:

x=string[string]
y=AssociativeArray!(string,string)
Comment 1 Kenji Hara 2012-06-20 00:35:11 UTC
Works in 2.060head.
Comment 2 Jacob Carlborg 2012-06-20 04:28:41 UTC
I does, cool.