mirror of
				https://github.com/golang/go.git
				synced 2025-10-31 16:50:58 +00:00 
			
		
		
		
	 bc5620c2e0
			
		
	
	
		bc5620c2e0
		
	
	
	
	
		
			
			bug117.go:13:12: error: reference to undefined field or method import1.go:9:2: error: redefinition of '.main.bufio' import1.go:8:2: note: previous definition of '.main.bufio' was here import1.go:9:2: error: incompatible imported type 'bufio.Error' interface9.go:25:5: error: incompatible types in assignment (method P requires a pointer) interface9.go:30:5: error: incompatible types in assignment (method P requires a pointer) R=rsc DELTA=5 (0 added, 0 deleted, 5 changed) OCL=29044 CL=29055
		
			
				
	
	
		
			43 lines
		
	
	
	
		
			655 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
	
		
			655 B
		
	
	
	
		
			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.
 | |
| 
 | |
| // errchk $G $F.go
 | |
| 
 | |
| // Error messages about missing implicit methods.
 | |
| 
 | |
| package main
 | |
| 
 | |
| type T int
 | |
| func (t T) V()
 | |
| func (t *T) P()
 | |
| 
 | |
| type V interface { V() }
 | |
| type P interface { P(); V() }
 | |
| 
 | |
| type S struct { T; }
 | |
| type SP struct { *T; }
 | |
| 
 | |
| func main() {
 | |
| 	var t T;
 | |
| 	var v V;
 | |
| 	var p P;
 | |
| 	var s S;
 | |
| 	var sp SP;
 | |
| 
 | |
| 	v = t;
 | |
| 	p = t;	// ERROR "is not|requires a pointer"
 | |
| 	v = &t;
 | |
| 	p = &t;
 | |
| 
 | |
| 	v = s;
 | |
| 	p = s;	// ERROR "is not|requires a pointer"
 | |
| 	v = &s;
 | |
| 	p = &s;
 | |
| 
 | |
| 	v = sp;
 | |
| 	p = sp;	// no error!
 | |
| 	v = &sp;
 | |
| 	p = &sp;
 | |
| }
 | |
| 
 |