mirror of
https://github.com/github/codeql.git
synced 2026-01-29 06:12:58 +01:00
Add tests for go1.14 overlapping embedded methods
This commit is contained in:
17
ql/test/extractor-tests/go1.14/interfaces.expected
Normal file
17
ql/test/extractor-tests/go1.14/interfaces.expected
Normal file
@@ -0,0 +1,17 @@
|
||||
| A | A | tst.go:4:2:4:2 | m |
|
||||
| AA | AA | tst.go:4:2:4:2 | m |
|
||||
| AB | AB | tst.go:4:2:4:2 | m |
|
||||
| AB | AB | tst.go:9:2:9:2 | n |
|
||||
| ABC | ABC | tst.go:4:2:4:2 | m |
|
||||
| ABC | ABC | tst.go:9:2:9:2 | n |
|
||||
| ABC | ABC | tst.go:14:2:14:2 | o |
|
||||
| AC | AC | tst.go:4:2:4:2 | m |
|
||||
| AC | AC | tst.go:13:2:13:2 | n |
|
||||
| AC | AC | tst.go:14:2:14:2 | o |
|
||||
| B | B | tst.go:8:2:8:2 | m |
|
||||
| B | B | tst.go:9:2:9:2 | n |
|
||||
| BC | BC | tst.go:8:2:8:2 | m |
|
||||
| BC | BC | tst.go:9:2:9:2 | n |
|
||||
| BC | BC | tst.go:14:2:14:2 | o |
|
||||
| C | C | tst.go:13:2:13:2 | n |
|
||||
| C | C | tst.go:14:2:14:2 | o |
|
||||
5
ql/test/extractor-tests/go1.14/interfaces.ql
Normal file
5
ql/test/extractor-tests/go1.14/interfaces.ql
Normal file
@@ -0,0 +1,5 @@
|
||||
import go
|
||||
|
||||
from NamedType t
|
||||
where t.getPackage().getName().matches("%main")
|
||||
select t, t.getName(), t.getMethod(_)
|
||||
44
ql/test/extractor-tests/go1.14/tst.go
Normal file
44
ql/test/extractor-tests/go1.14/tst.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package main
|
||||
|
||||
type A interface {
|
||||
m()
|
||||
}
|
||||
|
||||
type B interface {
|
||||
m()
|
||||
n()
|
||||
}
|
||||
|
||||
type C interface {
|
||||
n()
|
||||
o()
|
||||
}
|
||||
|
||||
type AA interface {
|
||||
A
|
||||
A
|
||||
}
|
||||
|
||||
type AB interface {
|
||||
A
|
||||
B
|
||||
}
|
||||
|
||||
type BC interface {
|
||||
B
|
||||
C
|
||||
}
|
||||
|
||||
type AC interface {
|
||||
A
|
||||
C
|
||||
}
|
||||
|
||||
type ABC interface {
|
||||
A
|
||||
B
|
||||
C
|
||||
}
|
||||
|
||||
func main() {
|
||||
}
|
||||
@@ -13,10 +13,13 @@
|
||||
| types.go:7:6:7:15 | twoMethods | types.go:7:6:7:15 | twoMethods |
|
||||
| types.go:8:2:8:6 | meth1 | types.go:8:2:8:6 | meth1 |
|
||||
| types.go:9:2:9:6 | meth2 | types.go:9:2:9:6 | meth2 |
|
||||
| types.go:12:6:12:13 | starImpl | types.go:12:6:12:13 | starImpl |
|
||||
| types.go:14:18:14:22 | meth1 | types.go:14:18:14:22 | meth1 |
|
||||
| types.go:18:17:18:21 | meth2 | types.go:18:17:18:21 | meth2 |
|
||||
| types.go:22:6:22:12 | notImpl | types.go:22:6:22:12 | notImpl |
|
||||
| types.go:24:16:24:20 | meth1 | types.go:24:16:24:20 | meth1 |
|
||||
| types.go:24:22:24:22 | a | types.go:24:22:24:22 | a |
|
||||
| types.go:28:16:28:20 | meth2 | types.go:28:16:28:20 | meth2 |
|
||||
| types.go:12:6:12:15 | meth1Iface | types.go:12:6:12:15 | meth1Iface |
|
||||
| types.go:13:2:13:6 | meth1 | types.go:13:2:13:6 | meth1 |
|
||||
| types.go:16:6:16:23 | twoMethodsEmbedded | types.go:16:6:16:23 | twoMethodsEmbedded |
|
||||
| types.go:21:6:21:13 | starImpl | types.go:21:6:21:13 | starImpl |
|
||||
| types.go:23:18:23:22 | meth1 | types.go:23:18:23:22 | meth1 |
|
||||
| types.go:27:17:27:21 | meth2 | types.go:27:17:27:21 | meth2 |
|
||||
| types.go:31:6:31:12 | notImpl | types.go:31:6:31:12 | notImpl |
|
||||
| types.go:33:16:33:20 | meth1 | types.go:33:16:33:20 | meth1 |
|
||||
| types.go:33:22:33:22 | a | types.go:33:22:33:22 | a |
|
||||
| types.go:37:16:37:20 | meth2 | types.go:37:16:37:20 | meth2 |
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
| file://:0:0:0:0 | Println | main.go:10:2:10:12 | selection of Println |
|
||||
| file://:0:0:0:0 | false | types.go:15:9:15:13 | false |
|
||||
| file://:0:0:0:0 | false | types.go:24:9:24:13 | false |
|
||||
| main.go:6:2:6:2 | x | main.go:14:9:14:14 | selection of x |
|
||||
| main.go:6:2:6:2 | x | main.go:24:2:24:7 | selection of x |
|
||||
| main.go:13:7:13:10 | recv | main.go:14:9:14:12 | recv |
|
||||
@@ -10,4 +10,4 @@
|
||||
| main.go:17:26:17:26 | y | main.go:20:12:20:12 | y |
|
||||
| main.go:23:7:23:10 | recv | main.go:24:2:24:5 | recv |
|
||||
| types.go:4:2:4:5 | meth | main.go:18:2:18:7 | selection of meth |
|
||||
| types.go:24:22:24:22 | a | types.go:25:9:25:9 | a |
|
||||
| types.go:33:22:33:22 | a | types.go:34:9:34:9 | a |
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
| file://:0:0:0:0 | Println | <library> | main.go:10:2:10:12 | selection of Println |
|
||||
| file://:0:0:0:0 | Println | <library> | main.go:10:6:10:12 | Println |
|
||||
| file://:0:0:0:0 | bool | <library> | types.go:8:10:8:13 | bool |
|
||||
| file://:0:0:0:0 | bool | <library> | types.go:14:26:14:29 | bool |
|
||||
| file://:0:0:0:0 | bool | <library> | types.go:24:29:24:32 | bool |
|
||||
| file://:0:0:0:0 | false | <library> | types.go:15:9:15:13 | false |
|
||||
| file://:0:0:0:0 | bool | <library> | types.go:13:10:13:13 | bool |
|
||||
| file://:0:0:0:0 | bool | <library> | types.go:23:26:23:29 | bool |
|
||||
| file://:0:0:0:0 | bool | <library> | types.go:33:29:33:32 | bool |
|
||||
| file://:0:0:0:0 | false | <library> | types.go:24:9:24:13 | false |
|
||||
| file://:0:0:0:0 | fmt | <library> | main.go:10:2:10:4 | fmt |
|
||||
| file://:0:0:0:0 | int | <library> | main.go:6:4:6:6 | int |
|
||||
| file://:0:0:0:0 | int | <library> | main.go:13:23:13:25 | int |
|
||||
| file://:0:0:0:0 | int | <library> | types.go:4:9:4:11 | int |
|
||||
| file://:0:0:0:0 | int | <library> | types.go:9:10:9:12 | int |
|
||||
| file://:0:0:0:0 | int | <library> | types.go:18:25:18:27 | int |
|
||||
| file://:0:0:0:0 | int | <library> | types.go:24:24:24:26 | int |
|
||||
| file://:0:0:0:0 | int | <library> | types.go:28:24:28:26 | int |
|
||||
| file://:0:0:0:0 | int | <library> | types.go:27:25:27:27 | int |
|
||||
| file://:0:0:0:0 | int | <library> | types.go:33:24:33:26 | int |
|
||||
| file://:0:0:0:0 | int | <library> | types.go:37:24:37:26 | int |
|
||||
| main.go:5:6:5:6 | t | main.go@5:6:5:6 | main.go:5:6:5:6 | t |
|
||||
| main.go:5:6:5:6 | t | main.go@5:6:5:6 | main.go:13:13:13:13 | t |
|
||||
| main.go:5:6:5:6 | t | main.go@5:6:5:6 | main.go:17:29:17:29 | t |
|
||||
@@ -45,17 +46,22 @@
|
||||
| types.go:4:2:4:5 | meth | types.go@4:2:4:5 | main.go:18:4:18:7 | meth |
|
||||
| types.go:4:2:4:5 | meth | types.go@4:2:4:5 | types.go:4:2:4:5 | meth |
|
||||
| types.go:7:6:7:15 | twoMethods | types.go@7:6:7:15 | types.go:7:6:7:15 | twoMethods |
|
||||
| types.go:7:6:7:15 | twoMethods | types.go@7:6:7:15 | types.go:18:2:18:11 | twoMethods |
|
||||
| types.go:8:2:8:6 | meth1 | types.go@8:2:8:6 | types.go:8:2:8:6 | meth1 |
|
||||
| types.go:9:2:9:6 | meth2 | types.go@9:2:9:6 | types.go:9:2:9:6 | meth2 |
|
||||
| types.go:12:6:12:13 | starImpl | types.go@12:6:12:13 | types.go:12:6:12:13 | starImpl |
|
||||
| types.go:12:6:12:13 | starImpl | types.go@12:6:12:13 | types.go:14:8:14:15 | starImpl |
|
||||
| types.go:12:6:12:13 | starImpl | types.go@12:6:12:13 | types.go:18:7:18:14 | starImpl |
|
||||
| types.go:14:18:14:22 | meth1 | types.go@14:18:14:22 | types.go:14:18:14:22 | meth1 |
|
||||
| types.go:18:17:18:21 | meth2 | types.go@18:17:18:21 | types.go:18:17:18:21 | meth2 |
|
||||
| types.go:22:6:22:12 | notImpl | types.go@22:6:22:12 | types.go:22:6:22:12 | notImpl |
|
||||
| types.go:22:6:22:12 | notImpl | types.go@22:6:22:12 | types.go:24:7:24:13 | notImpl |
|
||||
| types.go:22:6:22:12 | notImpl | types.go@22:6:22:12 | types.go:28:7:28:13 | notImpl |
|
||||
| types.go:24:16:24:20 | meth1 | types.go@24:16:24:20 | types.go:24:16:24:20 | meth1 |
|
||||
| types.go:24:22:24:22 | a | types.go@24:22:24:22 | types.go:24:22:24:22 | a |
|
||||
| types.go:24:22:24:22 | a | types.go@24:22:24:22 | types.go:25:9:25:9 | a |
|
||||
| types.go:28:16:28:20 | meth2 | types.go@28:16:28:20 | types.go:28:16:28:20 | meth2 |
|
||||
| types.go:12:6:12:15 | meth1Iface | types.go@12:6:12:15 | types.go:12:6:12:15 | meth1Iface |
|
||||
| types.go:12:6:12:15 | meth1Iface | types.go@12:6:12:15 | types.go:17:2:17:11 | meth1Iface |
|
||||
| types.go:13:2:13:6 | meth1 | types.go@13:2:13:6 | types.go:13:2:13:6 | meth1 |
|
||||
| types.go:16:6:16:23 | twoMethodsEmbedded | types.go@16:6:16:23 | types.go:16:6:16:23 | twoMethodsEmbedded |
|
||||
| types.go:21:6:21:13 | starImpl | types.go@21:6:21:13 | types.go:21:6:21:13 | starImpl |
|
||||
| types.go:21:6:21:13 | starImpl | types.go@21:6:21:13 | types.go:23:8:23:15 | starImpl |
|
||||
| types.go:21:6:21:13 | starImpl | types.go@21:6:21:13 | types.go:27:7:27:14 | starImpl |
|
||||
| types.go:23:18:23:22 | meth1 | types.go@23:18:23:22 | types.go:23:18:23:22 | meth1 |
|
||||
| types.go:27:17:27:21 | meth2 | types.go@27:17:27:21 | types.go:27:17:27:21 | meth2 |
|
||||
| types.go:31:6:31:12 | notImpl | types.go@31:6:31:12 | types.go:31:6:31:12 | notImpl |
|
||||
| types.go:31:6:31:12 | notImpl | types.go@31:6:31:12 | types.go:33:7:33:13 | notImpl |
|
||||
| types.go:31:6:31:12 | notImpl | types.go@31:6:31:12 | types.go:37:7:37:13 | notImpl |
|
||||
| types.go:33:16:33:20 | meth1 | types.go@33:16:33:20 | types.go:33:16:33:20 | meth1 |
|
||||
| types.go:33:22:33:22 | a | types.go@33:22:33:22 | types.go:33:22:33:22 | a |
|
||||
| types.go:33:22:33:22 | a | types.go@33:22:33:22 | types.go:34:9:34:9 | a |
|
||||
| types.go:37:16:37:20 | meth2 | types.go@37:16:37:20 | types.go:37:16:37:20 | meth2 |
|
||||
|
||||
@@ -13,10 +13,13 @@
|
||||
| types.go:7:6:7:15 | twoMethods | twoMethods |
|
||||
| types.go:8:2:8:6 | meth1 | func() bool |
|
||||
| types.go:9:2:9:6 | meth2 | func() int |
|
||||
| types.go:12:6:12:13 | starImpl | starImpl |
|
||||
| types.go:14:18:14:22 | meth1 | func() bool |
|
||||
| types.go:18:17:18:21 | meth2 | func() int |
|
||||
| types.go:22:6:22:12 | notImpl | notImpl |
|
||||
| types.go:24:16:24:20 | meth1 | func(int) bool |
|
||||
| types.go:24:22:24:22 | a | int |
|
||||
| types.go:28:16:28:20 | meth2 | func() int |
|
||||
| types.go:12:6:12:15 | meth1Iface | meth1Iface |
|
||||
| types.go:13:2:13:6 | meth1 | func() bool |
|
||||
| types.go:16:6:16:23 | twoMethodsEmbedded | twoMethodsEmbedded |
|
||||
| types.go:21:6:21:13 | starImpl | starImpl |
|
||||
| types.go:23:18:23:22 | meth1 | func() bool |
|
||||
| types.go:27:17:27:21 | meth2 | func() int |
|
||||
| types.go:31:6:31:12 | notImpl | notImpl |
|
||||
| types.go:33:16:33:20 | meth1 | func(int) bool |
|
||||
| types.go:33:22:33:22 | a | int |
|
||||
| types.go:37:16:37:20 | meth2 | func() int |
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
| main.go:17:10:17:10 | x | main.go:17:10:17:10 | initialization of x |
|
||||
| main.go:17:26:17:26 | y | main.go:17:26:17:26 | initialization of y |
|
||||
| main.go:23:7:23:10 | recv | main.go:23:7:23:10 | initialization of recv |
|
||||
| types.go:24:22:24:22 | a | types.go:24:22:24:22 | initialization of a |
|
||||
| types.go:33:22:33:22 | a | types.go:33:22:33:22 | initialization of a |
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
| iHaveAMethod | meth | iHaveAMethod | meth |
|
||||
| meth1Iface | meth1 | meth1Iface | meth1 |
|
||||
| meth1Iface | meth1 | twoMethods | meth1 |
|
||||
| pointer type | meth | iHaveAMethod | meth |
|
||||
| pointer type | meth1 | meth1Iface | meth1 |
|
||||
| pointer type | meth1 | twoMethods | meth1 |
|
||||
| starImpl | meth2 | twoMethods | meth2 |
|
||||
| twoMethods | meth1 | meth1Iface | meth1 |
|
||||
| twoMethods | meth1 | twoMethods | meth1 |
|
||||
| twoMethods | meth2 | twoMethods | meth2 |
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
| iHaveAMethod | meth | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes | iHaveAMethod | meth |
|
||||
| meth1Iface | meth1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes | meth1Iface | meth1 |
|
||||
| meth1Iface | meth1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes | twoMethods | meth1 |
|
||||
| pointer type | meth | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes | iHaveAMethod | meth |
|
||||
| pointer type | meth1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes | meth1Iface | meth1 |
|
||||
| pointer type | meth1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes | twoMethods | meth1 |
|
||||
| starImpl | meth2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes | twoMethods | meth2 |
|
||||
| twoMethods | meth1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes | meth1Iface | meth1 |
|
||||
| twoMethods | meth1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes | twoMethods | meth1 |
|
||||
| twoMethods | meth2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes | twoMethods | meth2 |
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
| types.go:4:2:4:5 | meth | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes.iHaveAMethod.meth | file://:0:0:0:0 | | iHaveAMethod |
|
||||
| types.go:8:2:8:6 | meth1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes.twoMethods.meth1 | file://:0:0:0:0 | | twoMethods |
|
||||
| types.go:9:2:9:6 | meth2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes.twoMethods.meth2 | file://:0:0:0:0 | | twoMethods |
|
||||
| types.go:14:18:14:22 | meth1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes.starImpl.meth1 | file://:0:0:0:0 | | * starImpl |
|
||||
| types.go:18:17:18:21 | meth2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes.starImpl.meth2 | file://:0:0:0:0 | | starImpl |
|
||||
| types.go:24:16:24:20 | meth1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes.notImpl.meth1 | file://:0:0:0:0 | | notImpl |
|
||||
| types.go:28:16:28:20 | meth2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes.notImpl.meth2 | file://:0:0:0:0 | | notImpl |
|
||||
| types.go:13:2:13:6 | meth1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes.meth1Iface.meth1 | file://:0:0:0:0 | | meth1Iface |
|
||||
| types.go:23:18:23:22 | meth1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes.starImpl.meth1 | file://:0:0:0:0 | | * starImpl |
|
||||
| types.go:27:17:27:21 | meth2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes.starImpl.meth2 | file://:0:0:0:0 | | starImpl |
|
||||
| types.go:33:16:33:20 | meth1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes.notImpl.meth1 | file://:0:0:0:0 | | notImpl |
|
||||
| types.go:37:16:37:20 | meth2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Scopes.notImpl.meth2 | file://:0:0:0:0 | | notImpl |
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
| * starImpl | meth1Iface |
|
||||
| * starImpl | twoMethods |
|
||||
| * starImpl | twoMethodsEmbedded |
|
||||
| * t | iHaveAMethod |
|
||||
| iHaveAMethod | iHaveAMethod |
|
||||
| interface { meth1 func() bool } | meth1Iface |
|
||||
| interface { meth1 func() bool; meth2 func() int } | meth1Iface |
|
||||
| interface { meth1 func() bool; meth2 func() int } | twoMethods |
|
||||
| interface { meth1 func() bool; meth2 func() int } | twoMethodsEmbedded |
|
||||
| interface { meth func() int } | iHaveAMethod |
|
||||
| meth1Iface | meth1Iface |
|
||||
| twoMethods | meth1Iface |
|
||||
| twoMethods | twoMethods |
|
||||
| twoMethods | twoMethodsEmbedded |
|
||||
| twoMethodsEmbedded | meth1Iface |
|
||||
| twoMethodsEmbedded | twoMethods |
|
||||
| twoMethodsEmbedded | twoMethodsEmbedded |
|
||||
|
||||
@@ -9,6 +9,15 @@ type twoMethods interface {
|
||||
meth2() int
|
||||
}
|
||||
|
||||
type meth1Iface interface {
|
||||
meth1() bool
|
||||
}
|
||||
|
||||
type twoMethodsEmbedded interface {
|
||||
meth1Iface
|
||||
twoMethods
|
||||
}
|
||||
|
||||
type starImpl struct{}
|
||||
|
||||
func (*starImpl) meth1() bool {
|
||||
|
||||
Reference in New Issue
Block a user