Commit 761830f4 authored by Russ Cox's avatar Russ Cox

cmd/gc: fix export of inlined function body with type guard

When exporting a body containing
        x, ok := v.(Type)

the definition for Type was not being included, so when the body
was actually used, it would cause an "unknown type" compiler error.

Fixes #4370.

R=ken2
CC=golang-dev
https://golang.org/cl/6827064
parent 5451708d
......@@ -152,6 +152,7 @@ reexportdep(Node *n)
case OCONVIFACE:
case OCONVNOP:
case ODOTTYPE:
case ODOTTYPE2:
case OSTRUCTLIT:
case OPTRLIT:
t = n->type;
......
// Copyright 2012 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 p1
type Magic int
type T struct {
x interface{}
}
func (t *T) M() bool {
_, ok := t.x.(Magic)
return ok
}
func F(t *T) {
println(t)
}
// Copyright 2012 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 p2
import "./p1"
type T struct {
p1.T
}
func F() {
var t T
p1.F(&t.T)
}
// Copyright 2012 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 p3
import "./p2"
func F() {
p2.F()
var t p2.T
println(t.T.M())
}
// compiledir
// Copyright 2012 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.
// Re-exporting inlined function bodies missed types in x, ok := v.(Type)
package ignored
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