| 1 |
Tests of various n-ary result function cases. |
| 2 |
|
| 3 |
-- go.mod -- |
| 4 |
module testdata |
| 5 |
go 1.12 |
| 6 |
|
| 7 |
-- a/a.go -- |
| 8 |
package a |
| 9 |
|
| 10 |
func _() { |
| 11 |
println(f1()) //@ inline(re"f1", f1) |
| 12 |
} |
| 13 |
|
| 14 |
func f1() (int, int) { return 1, 1 } |
| 15 |
|
| 16 |
-- f1 -- |
| 17 |
package a |
| 18 |
|
| 19 |
func _() { |
| 20 |
println(1, 1) //@ inline(re"f1", f1) |
| 21 |
} |
| 22 |
|
| 23 |
func f1() (int, int) { return 1, 1 } |
| 24 |
|
| 25 |
-- b/b.go -- |
| 26 |
package b |
| 27 |
|
| 28 |
func _() { |
| 29 |
f2() //@ inline(re"f2", f2) |
| 30 |
} |
| 31 |
|
| 32 |
func f2() (int, int) { return 2, 2 } |
| 33 |
|
| 34 |
-- f2 -- |
| 35 |
package b |
| 36 |
|
| 37 |
func _() { |
| 38 |
_, _ = 2, 2 //@ inline(re"f2", f2) |
| 39 |
} |
| 40 |
|
| 41 |
func f2() (int, int) { return 2, 2 } |
| 42 |
|
| 43 |
-- c/c.go -- |
| 44 |
package c |
| 45 |
|
| 46 |
func _() { |
| 47 |
_, _ = f3() //@ inline(re"f3", f3) |
| 48 |
} |
| 49 |
|
| 50 |
func f3() (int, int) { return f3A() } |
| 51 |
func f3A() (x, y int) |
| 52 |
|
| 53 |
-- f3 -- |
| 54 |
package c |
| 55 |
|
| 56 |
func _() { |
| 57 |
_, _ = f3A() //@ inline(re"f3", f3) |
| 58 |
} |
| 59 |
|
| 60 |
func f3() (int, int) { return f3A() } |
| 61 |
func f3A() (x, y int) |
| 62 |
|
| 63 |
-- d/d.go -- |
| 64 |
package d |
| 65 |
|
| 66 |
func _() { |
| 67 |
println(-f4()) //@ inline(re"f4", f4) |
| 68 |
} |
| 69 |
|
| 70 |
func f4() int { return 2 + 2 } |
| 71 |
|
| 72 |
-- f4 -- |
| 73 |
package d |
| 74 |
|
| 75 |
func _() { |
| 76 |
println(-(2 + 2)) //@ inline(re"f4", f4) |
| 77 |
} |
| 78 |
|
| 79 |
func f4() int { return 2 + 2 } |
| 80 |
-- e/e.go -- |
| 81 |
package e |
| 82 |
|
| 83 |
func _() { |
| 84 |
switch { |
| 85 |
case true: |
| 86 |
a, b := f5() //@ inline(re"f5", f5) |
| 87 |
_, _ = a, b |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
func f5() (int, int) { return 2, 2} |
| 92 |
|
| 93 |
-- f5 -- |
| 94 |
package e |
| 95 |
|
| 96 |
func _() { |
| 97 |
switch { |
| 98 |
case true: |
| 99 |
a, b := 2, 2 //@ inline(re"f5", f5) |
| 100 |
_, _ = a, b |
| 101 |
} |
| 102 |
} |
| 103 |
|
| 104 |
func f5() (int, int) { return 2, 2 } |