On Wednesday, 6 August 2025 at 22:41:28 UTC, Andrey Zherikov wrote:
This is simplified code that illustrates the issue I've faced:
```d
struct A(T) {}

alias B(T) = A!T;

void f(T)(B!T b) {}

f(B!string.init);
// Error: template `f` is not callable using argument types `!()(A!string)`
//f(B!string.init);
// ^
//       Candidate is: `f(T)(B!T b)`
//void f(T)(B!T b) {}
//     ^
```

I know that I can do `alias B = A` in this specific example, but in the actual code, I'm trying to do `alias B(T) = A!(H!T)` which leads to the same error:
```d
struct A(T) {}
struct H(T) {}

alias B(T) = A!(H!T);

void f(T)(B!T b) {}

f(B!string.init);
// Error: template `f` is not callable using argument types `!()(A!(H!string))`
//f(B!string.init);
// ^
//        Candidate is: `f(T)(B!T b)`
//void f(T)(B!T b) {}
//     ^
```

```d
struct A(T) {}
struct H(T) {}

alias B(T) = A!(H!T);

void f(T)(A!(H!T) b) {}
void g(T)(A!T b) {}
void h(B_)(B_ b)if(is(B_==A!(H!T),T)){}
unittest{
    f(B!string.init);
    g(B!int.init);
    h(B!bool.init);
}
```

I dont think you should actually try to pull patterns out of `h`, and just go with a `void i(T...)(T args)` if you have something complex to match but without a usecase, who knows

---

I think your mistaken about aliased types existing, Idk what the spec says but these seem awfully "eager"
```d
alias C(T,int i)=A!(H!T);
void j(T)(T b){
    pragma(msg,typeof(b).stringof);
}
unittest{
    j(C!(float,10).init);//A!(H!float)
    pragma(msg,typeof(C!(float,10).init).stringof);//A!(H!float)
}
```

As far as I know there is no way to recover the 'i' so does `C!(float,10)` even exist?

```d
alias foo=int;
unittest{
pragma(msg,__traits(identifier,foo));//Error: argument `int` has no identifier
}
```

Reply via email to