1
0
mirror of https://github.com/golang/go synced 2024-11-25 11:57:58 -07:00

fix erroneous code in bugs; reported by iant.

also rob1.go runs, so fix its status.

R=gri,iant
OCL=13957
CL=13957
This commit is contained in:
Rob Pike 2008-08-07 13:27:58 -07:00
parent 882ac63885
commit 69353f0a50
4 changed files with 10 additions and 8 deletions

View File

@ -6,7 +6,7 @@
package main package main
func frexp() (int, double) { func frexp() (a int, b double) {
return 1, 2.0 return 1, 2.0
} }

View File

@ -81,6 +81,7 @@ Hello World!
=========== ken/ptrvar.go =========== ken/ptrvar.go
=========== ken/rob1.go =========== ken/rob1.go
9876543210
=========== ken/rob2.go =========== ken/rob2.go
(defn foo (add 12 34)) (defn foo (add 12 34))

View File

@ -8,7 +8,7 @@ package main
type Item interface type Item interface
{ {
Print_BUG func(); Print();
} }
type ListItem struct type ListItem struct
@ -42,7 +42,7 @@ Print()
{ {
i := list.head; i := list.head;
for i != nil { for i != nil {
i.item.Print_BUG(); i.item.Print();
i = i.next; i = i.next;
} }
} }
@ -54,14 +54,14 @@ type Integer struct
} }
func (this *Integer) func (this *Integer)
Init_BUG(i int) *Integer Init(i int) *Integer
{ {
this.val = i; this.val = i;
return this; return this;
} }
func (this *Integer) func (this *Integer)
Print_BUG() Print()
{ {
print this.val; print this.val;
} }
@ -73,9 +73,10 @@ main()
list.Init(); list.Init();
for i := 0; i < 10; i = i + 1 { for i := 0; i < 10; i = i + 1 {
integer := new(Integer); integer := new(Integer);
integer.Init_BUG(i); integer.Init(i);
list.Insert(integer); //BUG: this is the failing line list.Insert(integer);
} }
list.Print(); list.Print();
print "\n";
} }

View File

@ -35,7 +35,7 @@ func f6(a int) (r int) {
return 6; return 6;
} }
func f7(a int) (int, float) { func f7(a int) (x int, y float) {
return 7, 7.0; return 7, 7.0;
} }