Commit 9be4f312 authored by Robert Griesemer's avatar Robert Griesemer

cmd/compile: revert internal parameter rename (from ".anonX" to "") before export

In the old binary export format, parameter names for parameter lists
which contained only types where never written, so this problem didn't
come up.

Fixes #25101.

Change-Id: Ia8b817f7f467570b05f88d584e86b6ef4acdccc6
Reviewed-on: https://go-review.googlesource.com/116376Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
parent e7ee3b91
......@@ -778,15 +778,26 @@ func functypefield0(t *types.Type, this *types.Field, in, out []*types.Field) {
// origSym returns the original symbol written by the user.
func origSym(s *types.Sym) *types.Sym {
if s != nil && s.Name[0] == '~' {
if s == nil {
return nil
}
if len(s.Name) > 1 && s.Name[0] == '~' {
switch s.Name[1] {
case 'r': // originally an unnamed result
s = nil
return nil
case 'b': // originally the blank identifier _
// TODO(mdempsky): Does s.Pkg matter here?
s = nblank.Sym
return nblank.Sym
}
return s
}
if strings.HasPrefix(s.Name, ".anon") {
// originally an unnamed or _ name (see subr.go: structargs)
return nil
}
return s
}
......
// compile
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Indexed export format must not crash when writing
// the anonymous parameter for m.
package p
var x interface {
m(int)
}
var M = x.m
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment