From c43ff2f9d0b0317e16d2e0761e5d31f44d7d3c4c Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Sat, 16 Oct 2021 21:54:23 +0200 Subject: [PATCH] add test for super-types --- ql/test/type/Test.qll | 14 ++++++++++++++ ql/test/type/type.expected | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/ql/test/type/Test.qll b/ql/test/type/Test.qll index 484132c2005..acb2302572b 100644 --- a/ql/test/type/Test.qll +++ b/ql/test/type/Test.qll @@ -11,3 +11,17 @@ class Floats extends float { string conc(Strings a, Strings b) { result = a + b } float floats(Floats a, Floats b) { result = a + b } + +class Base extends string { + Base() { this = ["foo"] } + + int foo() { result = 1 } +} + +class Sub extends Base { + Sub() { this = ["bar"] } + + int bar() { result = Base.super.foo() } + + int bar2() { result = super.foo() } +} diff --git a/ql/test/type/type.expected b/ql/test/type/type.expected index ed05b1aac84..8da7ec49e84 100644 --- a/ql/test/type/type.expected +++ b/ql/test/type/type.expected @@ -34,3 +34,19 @@ | Test.qll:13:45:13:45 | a | Test.qll:7:1:9:1 | Floats | | Test.qll:13:45:13:49 | AddExpr | file://:0:0:0:0 | float | | Test.qll:13:49:13:49 | b | Test.qll:7:1:9:1 | Floats | +| Test.qll:16:12:16:15 | this | Test.qll:15:1:19:1 | Base | +| Test.qll:16:12:16:15 | this | Test.qll:15:1:19:1 | Base.Base | +| Test.qll:16:12:16:15 | this | Test.qll:15:1:19:1 | Base.extends | +| Test.qll:16:19:16:25 | Set | file://:0:0:0:0 | string | +| Test.qll:16:20:16:24 | String | file://:0:0:0:0 | string | +| Test.qll:18:15:18:20 | result | file://:0:0:0:0 | int | +| Test.qll:18:24:18:24 | Integer | file://:0:0:0:0 | int | +| Test.qll:22:11:22:14 | this | Test.qll:21:1:27:1 | Sub | +| Test.qll:22:11:22:14 | this | Test.qll:21:1:27:1 | Sub.Sub | +| Test.qll:22:11:22:14 | this | Test.qll:21:1:27:1 | Sub.extends | +| Test.qll:22:18:22:24 | Set | file://:0:0:0:0 | string | +| Test.qll:22:19:22:23 | String | file://:0:0:0:0 | string | +| Test.qll:24:15:24:20 | result | file://:0:0:0:0 | int | +| Test.qll:24:24:24:39 | MemberCall | file://:0:0:0:0 | int | +| Test.qll:26:16:26:21 | result | file://:0:0:0:0 | int | +| Test.qll:26:25:26:35 | MemberCall | file://:0:0:0:0 | int |