3 // Copyright 2010 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 // derived from fixedbugs/bug294.go
15 func (t TT) a(s string) TT {
20 func (TT) b(s string) string {
25 type F func(s string) F
32 func b(s string) string {
44 func (t T1) a(s string) I {
49 func (T1) b(s string) string {
54 // f(g(), h()) where g is not inlinable but h is will have the same problem.
55 // As will x := g() + h() (same conditions).
58 log += "f(" + x + ", " + y + ")"
61 func ff(x, y string) {
64 log += "ff(" + x + ", " + y + ")"
67 func h(x string) string {
72 func g(x string) string {
82 if a("1")("2")("3"); log != "a(1)a(2)a(3)" {
83 println("expecting a(1)a(2)a(3) , got ", log)
88 if t.a("1").a(t.b("2")); log != "a(1)b(2)a(2)" {
89 println("expecting a(1)b(2)a(2), got ", log)
93 if a("3")(b("4"))(b("5")); log != "a(3)b(4)a(4)b(5)a(5)" {
94 println("expecting a(3)b(4)a(4)b(5)a(5), got ", log)
99 if i.a("6").a(i.b("7")).a(i.b("8")).a(i.b("9")); log != "a(6)b(7)a(7)b(8)a(8)b(9)a(9)" {
100 println("expecting a(6)ba(7)ba(8)ba(9), got", log)
105 if s := t.a("1").b("3"); log != "a(1)b(3)" || s != "3" {
106 println("expecting a(1)b(3) and 3, got ", log, " and ", s)
111 if s := t.a("1").a(t.b("2")).b("3") + t.a("4").b("5"); log != "a(1)b(2)a(2)b(3)a(4)b(5)" || s != "35" {
112 println("expecting a(1)b(2)a(2)b(3)a(4)b(5) and 35, got ", log, " and ", s)
117 if s := t.a("4").b("5") + t.a("1").a(t.b("2")).b("3"); log != "a(4)b(5)a(1)b(2)a(2)b(3)" || s != "53" {
118 println("expecting a(4)b(5)a(1)b(2)a(2)b(3) and 35, got ", log, " and ", s)
123 if ff(g("1"), g("2")); log != "g(1)g(2)ff(1, 2)" {
124 println("expecting g(1)g(2)ff..., got ", log)
129 if ff(g("1"), h("2")); log != "g(1)h(2)ff(1, 2)" {
130 println("expecting g(1)h(2)ff..., got ", log)
135 if ff(h("1"), g("2")); log != "h(1)g(2)ff(1, 2)" {
136 println("expecting h(1)g(2)ff..., got ", log)
141 if ff(h("1"), h("2")); log != "h(1)h(2)ff(1, 2)" {
142 println("expecting h(1)h(2)ff..., got ", log)
147 if s := g("1") + g("2"); log != "g(1)g(2)" || s != "12" {
148 println("expecting g1g2 and 12, got ", log, " and ", s)
153 if s := g("1") + h("2"); log != "g(1)h(2)" || s != "12" {
154 println("expecting g1h2 and 12, got ", log, " and ", s)
159 if s := h("1") + g("2"); log != "h(1)g(2)" || s != "12" {
160 println("expecting h1g2 and 12, got ", log, " and ", s)
165 if s := h("1") + h("2"); log != "h(1)h(2)" || s != "12" {
166 println("expecting h1h2 and 12, got ", log, " and ", s)