compiler: allow to call methods on return values
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
aa338b7960
commit
e1a581be0e
5 changed files with 50 additions and 4 deletions
16
pkg/compiler/testdata/method/struct.go
vendored
Normal file
16
pkg/compiler/testdata/method/struct.go
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
package method
|
||||
|
||||
// X is some type.
|
||||
type X struct {
|
||||
a int
|
||||
}
|
||||
|
||||
// GetA returns the value of a.
|
||||
func (x X) GetA() int {
|
||||
return x.a
|
||||
}
|
||||
|
||||
// NewX creates a new X instance.
|
||||
func NewX() X {
|
||||
return X{a: 42}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue