1
0
mirror of https://github.com/golang/go synced 2024-11-22 15:54:52 -07:00

cmd/compile: remove special-casing of blank in types.sconv{,2}

I'm not sure why blank was special-cased here before, but it's
wrong. Blank is a non-exported identifier, and writing it out without
package-qualification can result in linker symbol collisions.

Fixes #47087.

Change-Id: Ie600037c8e54e3d4fdaeec21e2ca212badbd830b
Reviewed-on: https://go-review.googlesource.com/c/go/+/333163
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Matthew Dempsky 2021-07-07 13:18:42 -07:00
parent b003a8b1ae
commit 5c59e11f5e
5 changed files with 44 additions and 8 deletions

View File

@ -109,10 +109,6 @@ func sconv(s *Sym, verb rune, mode fmtMode) string {
return "<S>"
}
if s.Name == "_" {
return "_"
}
q := pkgqual(s.Pkg, verb, mode)
if q == "" {
return s.Name
@ -136,10 +132,6 @@ func sconv2(b *bytes.Buffer, s *Sym, verb rune, mode fmtMode) {
b.WriteString("<S>")
return
}
if s.Name == "_" {
b.WriteString("_")
return
}
symfmt(b, s, verb, mode)
}

View File

@ -0,0 +1,9 @@
// Copyright 2021 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.
package a
func F() interface{} { return struct{ _ []int }{} }
var X = F()

View File

@ -0,0 +1,9 @@
// Copyright 2021 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.
package b
func F() interface{} { return struct{ _ []int }{} }
var X = F()

View File

@ -0,0 +1,19 @@
// Copyright 2021 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.
package main
import (
"a"
"b"
)
func main() {
if a.F() == b.F() {
panic("FAIL")
}
if a.X == b.X {
panic("FAIL")
}
}

View File

@ -0,0 +1,7 @@
// rundir
// Copyright 2021 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.
package ignored