blob: cfe447d949d568b2e7874ee6a5c3b8378a0e8de0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
//DIAGNOSTIC_TEST:SIMPLE:
interface IThing
{
[mutating]
void f();
void g();
}
struct MyThing: IThing
{
int a = 0;
[mutating]
void f()
{
a = 10;
}
void g() {}
}
void g(IThing x)
{
x.g();
}
void f(inout IThing x)
{
x.f();
}
void h<T:IThing>(inout T x)
{
x.f();
}
void entry()
{
MyThing concrete;
IThing interfaceTyped = MyThing();
g(interfaceTyped); // No error
g(concrete); // No error
f(interfaceTyped); // No error
h(concrete); // No error
f(concrete); // ERROR!
}
|