-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
interp: fix handling of interface value in forwarding return calls
Special wrapping of interface value at return is no longer necessary and must be avoided now. Fixes #1179.
- Loading branch information
Showing
2 changed files
with
25 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package main | ||
|
||
type I interface { | ||
F() | ||
} | ||
|
||
type T struct { | ||
Name string | ||
} | ||
|
||
func (t *T) F() { println("in F", t.Name) } | ||
|
||
func NewI(s string) I { return newT(s) } | ||
|
||
func newT(s string) *T { return &T{s} } | ||
|
||
func main() { | ||
i := NewI("test") | ||
i.F() | ||
} | ||
|
||
// Output: | ||
// in F test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters