diff options
author | Russ Cox <rsc@golang.org> | 2009-08-03 11:58:52 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-08-03 11:58:52 -0700 |
commit | 7d972b8ae744caddba5c8ef163b95b612b8f643d (patch) | |
tree | 0802e78710de882ee76b248ff780b4385b36c1a5 /test | |
parent | 4c103008001b549fbc78824f40f4636a4fa53b33 (diff) | |
download | go-7d972b8ae744caddba5c8ef163b95b612b8f643d.tar.gz |
more 6g reorg; checkpoint.
typecheck.c is now responsible for all type checking
except for assignment and function argument "..."
R=ken
OCL=32661
CL=32667
Diffstat (limited to 'test')
-rw-r--r-- | test/chan/perm.go | 8 | ||||
-rw-r--r-- | test/const1.go | 16 | ||||
-rw-r--r-- | test/convert3.go | 2 | ||||
-rw-r--r-- | test/convlit.go | 10 | ||||
-rw-r--r-- | test/convlit1.go | 4 | ||||
-rw-r--r-- | test/fixedbugs/bug022.go | 2 | ||||
-rw-r--r-- | test/fixedbugs/bug062.go | 2 | ||||
-rw-r--r-- | test/fixedbugs/bug090.go | 4 | ||||
-rw-r--r-- | test/fixedbugs/bug121.go | 12 | ||||
-rw-r--r-- | test/fixedbugs/bug131.go | 2 | ||||
-rw-r--r-- | test/fixedbugs/bug146.go | 2 | ||||
-rw-r--r-- | test/fixedbugs/bug170.go | 7 | ||||
-rw-r--r-- | test/func4.go | 4 | ||||
-rw-r--r-- | test/golden.out | 7 | ||||
-rw-r--r-- | test/interface/pointer.go | 2 |
15 files changed, 34 insertions, 50 deletions
diff --git a/test/chan/perm.go b/test/chan/perm.go index cdbef6246..b19cbf326 100644 --- a/test/chan/perm.go +++ b/test/chan/perm.go @@ -15,10 +15,10 @@ var ( func main() { cr = c; // ok cs = c; // ok - c = cr; // ERROR "illegal types|incompatible" - c = cs; // ERROR "illegal types|incompatible" - cr = cs; // ERROR "illegal types|incompatible" - cs = cr; // ERROR "illegal types|incompatible" + c = cr; // ERROR "illegal types|incompatible|cannot" + c = cs; // ERROR "illegal types|incompatible|cannot" + cr = cs; // ERROR "illegal types|incompatible|cannot" + cs = cr; // ERROR "illegal types|incompatible|cannot" c <- 0; // ok ok := c <- 0; // ok diff --git a/test/const1.go b/test/const1.go index 0d48ada5e..622b837a5 100644 --- a/test/const1.go +++ b/test/const1.go @@ -65,15 +65,15 @@ var ( func f(int); func main() { - f(Int8); // ERROR "convert|wrong type" - f(Minus1); // ERROR "convert|wrong type" - f(Uint8); // ERROR "convert|wrong type" + f(Int8); // ERROR "convert|wrong type|cannot" + f(Minus1); // ERROR "convert|wrong type|cannot" + f(Uint8); // ERROR "convert|wrong type|cannot" f(Const); // OK - f(Float32); // ERROR "convert|wrong type" - f(Float); // ERROR "convert|wrong type" + f(Float32); // ERROR "convert|wrong type|cannot" + f(Float); // ERROR "convert|wrong type|cannot" f(ConstFloat); // ERROR "truncate" f(ConstFloat - 0.5); // OK - f(Big); // ERROR "convert|wrong type" - f(String); // ERROR "convert|wrong type" - f(Bool); // ERROR "convert|wrong type" + f(Big); // ERROR "convert|wrong type|cannot" + f(String); // ERROR "convert|wrong type|cannot" + f(Bool); // ERROR "convert|wrong type|cannot" } diff --git a/test/convert3.go b/test/convert3.go index d733ce2c3..cb0500012 100644 --- a/test/convert3.go +++ b/test/convert3.go @@ -21,5 +21,5 @@ var g = []int(nil) type H *[4]int type J []int var h H -var j1 J = h // ERROR "compat|illegal" +var j1 J = h // ERROR "compat|illegal|cannot|cannot" var j2 = J(h) diff --git a/test/convlit.go b/test/convlit.go index be12e6383..e65dad3df 100644 --- a/test/convlit.go +++ b/test/convlit.go @@ -19,11 +19,11 @@ var x7 = float(1e1000); // ERROR "overflow" // implicit conversions merit scrutiny var s string; -var bad1 string = 1; // ERROR "conver|incompatible" -var bad2 = s + 1; // ERROR "conver|incompatible" -var bad3 = s + 'a'; // ERROR "conver|incompatible" -var bad4 = "a" + 1; // ERROR "literals|incompatible|convert" -var bad5 = "a" + 'a'; // ERROR "literals|incompatible|convert" +var bad1 string = 1; // ERROR "conver|incompatible|invalid|cannot" +var bad2 = s + 1; // ERROR "conver|incompatible|invalid" +var bad3 = s + 'a'; // ERROR "conver|incompatible|invalid" +var bad4 = "a" + 1; // ERROR "literals|incompatible|convert|invalid" +var bad5 = "a" + 'a'; // ERROR "literals|incompatible|convert|invalid" var bad6 int = 1.5; // ERROR "convert|truncate" var bad7 int = 1e100; // ERROR "overflow" diff --git a/test/convlit1.go b/test/convlit1.go index 94d28969b..1e6673cb6 100644 --- a/test/convlit1.go +++ b/test/convlit1.go @@ -6,12 +6,12 @@ package main -var a = []int { "a" }; // ERROR "conver|incompatible" +var a = []int { "a" }; // ERROR "conver|incompatible|cannot" var b = int { 1 }; // ERROR "compos" func f() int func main() { - if f < 1 { } // ERROR "conver|incompatible" + if f < 1 { } // ERROR "conver|incompatible|invalid" } diff --git a/test/fixedbugs/bug022.go b/test/fixedbugs/bug022.go index 796414870..0250135a5 100644 --- a/test/fixedbugs/bug022.go +++ b/test/fixedbugs/bug022.go @@ -9,7 +9,7 @@ package main func putint(digits *string) { var i byte; i = (*digits)[7]; // compiles - i = digits[7]; // ERROR "illegal|is not" + i = digits[7]; // ERROR "illegal|is not|invalid" } func main() { diff --git a/test/fixedbugs/bug062.go b/test/fixedbugs/bug062.go index 8a9ba959e..4346c5a5f 100644 --- a/test/fixedbugs/bug062.go +++ b/test/fixedbugs/bug062.go @@ -7,5 +7,5 @@ package main func main() { - var s string = nil; // ERROR "illegal|invalid" + var s string = nil; // ERROR "illegal|invalid|cannot" } diff --git a/test/fixedbugs/bug090.go b/test/fixedbugs/bug090.go index 50e08b7f5..8318ab9c0 100644 --- a/test/fixedbugs/bug090.go +++ b/test/fixedbugs/bug090.go @@ -38,9 +38,9 @@ func main() { assert(i != f3div2, "i != f3div2"); // ERROR "truncate" const g float64 = 1.0; - i = g; // ERROR "convert|incompatible" + i = g; // ERROR "convert|incompatible|cannot" const h float64 = 3.14; - i = h; // ERROR "convert|incompatible" + i = h; // ERROR "convert|incompatible|cannot" i = int(h); // ERROR "truncate" } diff --git a/test/fixedbugs/bug121.go b/test/fixedbugs/bug121.go index 5840095b9..6473fa995 100644 --- a/test/fixedbugs/bug121.go +++ b/test/fixedbugs/bug121.go @@ -10,16 +10,6 @@ type T func() type I interface { f, g (); - h T; // should only allow FunctionType here + h T; // ERROR "syntax" } -type S struct { -} - -func (s *S) f() {} -func (s *S) g() {} -func (s *S) h() {} // here we can't write (s *S) T either - -func main() { - var i I = new(S); -} diff --git a/test/fixedbugs/bug131.go b/test/fixedbugs/bug131.go index 376f528f6..c2644c4a3 100644 --- a/test/fixedbugs/bug131.go +++ b/test/fixedbugs/bug131.go @@ -8,5 +8,5 @@ package main func main() { const a uint64 = 10; - var b int64 = a; // ERROR "convert" + var b int64 = a; // ERROR "convert|cannot" } diff --git a/test/fixedbugs/bug146.go b/test/fixedbugs/bug146.go index aef847645..41a6d3afd 100644 --- a/test/fixedbugs/bug146.go +++ b/test/fixedbugs/bug146.go @@ -10,5 +10,5 @@ func main() { type Slice []byte; a := [...]byte{ 0 }; b := Slice(&a); // This should be OK. - c := Slice(a); // ERROR "invalid|illegal" + c := Slice(a); // ERROR "invalid|illegal|cannot" } diff --git a/test/fixedbugs/bug170.go b/test/fixedbugs/bug170.go index b04e77187..e7f1c5120 100644 --- a/test/fixedbugs/bug170.go +++ b/test/fixedbugs/bug170.go @@ -5,9 +5,10 @@ // license that can be found in the LICENSE file. package main -var v1 = ([10]int)(nil) // ERROR "illegal|nil|invalid" -var v2 [10]int = nil // ERROR "illegal|nil|incompatible" -var v3 [10]int +var v1 = ([10]int)(nil); // ERROR "illegal|nil|invalid" +var v2 [10]int = nil; // ERROR "illegal|nil|incompatible" +var v3 [10]int; +var v4 = nil; // ERROR "nil" func main() { v3 = nil; // ERROR "illegal|nil|incompatible" } diff --git a/test/func4.go b/test/func4.go index f9e394fdf..bcf5b93fa 100644 --- a/test/func4.go +++ b/test/func4.go @@ -9,6 +9,6 @@ package main var notmain func() func main() { - var x = &main; // ERROR "address of function|invalid" - main = notmain; // ERROR "assign to function|invalid" + var x = &main; // ERROR "address of|invalid" + main = notmain; // ERROR "assign to|invalid" } diff --git a/test/golden.out b/test/golden.out index ca01bd2a6..d1403736b 100644 --- a/test/golden.out +++ b/test/golden.out @@ -132,13 +132,6 @@ throw: interface conversion panic PC=xxx -=========== fixedbugs/bug121.go -fixedbugs/bug121.go:9: syntax error near T -fixedbugs/bug121.go:20: incomplete type I -fixedbugs/bug121.go:20: illegal types for operand: AS - I - *S - =========== fixedbugs/bug148.go 2 3 interface is main.T, not main.T·bug148·1 diff --git a/test/interface/pointer.go b/test/interface/pointer.go index 202c37d86..d94ec7cad 100644 --- a/test/interface/pointer.go +++ b/test/interface/pointer.go @@ -32,6 +32,6 @@ func AddInst(Inst) *Inst { func main() { re := new(Regexp); print("call addinst\n"); - var x Inst = AddInst(new(Start)); // ERROR "illegal|incompatible" + var x Inst = AddInst(new(Start)); // ERROR "illegal|incompatible|is not" print("return from addinst\n"); } |