Skip to content

Commit

Permalink
Merge pull request #17941 from owen-mc/go/fix/missing-method-qualifie…
Browse files Browse the repository at this point in the history
…d-names

Go: fix missing qualified names for some promoted methods
  • Loading branch information
owen-mc authored Nov 11, 2024
2 parents fed240a + 0b24235 commit a277bcb
Show file tree
Hide file tree
Showing 20 changed files with 153 additions and 13 deletions.
13 changes: 12 additions & 1 deletion go/extractor/extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1713,13 +1713,24 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
extractMethod(tw, meth)
}

underlyingInterface, underlyingIsInterface := underlying.(*types.Interface)
_, underlyingIsPointer := underlying.(*types.Pointer)

// associate all methods of underlying interface with this type
if underlyingInterface, ok := underlying.(*types.Interface); ok {
if underlyingIsInterface {
for i := 0; i < underlyingInterface.NumMethods(); i++ {
methlbl := extractMethod(tw, underlyingInterface.Method(i).Origin())
dbscheme.MethodHostsTable.Emit(tw, methlbl, lbl)
}
}

// If `underlying` is not a pointer or interface then methods can
// be defined on `origintp`. In this case we must ensure that
// `*origintp` is in the database, so that Method.hasQualifiedName
// correctly includes methods with receiver type `*origintp`.
if !underlyingIsInterface && !underlyingIsPointer {
extractType(tw, types.NewPointer(origintp))
}
case *types.TypeParam:
kind = dbscheme.TypeParamType.Index()
parentlbl := getTypeParamParentLabel(tw, tp)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: fix
---
* Fixed a bug which meant that some qualified names for promoted methods were not being recognised in some very specific circumstances.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
| pkg1/embedding.go:28:24:28:31 | embedder | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
| pkg1/embedding.go:36:2:36:5 | base | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
| pkg1/embedding.go:37:2:37:2 | f | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
| pkg1/promotedStructs.go:5:2:5:7 | SField | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
| pkg1/promotedStructs.go:14:2:14:7 | PField | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
| pkg1/promotedStructs.go:22:22:22:22 | S | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
| pkg1/promotedStructs.go:25:22:25:22 | P | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
| pkg1/tst.go:4:2:4:2 | f | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
| pkg1/tst.go:5:2:5:4 | Foo | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
| pkg1/tst.go:6:2:6:4 | Bar | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
| pkg1/embedding.go:28:24:28:31 | embedder | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.embedder3 | embedder |
| pkg1/embedding.go:36:2:36:5 | base | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.embedder4 | base |
| pkg1/embedding.go:37:2:37:2 | f | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.embedder4 | f |
| pkg1/promotedStructs.go:5:2:5:7 | SField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.S | SField |
| pkg1/promotedStructs.go:5:2:5:7 | SField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.SEmbedS | SField |
| pkg1/promotedStructs.go:14:2:14:7 | PField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.P | PField |
| pkg1/promotedStructs.go:14:2:14:7 | PField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.SEmbedP | PField |
| pkg1/promotedStructs.go:22:22:22:22 | S | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.SEmbedS | S |
| pkg1/promotedStructs.go:25:22:25:22 | P | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.SEmbedP | P |
| pkg1/tst.go:4:2:4:2 | f | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T | f |
| pkg1/tst.go:5:2:5:4 | Foo | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T | Foo |
| pkg1/tst.go:6:2:6:4 | Bar | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T | Bar |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
| pkg1/embedding.go:28:24:28:31 | embedder | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | embedder3 | embedder |
| pkg1/embedding.go:36:2:36:5 | base | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | embedder4 | base |
| pkg1/embedding.go:37:2:37:2 | f | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | embedder4 | f |
| pkg1/promotedStructs.go:5:2:5:7 | SField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | S | SField |
| pkg1/promotedStructs.go:5:2:5:7 | SField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | SEmbedS | SField |
| pkg1/promotedStructs.go:14:2:14:7 | PField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | P | PField |
| pkg1/promotedStructs.go:14:2:14:7 | PField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | SEmbedP | PField |
| pkg1/promotedStructs.go:22:22:22:22 | S | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | SEmbedS | S |
| pkg1/promotedStructs.go:25:22:25:22 | P | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | SEmbedP | P |
| pkg1/tst.go:4:2:4:2 | f | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | T | f |
| pkg1/tst.go:5:2:5:4 | Foo | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | T | Foo |
| pkg1/tst.go:6:2:6:4 | Bar | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | T | Bar |
Expand Down
9 changes: 9 additions & 0 deletions go/ql/test/library-tests/semmle/go/Types/MethodCount.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
| * Foo | 1 |
| * P | 1 |
| * S | 1 |
| * SEmbedP | 1 |
| * SEmbedS | 1 |
| * T | 1 |
| * T3 | 1 |
| * T4 | 1 |
| * base | 2 |
| * embedder | 2 |
| * embedder2 | 2 |
Expand All @@ -16,6 +23,8 @@
| GenericInterface | 1 |
| MixedExportedAndNot | 2 |
| MyInterface | 17 |
| S | 1 |
| SEmbedS | 1 |
| T | 1 |
| T3 | 1 |
| T4 | 1 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
| pkg1/interfaces.go:31:6:31:7 | A2 | m | func() |
| pkg1/interfaces.go:35:6:35:24 | MixedExportedAndNot | Exported | func() |
| pkg1/interfaces.go:35:6:35:24 | MixedExportedAndNot | notExported | func() |
| pkg1/promotedStructs.go:22:6:22:12 | SEmbedS | SMethod | func() interface { } |
| pkg1/tst.go:3:6:3:6 | T | half | func() Foo |
| pkg1/tst.go:14:6:14:7 | T3 | half | func() Foo |
| pkg1/tst.go:19:6:19:7 | T4 | half | func() Foo |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
| pkg1/interfaces.go:32:2:32:2 | m | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.A2 | m |
| pkg1/interfaces.go:36:2:36:9 | Exported | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.MixedExportedAndNot | Exported |
| pkg1/interfaces.go:37:2:37:12 | notExported | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.MixedExportedAndNot | notExported |
| pkg1/promotedStructs.go:8:12:8:18 | SMethod | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.S | SMethod |
| pkg1/promotedStructs.go:8:12:8:18 | SMethod | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.SEmbedS | SMethod |
| pkg1/promotedStructs.go:17:13:17:19 | PMethod | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.P | PMethod |
| pkg1/promotedStructs.go:17:13:17:19 | PMethod | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.SEmbedP | PMethod |
| pkg1/tst.go:33:16:33:19 | half | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.Foo | half |
| pkg1/tst.go:33:16:33:19 | half | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T | half |
| pkg1/tst.go:33:16:33:19 | half | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T3 | half |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
| pkg1/interfaces.go:32:2:32:2 | m | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | A2 | m |
| pkg1/interfaces.go:36:2:36:9 | Exported | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | MixedExportedAndNot | Exported |
| pkg1/interfaces.go:37:2:37:12 | notExported | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | MixedExportedAndNot | notExported |
| pkg1/promotedStructs.go:8:12:8:18 | SMethod | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | S | SMethod |
| pkg1/promotedStructs.go:8:12:8:18 | SMethod | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | SEmbedS | SMethod |
| pkg1/promotedStructs.go:17:13:17:19 | PMethod | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | P | PMethod |
| pkg1/promotedStructs.go:17:13:17:19 | PMethod | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | SEmbedP | PMethod |
| pkg1/tst.go:33:16:33:19 | half | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | Foo | half |
| pkg1/tst.go:33:16:33:19 | half | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | T | half |
| pkg1/tst.go:33:16:33:19 | half | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | T3 | half |
Expand Down
9 changes: 9 additions & 0 deletions go/ql/test/library-tests/semmle/go/Types/Methods.expected
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
| * Foo | half | pkg1/tst.go:33:16:33:19 | half |
| * P | PMethod | pkg1/promotedStructs.go:17:13:17:19 | PMethod |
| * S | SMethod | pkg1/promotedStructs.go:8:12:8:18 | SMethod |
| * SEmbedP | PMethod | pkg1/promotedStructs.go:17:13:17:19 | PMethod |
| * SEmbedS | SMethod | pkg1/promotedStructs.go:8:12:8:18 | SMethod |
| * T | half | pkg1/tst.go:33:16:33:19 | half |
| * T3 | half | pkg1/tst.go:33:16:33:19 | half |
| * T4 | half | pkg1/tst.go:33:16:33:19 | half |
| * base | f | pkg1/embedding.go:10:13:10:13 | f |
| * base | g | pkg1/embedding.go:14:14:14:14 | g |
| * embedder | f | pkg1/embedding.go:10:13:10:13 | f |
Expand Down Expand Up @@ -45,6 +52,8 @@
| MyInterface | dummy18 | generic.go:62:2:62:8 | dummy18 |
| MyInterface | dummy19 | generic.go:63:2:63:8 | dummy19 |
| MyInterface | dummy20 | generic.go:64:2:64:8 | dummy20 |
| S | SMethod | pkg1/promotedStructs.go:8:12:8:18 | SMethod |
| SEmbedS | SMethod | pkg1/promotedStructs.go:8:12:8:18 | SMethod |
| T | half | pkg1/tst.go:33:16:33:19 | half |
| T3 | half | pkg1/tst.go:33:16:33:19 | half |
| T4 | half | pkg1/tst.go:33:16:33:19 | half |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@
| pkg1/interfaces.go:26:6:26:14 | AExtended | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.AExtended |
| pkg1/interfaces.go:31:6:31:7 | A2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.A2 |
| pkg1/interfaces.go:35:6:35:24 | MixedExportedAndNot | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.MixedExportedAndNot |
| pkg1/promotedStructs.go:4:6:4:6 | S | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.S |
| pkg1/promotedStructs.go:13:6:13:6 | P | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.P |
| pkg1/promotedStructs.go:22:6:22:12 | SEmbedS | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.SEmbedS |
| pkg1/promotedStructs.go:25:6:25:12 | SEmbedP | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.SEmbedP |
| pkg1/tst.go:3:6:3:6 | T | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T |
| pkg1/tst.go:9:6:9:7 | T2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T2 |
| pkg1/tst.go:14:6:14:7 | T3 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T3 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@
| pkg1/embedding.go:14:1:16:1 | function declaration | 0 |
| pkg1/embedding.go:30:1:32:1 | function declaration | 0 |
| pkg1/embedding.go:40:1:61:1 | function declaration | 0 |
| pkg1/promotedStructs.go:8:1:10:1 | function declaration | 0 |
| pkg1/promotedStructs.go:17:1:19:1 | function declaration | 0 |
| pkg1/tst.go:33:1:35:1 | function declaration | 0 |
| pkg1/tst.go:37:1:37:26 | function declaration | 1 |
| pkg1/tst.go:39:1:57:1 | function declaration | 2 |
| promoted.go:7:1:10:1 | function declaration | 1 |
| promoted.go:12:1:15:1 | function declaration | 1 |
| promoted.go:17:1:20:1 | function declaration | 1 |
| promoted.go:22:1:25:1 | function declaration | 1 |
| unknownFunction.go:8:1:12:1 | function declaration | 0 |
| variadicFunctions.go:5:1:8:1 | function declaration | 0 |
| variadicFunctions.go:10:1:18:1 | function declaration | 1 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@
| pkg1/embedding.go:14:1:16:1 | function declaration | 1 |
| pkg1/embedding.go:30:1:32:1 | function declaration | 1 |
| pkg1/embedding.go:40:1:61:1 | function declaration | 0 |
| pkg1/promotedStructs.go:8:1:10:1 | function declaration | 1 |
| pkg1/promotedStructs.go:17:1:19:1 | function declaration | 1 |
| pkg1/tst.go:33:1:35:1 | function declaration | 1 |
| pkg1/tst.go:37:1:37:26 | function declaration | 0 |
| pkg1/tst.go:39:1:57:1 | function declaration | 0 |
| promoted.go:7:1:10:1 | function declaration | 0 |
| promoted.go:12:1:15:1 | function declaration | 0 |
| promoted.go:17:1:20:1 | function declaration | 0 |
| promoted.go:22:1:25:1 | function declaration | 0 |
| unknownFunction.go:8:1:12:1 | function declaration | 0 |
| variadicFunctions.go:5:1:8:1 | function declaration | 0 |
| variadicFunctions.go:10:1:18:1 | function declaration | 1 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
| pkg1/embedding.go:28:6:28:14 | embedder3 | pkg1/embedding.go:28:16:28:33 | struct type | embedder | embedder |
| pkg1/embedding.go:35:6:35:14 | embedder4 | pkg1/embedding.go:35:16:38:1 | struct type | base | base |
| pkg1/embedding.go:35:6:35:14 | embedder4 | pkg1/embedding.go:35:16:38:1 | struct type | f | int |
| pkg1/promotedStructs.go:4:6:4:6 | S | pkg1/promotedStructs.go:4:8:6:1 | struct type | SField | string |
| pkg1/promotedStructs.go:13:6:13:6 | P | pkg1/promotedStructs.go:13:8:15:1 | struct type | PField | string |
| pkg1/promotedStructs.go:22:6:22:12 | SEmbedS | pkg1/promotedStructs.go:22:14:22:24 | struct type | S | S |
| pkg1/promotedStructs.go:22:6:22:12 | SEmbedS | pkg1/promotedStructs.go:22:14:22:24 | struct type | SField | string |
| pkg1/promotedStructs.go:25:6:25:12 | SEmbedP | pkg1/promotedStructs.go:25:14:25:24 | struct type | P | P |
| pkg1/promotedStructs.go:25:6:25:12 | SEmbedP | pkg1/promotedStructs.go:25:14:25:24 | struct type | PField | string |
| pkg1/tst.go:3:6:3:6 | T | pkg1/tst.go:3:8:7:1 | struct type | Bar | Bar |
| pkg1/tst.go:3:6:3:6 | T | pkg1/tst.go:3:8:7:1 | struct type | Foo | Foo |
| pkg1/tst.go:3:6:3:6 | T | pkg1/tst.go:3:8:7:1 | struct type | f | int |
Expand Down
4 changes: 4 additions & 0 deletions go/ql/test/library-tests/semmle/go/Types/Types.expected
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@
| pkg1/interfaces.go:26:6:26:14 | AExtended | AExtended |
| pkg1/interfaces.go:31:6:31:7 | A2 | A2 |
| pkg1/interfaces.go:35:6:35:24 | MixedExportedAndNot | MixedExportedAndNot |
| pkg1/promotedStructs.go:4:6:4:6 | S | S |
| pkg1/promotedStructs.go:13:6:13:6 | P | P |
| pkg1/promotedStructs.go:22:6:22:12 | SEmbedS | SEmbedS |
| pkg1/promotedStructs.go:25:6:25:12 | SEmbedP | SEmbedP |
| pkg1/tst.go:3:6:3:6 | T | T |
| pkg1/tst.go:9:6:9:7 | T2 | T2 |
| pkg1/tst.go:14:6:14:7 | T3 | T3 |
Expand Down
25 changes: 25 additions & 0 deletions go/ql/test/library-tests/semmle/go/Types/pkg1/promotedStructs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package pkg1

// A struct type with methods defined on it
type S struct {
SField string
}

func (t S) SMethod() interface{} {
return nil
}

// A struct type with methods defined on its pointer type
type P struct {
PField string
}

func (t *P) PMethod() interface{} {
return nil
}

// A struct type embedding S
type SEmbedS struct{ S }

// A struct type embedding P
type SEmbedP struct{ P }
25 changes: 25 additions & 0 deletions go/ql/test/library-tests/semmle/go/Types/promoted.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package main

import "github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1"

// IMPORTANT: Make sure that *pkg1.SEmbedP is not referenced.

func testS(t pkg1.S) {
_ = t.SMethod()
_ = t.SField
}

func testP(t pkg1.P) {
_ = t.PMethod()
_ = t.PField
}

func testSEmbedS(t pkg1.SEmbedS) {
_ = t.SMethod()
_ = t.SField
}

func testSEmbedP(t pkg1.SEmbedP) {
_ = t.PMethod()
_ = t.PField
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ callTargets
| test.go:57:2:57:29 | call to ImplementMe | test.go:46:1:46:87 | function declaration | ImplementMe |
| test.go:57:2:57:29 | call to ImplementMe | test.go:53:1:53:85 | function declaration | ImplementMe |
#select
| file://:0:0:0:0 | basic interface type | file://:0:0:0:0 | basic interface type |
| file://:0:0:0:0 | basic interface type | test.go:18:6:18:10 | Impl1 |
| file://:0:0:0:0 | basic interface type | test.go:23:6:23:10 | Impl2 |
| file://:0:0:0:0 | basic interface type | test.go:28:6:28:10 | Impl3 |
| file://:0:0:0:0 | basic interface type | test.go:35:6:35:10 | Impl4 |
| file://:0:0:0:0 | basic interface type | test.go:42:6:42:10 | Impl5 |
| file://:0:0:0:0 | basic interface type | test.go:49:6:49:10 | Impl6 |
| file://:0:0:0:0 | basic interface type | * Impl1 |
| file://:0:0:0:0 | basic interface type | * Impl2 |
| file://:0:0:0:0 | basic interface type | * Impl3 |
| file://:0:0:0:0 | basic interface type | * Impl4 |
| file://:0:0:0:0 | basic interface type | * Impl5 |
| file://:0:0:0:0 | basic interface type | * Impl6 |
| file://:0:0:0:0 | basic interface type | Impl1 |
| file://:0:0:0:0 | basic interface type | Impl2 |
| file://:0:0:0:0 | basic interface type | Impl3 |
| file://:0:0:0:0 | basic interface type | Impl4 |
| file://:0:0:0:0 | basic interface type | Impl5 |
| file://:0:0:0:0 | basic interface type | Impl6 |
| file://:0:0:0:0 | basic interface type | interface { ImplementMe func(func(struct { x int }) ) } |
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ from InterfaceType i, Type impl
where
i.hasMethod("ImplementMe", _) and
impl.implements(i)
select i, impl
select i, impl.pp()
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ func TestI2(t test.I2) {
func TestS1(t test.S1) {
x := t.Source()
y := t.Step(x)
t.Sink(y) // $ I1[t] S1[f] S1[t] ql_S1 SPURIOUS: IEmbedI1[t] SEmbedI1[t]
t.Sink(y) // $ I1[t] S1[f] S1[t] ql_S1 SPURIOUS: IEmbedI1[t] SEmbedI1[t] SEmbedS1[t]
}

func TestS2(t test.S2) {
x := t.Source()
y := t.Step(x)
t.Sink(y) // $ I1[t] I2[t] SPURIOUS: IEmbedI1[t] IEmbedI2[t] SEmbedI1[t] SEmbedI2[t]
t.Sink(y) // $ I1[t] I2[t] SPURIOUS: IEmbedI1[t] IEmbedI2[t] SEmbedI1[t] SEmbedI2[t] SEmbedS2[t]
}

func TestSEmbedI1(t test.SEmbedI1) {
Expand Down Expand Up @@ -67,13 +67,13 @@ func TestSImplEmbedI2(t test.SImplEmbedI2) {
func TestSEmbedS1(t test.SEmbedS1) {
x := t.Source()
y := t.Step(x)
t.Sink(y) // $ I1[t] S1[t] ql_S1 SPURIOUS: IEmbedI1[t] S1[f] SEmbedI1[t]
t.Sink(y) // $ I1[t] S1[t] SEmbedS1[t] ql_S1 SPURIOUS: IEmbedI1[t] S1[f] SEmbedI1[t]
}

func TestSEmbedS2(t test.SEmbedS2) {
x := t.Source()
y := t.Step(x)
t.Sink(y) // $ I1[t] I2[t] SPURIOUS: IEmbedI1[t] IEmbedI2[t] SEmbedI1[t] SEmbedI2[t]
t.Sink(y) // $ I1[t] I2[t] SEmbedS2[t] SPURIOUS: IEmbedI1[t] IEmbedI2[t] SEmbedI1[t] SEmbedI2[t]
}

func TestSImplEmbedS1(t test.SImplEmbedS1) {
Expand Down

0 comments on commit a277bcb

Please sign in to comment.