mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
compiler: make struct types more unique
There are a lot more fields that are important when comparing structs with each other. Take them into account when building the unique ID per struct type. Example code that differs between the compilers: https://play.golang.org/p/nDX4tSHOf_T
This commit is contained in:
committed by
Ron Evans
parent
9979cf2bbd
commit
f43d01bdc7
Vendored
+12
@@ -11,6 +11,10 @@ func main() {
|
||||
printItf(*thing)
|
||||
printItf(thing)
|
||||
printItf(Stringer(thing))
|
||||
printItf(struct{ n int }{})
|
||||
printItf(struct {
|
||||
n int `foo:"bar"`
|
||||
}{})
|
||||
printItf(Number(3))
|
||||
array := Array([4]uint32{1, 7, 11, 13})
|
||||
printItf(array)
|
||||
@@ -47,6 +51,14 @@ func printItf(val interface{}) {
|
||||
println("is Thing:", val.String())
|
||||
case *Thing:
|
||||
println("is *Thing:", val.String())
|
||||
case struct{ i int }:
|
||||
println("is struct{i int}")
|
||||
case struct{ n int }:
|
||||
println("is struct{n int}")
|
||||
case struct {
|
||||
n int `foo:"bar"`
|
||||
}:
|
||||
println("is struct{n int `foo:\"bar\"`}")
|
||||
case Foo:
|
||||
println("is Foo:", val)
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user