Skip to content

Commit c2bd9ee

Browse files
committed
cmd/compile: only sort methods/interfaces during export for -d=unifiedquirks
These sorts are only important for 'toolstash -cmp' testing of unified IR against -G=0 mode, but they were added before I added -d=unifiedquirks to allow altering small "don't care" output details like this. This CL should help mitigate issues with #44195 until package objectpath is updated and deployed. Change-Id: Ia3dcf359481ff7abad5ddfca8e673fd2bb30ae01 Reviewed-on: https://go-review.googlesource.com/c/go/+/343390 Trust: Matthew Dempsky <[email protected]> Run-TryBot: Matthew Dempsky <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Robert Griesemer <[email protected]>
1 parent 8f0578e commit c2bd9ee

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/cmd/compile/internal/typecheck/iexport.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,9 @@ func (p *iexporter) doDecl(n *ir.Name) {
578578

579579
// Sort methods, for consistency with types2.
580580
methods := append([]*types.Field(nil), t.Methods().Slice()...)
581-
sort.Sort(types.MethodsByName(methods))
581+
if base.Debug.UnifiedQuirks != 0 {
582+
sort.Sort(types.MethodsByName(methods))
583+
}
582584

583585
w.uint64(uint64(len(methods)))
584586
for _, m := range methods {
@@ -978,8 +980,10 @@ func (w *exportWriter) doTyp(t *types.Type) {
978980
// Sort methods and embedded types, for consistency with types2.
979981
// Note: embedded types may be anonymous, and types2 sorts them
980982
// with sort.Stable too.
981-
sort.Sort(types.MethodsByName(methods))
982-
sort.Stable(types.EmbeddedsByName(embeddeds))
983+
if base.Debug.UnifiedQuirks != 0 {
984+
sort.Sort(types.MethodsByName(methods))
985+
sort.Stable(types.EmbeddedsByName(embeddeds))
986+
}
983987

984988
w.startType(interfaceType)
985989
w.setPkg(t.Pkg(), true)

0 commit comments

Comments
 (0)