summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics/missing-override.slang
blob: cc2cbcad3ee0dfb80d7162943863e948cb998539 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):

interface IFoo
{
    int getVal() { return 0; }
}

struct Impl : IFoo
{
    // Missing override for getVal, which should trigger a diagnostic.
    // CHECK: ([[# @LINE+1]]): error 30853
    int getVal() { return 1; }
}

struct Impl2 : IFoo
{
    // Overriding getVal with a different signature should also trigger a diagnostic.
    // CHECK: ([[# @LINE+1]]): error 30854
    override int getVal(int x) { return x; }
}