text/template: type-check chained node as argument
Was just a missing case (literally) in the type checker.
Fixes #8473.
LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/142460043
diff --git a/src/text/template/exec_test.go b/src/text/template/exec_test.go
index 3bffcc1..e2cf2d3 100644
--- a/src/text/template/exec_test.go
+++ b/src/text/template/exec_test.go
@@ -176,6 +176,12 @@
return fmt.Sprintf("Method3: %v", v)
}
+func (t *T) Copy() *T {
+ n := new(T)
+ *n = *t
+ return n
+}
+
func (t *T) MAdd(a int, b []int) []int {
v := make([]int, len(b))
for i, x := range b {
@@ -519,6 +525,8 @@
{"bug12xE", "{{printf `%T` 0xEE}}", "int", T{}, true},
{"bug12Xe", "{{printf `%T` 0Xef}}", "int", T{}, true},
{"bug12XE", "{{printf `%T` 0XEE}}", "int", T{}, true},
+ // Chained nodes did not work as arguments. Issue 8473.
+ {"bug13", "{{print (.Copy).I}}", "17", tVal, true},
}
func zeroArgs() string {