Fix powser1.go to compile with the current 6g, which doesn't

recognize methods for a variable whose type is a named type
which is a pointer type.  Add bug117 to test this case.

R=r
DELTA=24  (22 added, 0 deleted, 2 changed)
OCL=18547
CL=18554
This commit is contained in:
Ian Lance Taylor 2008-11-05 12:06:48 -08:00
Родитель 1983121bbb
Коммит 7fe34ea002
3 изменённых файлов: 29 добавлений и 2 удалений

21
test/bugs/bug117.go Normal file
Просмотреть файл

@ -0,0 +1,21 @@
// errchk $G $D/$F.go
// Copyright 2009 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
type S struct { a int }
type PS *S
func (p *S) get() int {
return p.a
}
func fn(p PS) int {
return p.get()
}
func main() {
s := S{1};
if s.get() != 1 {
panic()
}
}

Просмотреть файл

@ -116,7 +116,7 @@ func put(dat item, out *dch){
out.dat <- dat;
}
func get(in *dch) item{
func get(in *dch) *rat {
seqno++;
in.req <- seqno;
return <-in.dat;
@ -610,7 +610,7 @@ func Init() {
Twos = Rep(itor(2));
}
func check(U PS, c item, count int, str string) {
func check(U PS, c *rat, count int, str string) {
for i := 0; i < count; i++ {
r := get(U);
if !r.eq(c) {

Просмотреть файл

@ -144,6 +144,12 @@ BUG: errchk: command succeeded unexpectedly: 6g bugs/bug108.go
bugs/bug115.go:8: overflow converting constant to uint
BUG: bug115 should compile
=========== bugs/bug117.go
bugs/bug117.go:9: undefined DOT get on PS
bugs/bug117.go:10: illegal types for operand: RETURN
int
BUG: should compile
=========== fixedbugs/bug016.go
fixedbugs/bug016.go:7: overflow converting constant to uint