| 1 |
//go:build go1.23 |
| 2 |
|
| 3 |
package pkg |
| 4 |
|
| 5 |
import "structs" |
| 6 |
|
| 7 |
// hostLayout isn't used because the fields of hlt5 aren't marked used because |
| 8 |
// the hostLayout named type doesn't trigger the structs.HostLayout logic. |
| 9 |
type hostLayout structs.HostLayout //@ used("hostLayout", false) |
| 10 |
type hostLayoutAlias = structs.HostLayout //@ used("hostLayoutAlias", true) |
| 11 |
|
| 12 |
type hlt1 struct { //@ used("hlt1", true) |
| 13 |
_ structs.HostLayout //@ used("_", true) |
| 14 |
hlf11 int //@ used("hlf11", true) |
| 15 |
} |
| 16 |
|
| 17 |
type hlt2 struct { //@ used("hlt2", true) |
| 18 |
structs.HostLayout //@ used("HostLayout", true) |
| 19 |
hlf21 int //@ used("hlf21", true) |
| 20 |
} |
| 21 |
|
| 22 |
type hlt3 struct { //@ used("hlt3", true) |
| 23 |
// Aliases of structs.HostLayout do mark fields used. |
| 24 |
hostLayoutAlias //@ used("hostLayoutAlias", true) |
| 25 |
hlf31 int //@ used("hlf31", true) |
| 26 |
} |
| 27 |
|
| 28 |
type hlt4 struct { //@ used("hlt4", true) |
| 29 |
// Embedding a struct that itself has a structs.HostLayout field doesn't |
| 30 |
// mark this struct's fields used. |
| 31 |
hlt3 //@ used("hlt3", false) |
| 32 |
hlf41 int //@ used("hlf41", false) |
| 33 |
} |
| 34 |
|
| 35 |
type hlt5 struct { //@ used("hlt5", true) |
| 36 |
// Named types with underlying type structs.HostLayout don't mark fields |
| 37 |
// used. |
| 38 |
hostLayout //@ used("hostLayout", false) |
| 39 |
hlf51 int //@ used("hlf51", false) |
| 40 |
} |
| 41 |
|
| 42 |
type hlt6 struct { //@ used("hlt6", false) |
| 43 |
// The fields may be used, but the overall struct isn't. |
| 44 |
_ structs.HostLayout //@ quiet("_") |
| 45 |
hlf61 int //@ quiet("hlf61") |
| 46 |
} |
| 47 |
|
| 48 |
type hlt7 struct { //@ used("hlt7", true) |
| 49 |
// Fields are used recursively, as they affect the layout |
| 50 |
_ structs.HostLayout //@ used("_", true) |
| 51 |
hlf71 [2]hlt7sub //@ used("hlf71", true) |
| 52 |
} |
| 53 |
type hlt7sub struct { //@ used("hlt7sub", true) |
| 54 |
hlt7sub1 int //@ used("hlt7sub1", true) |
| 55 |
} |
| 56 |
|
| 57 |
var _ hlt1 //@ used("_", true) |
| 58 |
var _ hlt2 //@ used("_", true) |
| 59 |
var _ hlt3 //@ used("_", true) |
| 60 |
var _ hlt4 //@ used("_", true) |
| 61 |
var _ hlt5 //@ used("_", true) |
| 62 |
var _ hlt7 //@ used("_", true) |