summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLuuk van Dijk <lvd@golang.org>2011-12-14 17:34:35 +0100
committerLuuk van Dijk <lvd@golang.org>2011-12-14 17:34:35 +0100
commitf5d5afc192844252a71b61adb24c7d113d4abadc (patch)
treea532924ada9c9f5660af0d4c862f17dba568c8eb /test
parentf3f1d1dfcfb4bbf10c52cd54dea058076c227269 (diff)
downloadgo-f5d5afc192844252a71b61adb24c7d113d4abadc.tar.gz
gc: use inferred type rather than original one when reporting non-assignability.
Fixes issue 2451 R=rsc, bradfitz CC=golang-dev http://codereview.appspot.com/5372105
Diffstat (limited to 'test')
-rw-r--r--test/ddd1.go2
-rw-r--r--test/fixedbugs/bug386.go12
-rw-r--r--test/named1.go2
3 files changed, 14 insertions, 2 deletions
diff --git a/test/ddd1.go b/test/ddd1.go
index 54ccc2340..6d84248e5 100644
--- a/test/ddd1.go
+++ b/test/ddd1.go
@@ -15,7 +15,7 @@ var (
_ = sum()
_ = sum(1.0, 2.0)
_ = sum(1.5) // ERROR "integer"
- _ = sum("hello") // ERROR ".hello. .type ideal string. as type int|incompatible"
+ _ = sum("hello") // ERROR ".hello. .type string. as type int|incompatible"
_ = sum([]int{1}) // ERROR "\[\]int literal.*as type int|incompatible"
)
diff --git a/test/fixedbugs/bug386.go b/test/fixedbugs/bug386.go
new file mode 100644
index 000000000..85b8d3082
--- /dev/null
+++ b/test/fixedbugs/bug386.go
@@ -0,0 +1,12 @@
+// errchk $G $D/$F.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 2451, 2452
+package foo
+
+func f() error { return 0 } // ERROR "cannot use 0 .type int."
+
+func g() error { return -1 } // ERROR "cannot use -1 .type int." \ No newline at end of file
diff --git a/test/named1.go b/test/named1.go
index 64e492886..499b77b96 100644
--- a/test/named1.go
+++ b/test/named1.go
@@ -37,7 +37,7 @@ func main() {
asBool(true)
asBool(*&b)
asBool(Bool(true))
- asBool(1 != 2) // ERROR "cannot use.*type ideal bool.*as type Bool"
+ asBool(1 != 2) // ERROR "cannot use.*type bool.*as type Bool"
asBool(i < j) // ERROR "cannot use.*type bool.*as type Bool"
_, b = m[2] // ERROR "cannot .* bool.*type Bool"