fix: correct assign from function returning an interface value (#625)

This commit is contained in:
Marc Vertes
2020-05-05 13:54:36 +02:00
committed by GitHub
parent 7eac6955b3
commit 7fab75fbe4
2 changed files with 24 additions and 1 deletions

23
_test/interface37.go Normal file
View File

@@ -0,0 +1,23 @@
package main
type I interface {
A() string
B() string
}
type s struct{}
func NewS() (I, error) {
return &s{}, nil
}
func (c *s) A() string { return "a" }
func (c *s) B() string { return "b" }
func main() {
s, _ := NewS()
println(s.A())
}
// Output:
// a