Skip to content

Commit 769824f

Browse files
committed
ssa: don't crash in conversions that ignore struct tags
Closes gh-77
1 parent 89939fe commit 769824f

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

ssa/emit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func emitCompare(f *Function, op token.Token, x, y Value, pos token.Pos) Value {
149149
//
150150
func isValuePreserving(ut_src, ut_dst types.Type) bool {
151151
// Identical underlying types?
152-
if types.Identical(ut_dst, ut_src) {
152+
if structTypesIdentical(ut_dst, ut_src) {
153153
return true
154154
}
155155

ssa/identical.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// +build go1.8
2+
3+
package ssa
4+
5+
import "go/types"
6+
7+
var structTypesIdentical = types.IdenticalIgnoreTags

ssa/identical_17.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// +build !go1.8
2+
3+
package ssa
4+
5+
import "go/types"
6+
7+
var structTypesIdentical = types.Identical

0 commit comments

Comments
 (0)