yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeEnsure generic constraints are checked before inner extension. (#7685)90c34e3db

master
541 B36 linesraw
1//TEST:SIMPLE(filecheck=CHECK):
2interface IGen<A>
3{
4    associatedtype TB;
5    int getVal();
6}
7
8interface Wrapper<A>
9{}
10
11struct Foo1<A> : IGen<A>
12{
13    typealias TB = Wrapper<A>; // `Wrapper<int>` also fails.
14    int val = 0;
15    int getVal()
16    {
17       return val;
18    }
19}
20
21struct Logic<A1, C1 : IGen<A1>>
22{
23    int val = 0;
24}
25
26extension<A, C1> Logic<A, C1>
27    where C1 : IGen<A>
28    //CHECK: ([[# @LINE+1]]): error 30404: 
29    where C1.TB == Wrapper<int>
30{
31    [mutating]
32    void setVal(int dataIn)
33    {
34        val = dataIn;
35    }
36}