yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
88a180ba0
master
1//DIAGNOSTIC_TEST:SIMPLE: 2 3interface IThing 4{ 5 [mutating] 6 void f(); 7 8 void g(); 9} 10 11struct MyThing: IThing 12{ 13 int a = 0; 14 15 [mutating] 16 void f() 17 { 18 a = 10; 19 } 20 21 void g() {} 22} 23 24void g(IThing x) 25{ 26 x.g(); 27} 28 29void f(inout IThing x) 30{ 31 x.f(); 32} 33 34void h<T:IThing>(inout T x) 35{ 36 x.f(); 37} 38 39void entry() 40{ 41 MyThing concrete; 42 IThing interfaceTyped = MyThing(); 43 44 g(interfaceTyped); // No error 45 g(concrete); // No error 46 f(interfaceTyped); // No error 47 h(concrete); // No error 48 f(concrete); // ERROR! 49}