[dev.link] all: merge branch 'master' into dev.link

Change-Id: I85b653b621ad8cb2ef27886210ea2c4b7409b60d
This commit is contained in:
Cherry Zhang 2020-05-21 14:08:32 -04:00
commit 6097f7cf7a
45 changed files with 485 additions and 151 deletions

View file

@ -605,10 +605,23 @@ func TestFuncAlign(t *testing.T) {
}
}
const helloSrc = `
const testTrampSrc = `
package main
import "fmt"
func main() { fmt.Println("hello") }
func main() {
fmt.Println("hello")
defer func(){
if e := recover(); e == nil {
panic("did not panic")
}
}()
f1()
}
// Test deferreturn trampolines. See issue #39049.
func f1() { defer f2() }
func f2() { panic("XXX") }
`
func TestTrampoline(t *testing.T) {
@ -631,7 +644,7 @@ func TestTrampoline(t *testing.T) {
defer os.RemoveAll(tmpdir)
src := filepath.Join(tmpdir, "hello.go")
err = ioutil.WriteFile(src, []byte(helloSrc), 0666)
err = ioutil.WriteFile(src, []byte(testTrampSrc), 0666)
if err != nil {
t.Fatal(err)
}