Skip to content

Commit 2d5cbfd

Browse files
committed
Elaborate comments
1 parent 4172692 commit 2d5cbfd

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

go/ql/test/library-tests/semmle/go/aliases/DataflowFields/embedding.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import (
88
// Tests that dataflow behaves as expected when loads and stores from a field traverse embeddings that use different type names.
99

1010
// pkg2.IntStruct is an alias for pkg1.IntStruct
11-
// Note trickery with packages is necessary so that Go will assign the fields the same name as well as the same type.
11+
// Note referring to symbols in different packages is necessary so that Go will assign the fields the same name as well as the same type--
12+
// for example, if we defined two aliases here named 'IntStruct1' and 'IntStruct2' and embedded them into two types,
13+
// the types would be non-identical due to having a field implicitly named IntStruct1 and IntStruct2 respectively,
14+
// even though syntactically it could be addressed without mentioning the field name.
1215

1316
type EmbedsPkg1IntStruct = struct{ pkg1.IntStruct }
1417
type EmbedsPkg2IntStruct = struct{ pkg2.IntStruct }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module test.com/basename
22

3-
go 1.22.5
3+
go 1.23.1

go/ql/test/library-tests/semmle/go/aliases/InterfaceImpls/test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package intfs
22

33
// Tests that dataflow and interface implementation behave as expected when an interface
4-
// is implemented using a non-equal but identical type, i.e. an equal type after alias resolution.
4+
// is implemented using an identical type (in the structural sense defined by the go spec)
5+
// where the two types differ at surface level, i.e. aliases must be followed to determine
6+
// that they are identical.
57

68
type IntAlias = int
79

0 commit comments

Comments
 (0)