fix: apply method receiver offset when generating interface wrapper
Fixes #772.
This commit is contained in:
31
_test/issue-772.go
Normal file
31
_test/issue-772.go
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"text/template"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Message struct {
|
||||||
|
Data string
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
tmpl := template.New("name")
|
||||||
|
|
||||||
|
_, err := tmpl.Parse("{{.Data}}")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = tmpl.Execute(os.Stdout, Message{
|
||||||
|
Data: "Hello, World!!",
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output:
|
||||||
|
// Hello, World!!
|
||||||
@@ -1080,7 +1080,7 @@ func callBin(n *node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, c := range child {
|
for i, c := range child {
|
||||||
defType := funcType.In(pindex(i, variadic))
|
defType := funcType.In(rcvrOffset + pindex(i, variadic))
|
||||||
switch {
|
switch {
|
||||||
case isBinCall(c):
|
case isBinCall(c):
|
||||||
// Handle nested function calls: pass returned values as arguments
|
// Handle nested function calls: pass returned values as arguments
|
||||||
|
|||||||
Reference in New Issue
Block a user