Skip to content

Commit

Permalink
Elaborate comments
Browse files Browse the repository at this point in the history
  • Loading branch information
smowton committed Sep 17, 2024
1 parent 4172692 commit 2d5cbfd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import (
// Tests that dataflow behaves as expected when loads and stores from a field traverse embeddings that use different type names.

// pkg2.IntStruct is an alias for pkg1.IntStruct
// Note trickery with packages is necessary so that Go will assign the fields the same name as well as the same type.
// 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--
// for example, if we defined two aliases here named 'IntStruct1' and 'IntStruct2' and embedded them into two types,
// the types would be non-identical due to having a field implicitly named IntStruct1 and IntStruct2 respectively,
// even though syntactically it could be addressed without mentioning the field name.

type EmbedsPkg1IntStruct = struct{ pkg1.IntStruct }
type EmbedsPkg2IntStruct = struct{ pkg2.IntStruct }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module test.com/basename

go 1.22.5
go 1.23.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package intfs

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

type IntAlias = int

Expand Down

0 comments on commit 2d5cbfd

Please sign in to comment.