Skip to content

Commit c43ff2f

Browse files
committed
add test for super-types
1 parent c1b011d commit c43ff2f

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

ql/test/type/Test.qll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,17 @@ class Floats extends float {
1111
string conc(Strings a, Strings b) { result = a + b }
1212

1313
float floats(Floats a, Floats b) { result = a + b }
14+
15+
class Base extends string {
16+
Base() { this = ["foo"] }
17+
18+
int foo() { result = 1 }
19+
}
20+
21+
class Sub extends Base {
22+
Sub() { this = ["bar"] }
23+
24+
int bar() { result = Base.super.foo() }
25+
26+
int bar2() { result = super.foo() }
27+
}

ql/test/type/type.expected

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,19 @@
3434
| Test.qll:13:45:13:45 | a | Test.qll:7:1:9:1 | Floats |
3535
| Test.qll:13:45:13:49 | AddExpr | file://:0:0:0:0 | float |
3636
| Test.qll:13:49:13:49 | b | Test.qll:7:1:9:1 | Floats |
37+
| Test.qll:16:12:16:15 | this | Test.qll:15:1:19:1 | Base |
38+
| Test.qll:16:12:16:15 | this | Test.qll:15:1:19:1 | Base.Base |
39+
| Test.qll:16:12:16:15 | this | Test.qll:15:1:19:1 | Base.extends |
40+
| Test.qll:16:19:16:25 | Set | file://:0:0:0:0 | string |
41+
| Test.qll:16:20:16:24 | String | file://:0:0:0:0 | string |
42+
| Test.qll:18:15:18:20 | result | file://:0:0:0:0 | int |
43+
| Test.qll:18:24:18:24 | Integer | file://:0:0:0:0 | int |
44+
| Test.qll:22:11:22:14 | this | Test.qll:21:1:27:1 | Sub |
45+
| Test.qll:22:11:22:14 | this | Test.qll:21:1:27:1 | Sub.Sub |
46+
| Test.qll:22:11:22:14 | this | Test.qll:21:1:27:1 | Sub.extends |
47+
| Test.qll:22:18:22:24 | Set | file://:0:0:0:0 | string |
48+
| Test.qll:22:19:22:23 | String | file://:0:0:0:0 | string |
49+
| Test.qll:24:15:24:20 | result | file://:0:0:0:0 | int |
50+
| Test.qll:24:24:24:39 | MemberCall | file://:0:0:0:0 | int |
51+
| Test.qll:26:16:26:21 | result | file://:0:0:0:0 | int |
52+
| Test.qll:26:25:26:35 | MemberCall | file://:0:0:0:0 | int |

0 commit comments

Comments
 (0)