test: add new test that gofrontend failed to handle

The gofrontend code would in some circumstances incorrectly generate a
type descriptor for an alias type, causing the type to fail to be
equal to the unaliased type.

Change-Id: I47d33b0bfde3c72a9a186049539732bdd5a6a96e
Reviewed-on: https://go-review.googlesource.com/c/go/+/275632
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Ian Lance Taylor 2020-12-05 08:08:47 -08:00
parent 7f9a2bc2bc
commit 9c0e2db051
3 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,13 @@
// Copyright 2020 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
import "reflect"
type A = map[int] bool
func F() interface{} {
return reflect.New(reflect.TypeOf((*A)(nil))).Elem().Interface()
}

View file

@ -0,0 +1,14 @@
// Copyright 2020 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"
func main() {
_, ok := a.F().(*map[int]bool)
if !ok {
panic("bad type")
}
}

9
test/fixedbugs/bug510.go Normal file
View file

@ -0,0 +1,9 @@
// rundir
// Copyright 2020 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.
// Gccgo confused type descriptors for aliases.
package ignored