diff options
author | Russ Cox <rsc@golang.org> | 2011-06-27 18:44:30 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-06-27 18:44:30 -0400 |
commit | a91d72e11ab29722db257bbe51a9d35cd44a28a7 (patch) | |
tree | e1f680d4b8f5241fbcb0bdc63a94cb2a25b305d4 /test | |
parent | 6fdaeb7a539e54d0cfe66268c6b0b4ca499da553 (diff) | |
download | go-a91d72e11ab29722db257bbe51a9d35cd44a28a7.tar.gz |
gc: avoid package name ambiguity in error messages
Fixes issue 2006.
R=ken2
CC=golang-dev
http://codereview.appspot.com/4643056
Diffstat (limited to 'test')
-rw-r--r-- | test/fixedbugs/bug345.dir/io.go | 15 | ||||
-rw-r--r-- | test/fixedbugs/bug345.dir/main.go | 28 | ||||
-rw-r--r-- | test/fixedbugs/bug345.go | 7 |
3 files changed, 50 insertions, 0 deletions
diff --git a/test/fixedbugs/bug345.dir/io.go b/test/fixedbugs/bug345.dir/io.go new file mode 100644 index 000000000..1d695c304 --- /dev/null +++ b/test/fixedbugs/bug345.dir/io.go @@ -0,0 +1,15 @@ +// 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. + +package io + +type Writer interface { + WrongWrite() +} + +type SectionReader struct { + X int +} + +func SR(*SectionReader) {} diff --git a/test/fixedbugs/bug345.dir/main.go b/test/fixedbugs/bug345.dir/main.go new file mode 100644 index 000000000..5bdc713f4 --- /dev/null +++ b/test/fixedbugs/bug345.dir/main.go @@ -0,0 +1,28 @@ +// 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. + +package main + +import ( + "bufio" + "./io" + goio "io" +) + +func main() { + // The errors here complain that io.X != io.X + // for different values of io so they should be + // showing the full import path, which for the + // "./io" import is really ..../go/test/io. + // For example: + // + // main.go:25: cannot use w (type "/Users/rsc/g/go/test/fixedbugs/bug345.dir/io".Writer) as type "io".Writer in function argument: + // io.Writer does not implement io.Writer (missing Write method) + // main.go:27: cannot use &x (type *"io".SectionReader) as type *"/Users/rsc/g/go/test/fixedbugs/bug345.dir/io".SectionReader in function argument + + var w io.Writer + bufio.NewWriter(w) // ERROR "test/io" + var x goio.SectionReader + io.SR(&x) // ERROR "test/io" +} diff --git a/test/fixedbugs/bug345.go b/test/fixedbugs/bug345.go new file mode 100644 index 000000000..874710ce8 --- /dev/null +++ b/test/fixedbugs/bug345.go @@ -0,0 +1,7 @@ +// $G $D/$F.dir/io.go && errchk $G -e $D/$F.dir/main.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. + +package ignored |