Skip to content

Commit

Permalink
fix #1197
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed May 19, 2022
1 parent 40b76b6 commit d64cb6a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cl/compile_test.go
Expand Up @@ -143,6 +143,19 @@ var x string = c.Str()
`)
}

func TestUnderscoreRedeclared_Issue1197(t *testing.T) {
gopClTest(t, `
func() (_ [2]int) { type _ int; return }()
`, `package main
func main() {
func() (_ [2]int) {
return
}()
}
`)
}

func TestInterfaceBugNilUnderlying_Issue1196(t *testing.T) {
gopClTest(t, `
func main() {
Expand Down
3 changes: 3 additions & 0 deletions cl/stmt.go
Expand Up @@ -728,6 +728,9 @@ func compileDeclStmt(ctx *blockCtx, expr *ast.DeclStmt) {

func compileType(ctx *blockCtx, t *ast.TypeSpec) {
name := t.Name.Name
if name == "_" {
return
}
if t.Assign != token.NoPos { // alias type
ctx.cb.AliasType(name, toType(ctx, t.Type))
} else {
Expand Down
1 change: 1 addition & 0 deletions cmd/goptestgo/goptestgo.go
Expand Up @@ -82,6 +82,7 @@ var (
"issue18149.go": {},
"issue22662.go": {},
"issue27201.go": {},
"issue46903.go": {},
"nilptr_aix.go": {},
"inline_literal.go": {},
"returntype.go": {}, // not a problem
Expand Down

0 comments on commit d64cb6a

Please sign in to comment.