Skip to content

Commit ac80d1b

Browse files
authored
interp: fix setting interface objects from operators
This is a follow-up of #1017, generalizing the use of reflect.Set method to set, and possibly overwrite, the concrete value of interface objects all accross the implementation of operators. Previous optimized implementation for non-interface objects is preserved.
1 parent 2e17cfa commit ac80d1b

File tree

4 files changed

+879
-171
lines changed

4 files changed

+879
-171
lines changed

_test/interface50.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package main
2+
3+
func main() {
4+
a := true
5+
var b interface{} = 5
6+
println(b.(int))
7+
b = a == true
8+
println(b.(bool))
9+
}
10+
11+
// Output:
12+
// 5
13+
// true

internal/cmd/genop/genop.go

Lines changed: 123 additions & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)