-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Issue #3548 describes a bug in the compiler which was fixed by commit 505e50b. But this case wasn't covered by our current tests (obviously) and the fix in the compiler looks accidental so it's worth adding a test for it. Fixes #3548
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 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,35 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
type Thing struct { | ||
str string | ||
} | ||
|
||
func (d *Thing) Test() bool { | ||
return d != nil | ||
} | ||
|
||
func callit(f func()) { | ||
f() | ||
} | ||
|
||
func main() { | ||
cases := []struct { | ||
name string | ||
thing Thing | ||
}{ | ||
{ | ||
name: "Success", | ||
thing: Thing{str: "hello"}, | ||
}, | ||
} | ||
|
||
for _, c := range cases { | ||
callit(func() { | ||
fmt.Println("hello", c.thing.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