2021-03-05 12:24:41 -07:00
|
|
|
// run
|
|
|
|
|
|
|
|
//go:build !wasm
|
|
|
|
// +build !wasm
|
|
|
|
|
|
|
|
// Copyright 2021 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
type toobig struct {
|
2021-03-10 18:54:11 -07:00
|
|
|
a, b, c string
|
2021-03-05 12:24:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
//go:registerparams
|
|
|
|
//go:noinline
|
|
|
|
func (x *toobig) MagicMethodNameForTestingRegisterABI(y toobig, z toobig) toobig {
|
|
|
|
return toobig{x.a, y.b, z.c}
|
|
|
|
}
|
|
|
|
|
|
|
|
type AnInterface interface {
|
|
|
|
MagicMethodNameForTestingRegisterABI(y toobig, z toobig) toobig
|
|
|
|
}
|
|
|
|
|
|
|
|
//go:registerparams
|
|
|
|
//go:noinline
|
2021-03-10 18:54:11 -07:00
|
|
|
func I(a, b, c string) toobig {
|
|
|
|
return toobig{a, b, c}
|
2021-03-05 12:24:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// AnIid prevents the compiler from figuring out what the interface really is.
|
|
|
|
//go:noinline
|
|
|
|
func AnIid(x AnInterface) AnInterface {
|
|
|
|
return x
|
|
|
|
}
|
|
|
|
|
|
|
|
var tmp toobig
|
2021-03-10 18:54:11 -07:00
|
|
|
|
2021-03-05 12:24:41 -07:00
|
|
|
func main() {
|
|
|
|
x := I("Ahoy", "1,", "2")
|
|
|
|
y := I("3", "there,", "4")
|
|
|
|
z := I("5", "6,", "Matey")
|
2021-03-10 18:54:11 -07:00
|
|
|
tmp = x.MagicMethodNameForTestingRegisterABI(y, z)
|
2021-03-05 12:24:41 -07:00
|
|
|
fmt.Println(tmp.a, tmp.b, tmp.c)
|
2021-03-10 18:54:11 -07:00
|
|
|
tmp = AnIid(&x).MagicMethodNameForTestingRegisterABI(y, z)
|
2021-03-05 12:24:41 -07:00
|
|
|
fmt.Println(tmp.a, tmp.b, tmp.c)
|
|
|
|
}
|