summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/generics/where-optional-4.slang
blob: 6d72186d972f19a97021f027b68039a553976448 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
interface IThing
{
    void thing();
}

void g<T>(T t) where T: IThing
{
}

void f<T>(T t) where optional T: IThing
{
    // Error: cannot upgrade optional to non-optional witness in unchecked context.
    g<T>(t); // CHECK: error 38029
}