Commit feaa9ed1 authored by Luuk van Dijk's avatar Luuk van Dijk

gc: export nil literals without inferred type.

Fixes #2678

R=rsc
CC=golang-dev
https://golang.org/cl/5529066
parent b8f76764
......@@ -1072,9 +1072,11 @@ exprfmt(Fmt *f, Node *n, int prec)
case OREGISTER:
return fmtprint(f, "%R", n->val.u.reg);
case OLITERAL: // this is still a bit of a mess
case OLITERAL: // this is a bit of a mess
if(fmtmode == FErr && n->sym != S)
return fmtprint(f, "%S", n->sym);
if(n->val.ctype == CTNIL)
n = n->orig; // if this node was a nil decorated with at type, print the original naked nil
if(n->type != types[n->type->etype] && n->type != idealbool && n->type != idealstring) {
if(isptr[n->type->etype])
return fmtprint(f, "(%T)(%V)", n->type, &n->val);
......
package one
type file int
func (file *file) isnil() bool { return file == nil }
func (fil *file) isnil2() bool { return fil == nil }
package two
import _ "./one"
// $G $D/$F.dir/one.go && $G -ll $D/$F.dir/two.go
// Copyright 2011 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.
//
// Issue 2678
// -ll flag in command above is to force typecheck on import, needed to trigger the bug.
// fixedbugs/bug392.dir/two.go:3: cannot call non-function *one.file (type one.file)
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