Skip to content

Commit 0329231

Browse files
committed
Merge branch 'main' into rust-async-blocks
2 parents 63d84ed + a277bcb commit 0329231

File tree

152 files changed

+595
-1476
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+595
-1476
lines changed

Cargo.lock

Lines changed: 133 additions & 116 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/extractor/extractor.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1713,13 +1713,24 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
17131713
extractMethod(tw, meth)
17141714
}
17151715

1716+
underlyingInterface, underlyingIsInterface := underlying.(*types.Interface)
1717+
_, underlyingIsPointer := underlying.(*types.Pointer)
1718+
17161719
// associate all methods of underlying interface with this type
1717-
if underlyingInterface, ok := underlying.(*types.Interface); ok {
1720+
if underlyingIsInterface {
17181721
for i := 0; i < underlyingInterface.NumMethods(); i++ {
17191722
methlbl := extractMethod(tw, underlyingInterface.Method(i).Origin())
17201723
dbscheme.MethodHostsTable.Emit(tw, methlbl, lbl)
17211724
}
17221725
}
1726+
1727+
// If `underlying` is not a pointer or interface then methods can
1728+
// be defined on `origintp`. In this case we must ensure that
1729+
// `*origintp` is in the database, so that Method.hasQualifiedName
1730+
// correctly includes methods with receiver type `*origintp`.
1731+
if !underlyingIsInterface && !underlyingIsPointer {
1732+
extractType(tw, types.NewPointer(origintp))
1733+
}
17231734
case *types.TypeParam:
17241735
kind = dbscheme.TypeParamType.Index()
17251736
parentlbl := getTypeParamParentLabel(tw, tp)

go/extractor/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ toolchain go1.23.1
1010
// bazel mod tidy
1111
require (
1212
golang.org/x/mod v0.22.0
13-
golang.org/x/tools v0.26.0
13+
golang.org/x/tools v0.27.0
1414
)
1515

16-
require golang.org/x/sync v0.8.0 // indirect
16+
require golang.org/x/sync v0.9.0 // indirect

go/extractor/go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
22
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
3-
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
4-
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
5-
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
6-
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
3+
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
4+
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
5+
golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
6+
golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: fix
3+
---
4+
* Fixed a bug which meant that some qualified names for promoted methods were not being recognised in some very specific circumstances.

go/ql/test/library-tests/semmle/go/Types/Field_getPackage.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
| pkg1/embedding.go:28:24:28:31 | embedder | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
3333
| pkg1/embedding.go:36:2:36:5 | base | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
3434
| pkg1/embedding.go:37:2:37:2 | f | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
35+
| pkg1/promotedStructs.go:5:2:5:7 | SField | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
36+
| pkg1/promotedStructs.go:14:2:14:7 | PField | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
37+
| pkg1/promotedStructs.go:22:22:22:22 | S | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
38+
| pkg1/promotedStructs.go:25:22:25:22 | P | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
3539
| pkg1/tst.go:4:2:4:2 | f | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
3640
| pkg1/tst.go:5:2:5:4 | Foo | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
3741
| pkg1/tst.go:6:2:6:4 | Bar | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |

go/ql/test/library-tests/semmle/go/Types/Field_hasQualifiedName2.expected

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@
4343
| pkg1/embedding.go:28:24:28:31 | embedder | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.embedder3 | embedder |
4444
| pkg1/embedding.go:36:2:36:5 | base | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.embedder4 | base |
4545
| pkg1/embedding.go:37:2:37:2 | f | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.embedder4 | f |
46+
| pkg1/promotedStructs.go:5:2:5:7 | SField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.S | SField |
47+
| pkg1/promotedStructs.go:5:2:5:7 | SField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.SEmbedS | SField |
48+
| pkg1/promotedStructs.go:14:2:14:7 | PField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.P | PField |
49+
| pkg1/promotedStructs.go:14:2:14:7 | PField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.SEmbedP | PField |
50+
| pkg1/promotedStructs.go:22:22:22:22 | S | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.SEmbedS | S |
51+
| pkg1/promotedStructs.go:25:22:25:22 | P | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.SEmbedP | P |
4652
| pkg1/tst.go:4:2:4:2 | f | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T | f |
4753
| pkg1/tst.go:5:2:5:4 | Foo | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T | Foo |
4854
| pkg1/tst.go:6:2:6:4 | Bar | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T | Bar |

go/ql/test/library-tests/semmle/go/Types/Field_hasQualifiedName3.expected

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@
4343
| pkg1/embedding.go:28:24:28:31 | embedder | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | embedder3 | embedder |
4444
| pkg1/embedding.go:36:2:36:5 | base | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | embedder4 | base |
4545
| pkg1/embedding.go:37:2:37:2 | f | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | embedder4 | f |
46+
| pkg1/promotedStructs.go:5:2:5:7 | SField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | S | SField |
47+
| pkg1/promotedStructs.go:5:2:5:7 | SField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | SEmbedS | SField |
48+
| pkg1/promotedStructs.go:14:2:14:7 | PField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | P | PField |
49+
| pkg1/promotedStructs.go:14:2:14:7 | PField | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | SEmbedP | PField |
50+
| pkg1/promotedStructs.go:22:22:22:22 | S | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | SEmbedS | S |
51+
| pkg1/promotedStructs.go:25:22:25:22 | P | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | SEmbedP | P |
4652
| pkg1/tst.go:4:2:4:2 | f | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | T | f |
4753
| pkg1/tst.go:5:2:5:4 | Foo | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | T | Foo |
4854
| pkg1/tst.go:6:2:6:4 | Bar | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | T | Bar |

go/ql/test/library-tests/semmle/go/Types/MethodCount.expected

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
| * Foo | 1 |
2+
| * P | 1 |
3+
| * S | 1 |
4+
| * SEmbedP | 1 |
5+
| * SEmbedS | 1 |
6+
| * T | 1 |
7+
| * T3 | 1 |
8+
| * T4 | 1 |
29
| * base | 2 |
310
| * embedder | 2 |
411
| * embedder2 | 2 |
@@ -16,6 +23,8 @@
1623
| GenericInterface | 1 |
1724
| MixedExportedAndNot | 2 |
1825
| MyInterface | 17 |
26+
| S | 1 |
27+
| SEmbedS | 1 |
1928
| T | 1 |
2029
| T3 | 1 |
2130
| T4 | 1 |

go/ql/test/library-tests/semmle/go/Types/MethodTypes.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
| pkg1/interfaces.go:31:6:31:7 | A2 | m | func() |
5151
| pkg1/interfaces.go:35:6:35:24 | MixedExportedAndNot | Exported | func() |
5252
| pkg1/interfaces.go:35:6:35:24 | MixedExportedAndNot | notExported | func() |
53+
| pkg1/promotedStructs.go:22:6:22:12 | SEmbedS | SMethod | func() interface { } |
5354
| pkg1/tst.go:3:6:3:6 | T | half | func() Foo |
5455
| pkg1/tst.go:14:6:14:7 | T3 | half | func() Foo |
5556
| pkg1/tst.go:19:6:19:7 | T4 | half | func() Foo |

0 commit comments

Comments
 (0)