File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed
go/ql/test/library-tests/semmle/go/aliases Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,10 @@ import (
8
8
// Tests that dataflow behaves as expected when loads and stores from a field traverse embeddings that use different type names.
9
9
10
10
// 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.
12
15
13
16
type EmbedsPkg1IntStruct = struct { pkg1.IntStruct }
14
17
type EmbedsPkg2IntStruct = struct { pkg2.IntStruct }
Original file line number Diff line number Diff line change 1
1
module test.com/basename
2
2
3
- go 1.22.5
3
+ go 1.23.1
Original file line number Diff line number Diff line change 1
1
package intfs
2
2
3
3
// 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.
5
7
6
8
type IntAlias = int
7
9
You can’t perform that action at this time.
0 commit comments