]> Cypherpunks.ru repositories - gostls13.git/blobdiff - test/method7.go
cmd/compile/internal/inline: score call sites exposed by inlines
[gostls13.git] / test / method7.go
index 15e123e85fa71dac6a63e22c72986aafe2ea71d8..05accb3ee04d8869dfdaf8006c057d9cd232e7be 100644 (file)
@@ -25,6 +25,11 @@ type T int
 
 func (T) m2() { got += " m2()" }
 
+type Outer struct{ *Inner }
+type Inner struct{ s string }
+
+func (i Inner) M() string { return i.s }
+
 func main() {
        // method expressions with named receiver types
        I.m(S{})
@@ -52,4 +57,11 @@ func main() {
        if got != want {
                panic("got" + got + ", want" + want)
        }
+
+       h := (*Outer).M
+       got := h(&Outer{&Inner{"hello"}})
+       want := "hello"
+       if got != want {
+               panic("got " + got + ", want " + want)
+       }
 }