1 // Copyright 2011 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import "./lib" 8 9 type I interface { 10 M() 11 } 12 13 type PI interface { 14 PM() 15 } 16 17 func main() { 18 var t lib.T 19 t.M() 20 t.PM() 21 22 // This is still an error. 23 // var i1 I = t 24 // i1.M() 25 26 // This combination is illegal because 27 // PM requires a pointer receiver. 28 // var pi1 PI = t 29 // pi1.PM() 30 31 var pt = &t 32 pt.M() 33 pt.PM() 34 35 var i2 I = pt 36 i2.M() 37 38 var pi2 PI = pt 39 pi2.PM() 40 } 41