diff --git a/gnovm/pkg/gnolang/values_string.go b/gnovm/pkg/gnolang/values_string.go index 4819c2064e8..f9a0128d7f9 100644 --- a/gnovm/pkg/gnolang/values_string.go +++ b/gnovm/pkg/gnolang/values_string.go @@ -176,6 +176,10 @@ func (tv *TypedValue) Sprint(m *Machine) string { res := m.Eval(Call(Sel(&ConstExpr{TypedValue: *tv}, "Error"))) return res[0].GetString() } + // print declared type + if _, ok := tv.T.(*DeclaredType); ok { + return tv.String() + } // otherwise, default behavior. switch bt := baseOf(tv.T).(type) { case PrimitiveType: diff --git a/gnovm/tests/files/addr0b_stdlibs.gno b/gnovm/tests/files/addr0b_stdlibs.gno index e2848c2321b..2ec6782c7f0 100644 --- a/gnovm/tests/files/addr0b_stdlibs.gno +++ b/gnovm/tests/files/addr0b_stdlibs.gno @@ -20,4 +20,4 @@ func main() { } // Output: -// struct{(struct{( string),( string),(0 int),(0 int),(nil github.com/gnolang/gno/_test/net/http.Header),(undefined),(0 int64),(nil []string),(false bool),( string),(nil github.com/gnolang/gno/_test/net/http.Values),(nil github.com/gnolang/gno/_test/net/http.Values),(nil github.com/gnolang/gno/_test/net/http.Header),( string),( string),(nil *github.com/gnolang/gno/_test/net/http.Response)} github.com/gnolang/gno/_test/net/http.Request),( string)} +// (struct{(struct{( string),( string),(0 int),(0 int),(nil github.com/gnolang/gno/_test/net/http.Header),(undefined),(0 int64),(nil []string),(false bool),( string),(nil github.com/gnolang/gno/_test/net/http.Values),(nil github.com/gnolang/gno/_test/net/http.Values),(nil github.com/gnolang/gno/_test/net/http.Header),( string),( string),(nil *github.com/gnolang/gno/_test/net/http.Response)} github.com/gnolang/gno/_test/net/http.Request),( string)} main.extendedRequest) diff --git a/gnovm/tests/files/assign21.gno b/gnovm/tests/files/assign21.gno index 9d3595e95bd..c24d902c0c0 100644 --- a/gnovm/tests/files/assign21.gno +++ b/gnovm/tests/files/assign21.gno @@ -14,4 +14,4 @@ func main() { } // Output: -// 1 true +// (1 main.thing) true diff --git a/gnovm/tests/files/composite2.gno b/gnovm/tests/files/composite2.gno index 5e8dc6afc1b..e6882e03b8b 100644 --- a/gnovm/tests/files/composite2.gno +++ b/gnovm/tests/files/composite2.gno @@ -9,4 +9,4 @@ func main() { } // Output: -// struct{("hello" string)} +// (struct{("hello" string)} main.T) diff --git a/gnovm/tests/files/composite5.gno b/gnovm/tests/files/composite5.gno index 15c4aa530e7..906f9d4f930 100644 --- a/gnovm/tests/files/composite5.gno +++ b/gnovm/tests/files/composite5.gno @@ -11,4 +11,4 @@ func main() { } // Output: -// struct{(12 uint16)} +// (struct{(12 uint16)} main.T) diff --git a/gnovm/tests/files/composite6.gno b/gnovm/tests/files/composite6.gno index 122665aa9d7..25817cde400 100644 --- a/gnovm/tests/files/composite6.gno +++ b/gnovm/tests/files/composite6.gno @@ -15,4 +15,4 @@ func main() { } // Output: -// struct{(2 uint16)} +// (struct{(2 uint16)} main.T) diff --git a/gnovm/tests/files/const12.gno b/gnovm/tests/files/const12.gno index 84510bf16b5..86dde62eb3d 100644 --- a/gnovm/tests/files/const12.gno +++ b/gnovm/tests/files/const12.gno @@ -14,4 +14,4 @@ func main() { } // Output: -// 0 2 4 6 +// (0 main.Kind) (2 main.Kind) (4 main.Kind) (6 main.Kind) diff --git a/gnovm/tests/files/const15.gno b/gnovm/tests/files/const15.gno index ed55754726c..a2af6c6a849 100644 --- a/gnovm/tests/files/const15.gno +++ b/gnovm/tests/files/const15.gno @@ -14,4 +14,4 @@ func main() { } // Output: -// 3 +// (3 main.T1) diff --git a/gnovm/tests/files/fun6b.gno b/gnovm/tests/files/fun6b.gno index 9ff57036333..17b0473b33b 100644 --- a/gnovm/tests/files/fun6b.gno +++ b/gnovm/tests/files/fun6b.gno @@ -17,4 +17,4 @@ func main() { } // Output: -// struct{(gonative{} gonative{*sync.Pool})} +// (struct{(gonative{} gonative{*sync.Pool})} main.Pool) diff --git a/gnovm/tests/files/fun9.gno b/gnovm/tests/files/fun9.gno index 5b5ec1bfe36..18c49a3a226 100644 --- a/gnovm/tests/files/fun9.gno +++ b/gnovm/tests/files/fun9.gno @@ -9,4 +9,4 @@ func main() { } // Output: -// 1 +// (1 main.myint) diff --git a/gnovm/tests/files/interface39b.gno b/gnovm/tests/files/interface39b.gno index 9a49c0abdef..a87b9ff1d30 100644 --- a/gnovm/tests/files/interface39b.gno +++ b/gnovm/tests/files/interface39b.gno @@ -18,4 +18,4 @@ func main() { } // Output: -// struct{("bar" string)} +// (struct{("bar" string)} main.foo) diff --git a/gnovm/tests/files/map19b.gno b/gnovm/tests/files/map19b.gno index dbbb6876cc6..77361016591 100644 --- a/gnovm/tests/files/map19b.gno +++ b/gnovm/tests/files/map19b.gno @@ -14,4 +14,4 @@ func main() { } // Output: -// struct{(nil map[int64]*main.server)} +// (struct{(nil map[int64]*main.server)} main.cmap) diff --git a/gnovm/tests/files/ptr0.gno b/gnovm/tests/files/ptr0.gno index 2c61280b2ee..dd459e2d29f 100644 --- a/gnovm/tests/files/ptr0.gno +++ b/gnovm/tests/files/ptr0.gno @@ -9,4 +9,4 @@ func main() { } // Output: -// 2 +// (2 main.myint) diff --git a/gnovm/tests/files/ptr7.gno b/gnovm/tests/files/ptr7.gno index 1c6d7ae4040..b8f7fc9cf88 100644 --- a/gnovm/tests/files/ptr7.gno +++ b/gnovm/tests/files/ptr7.gno @@ -23,4 +23,4 @@ func main() { } // Output: -// struct{(nil github.com/gnolang/gno/_test/net.IP),(nil github.com/gnolang/gno/_test/net.IPMask)} +// (struct{(nil github.com/gnolang/gno/_test/net.IP),(nil github.com/gnolang/gno/_test/net.IPMask)} main.ipNetValue) diff --git a/gnovm/tests/files/recurse0.gno b/gnovm/tests/files/recurse0.gno index 2bf8f539f5a..fe5a997b19f 100644 --- a/gnovm/tests/files/recurse0.gno +++ b/gnovm/tests/files/recurse0.gno @@ -33,5 +33,5 @@ func main() { } // Output: -// struct{(nil []main.T),(nil []*main.T),(nil map[string]main.T),(nil map[string]*main.T),(nil chan main.T),(nil chan *main.T),(nil *main.T),(nil func(.arg_0 main.T)( main.T)),(nil func(.arg_0 *main.T)( *main.T)),(struct{(nil []main.T),(nil []*main.T),(nil map[string]main.T),(nil map[string]*main.T),(nil chan main.T),(nil chan *main.T),(nil *main.T),(nil func(.arg_0 main.T)( main.T)),(nil func(.arg_0 *main.T)( *main.T))} main.U)} -// struct{(nil []main.T),(nil []*main.T),(nil map[string]main.T),(nil map[string]*main.T),(nil chan main.T),(nil chan *main.T),(nil *main.T),(nil func(.arg_0 main.T)( main.T)),(nil func(.arg_0 *main.T)( *main.T))} +// (struct{(nil []main.T),(nil []*main.T),(nil map[string]main.T),(nil map[string]*main.T),(nil chan main.T),(nil chan *main.T),(nil *main.T),(nil func(.arg_0 main.T)( main.T)),(nil func(.arg_0 *main.T)( *main.T)),(struct{(nil []main.T),(nil []*main.T),(nil map[string]main.T),(nil map[string]*main.T),(nil chan main.T),(nil chan *main.T),(nil *main.T),(nil func(.arg_0 main.T)( main.T)),(nil func(.arg_0 *main.T)( *main.T))} main.U)} main.T) +// (struct{(nil []main.T),(nil []*main.T),(nil map[string]main.T),(nil map[string]*main.T),(nil chan main.T),(nil chan *main.T),(nil *main.T),(nil func(.arg_0 main.T)( main.T)),(nil func(.arg_0 *main.T)( *main.T))} main.U) diff --git a/gnovm/tests/files/struct28b.gno b/gnovm/tests/files/struct28b.gno index dc61b00bb6f..e426fe490e2 100644 --- a/gnovm/tests/files/struct28b.gno +++ b/gnovm/tests/files/struct28b.gno @@ -14,4 +14,4 @@ func main() { } // Output: -// struct{(struct{(nil *main.T1)} main.T2)} +// (struct{(struct{(nil *main.T1)} main.T2)} main.T1) diff --git a/gnovm/tests/files/struct50b.gno b/gnovm/tests/files/struct50b.gno index 62558c5b69f..212238c5cd7 100644 --- a/gnovm/tests/files/struct50b.gno +++ b/gnovm/tests/files/struct50b.gno @@ -14,5 +14,5 @@ func main() { } // Output: -// struct{("hello" string),(slice[(struct{("world" string),(nil []main.Node)} main.Node)] []main.Node)} -// struct{("hello" string),(slice[(struct{("world" string),(slice[(struct{("sunshine" string),(nil []main.Node)} main.Node)] []main.Node)} main.Node)] []main.Node)} +// (struct{("hello" string),(slice[(struct{("world" string),(nil []main.Node)} main.Node)] []main.Node)} main.Node) +// (struct{("hello" string),(slice[(struct{("world" string),(slice[(struct{("sunshine" string),(nil []main.Node)} main.Node)] []main.Node)} main.Node)] []main.Node)} main.Node) diff --git a/gnovm/tests/files/struct52b.gno b/gnovm/tests/files/struct52b.gno index 167e45d10a6..f1b26641149 100644 --- a/gnovm/tests/files/struct52b.gno +++ b/gnovm/tests/files/struct52b.gno @@ -14,5 +14,5 @@ func main() { } // Output: -// struct{("hello" string),(map{("1" string):(struct{("world" string),(map{} map[string]main.Node)} main.Node)} map[string]main.Node)} -// struct{("hello" string),(map{("1" string):(struct{("world" string),(map{("1" string):(struct{("sunshine" string),(map{} map[string]main.Node)} main.Node)} map[string]main.Node)} main.Node)} map[string]main.Node)} +// (struct{("hello" string),(map{("1" string):(struct{("world" string),(map{} map[string]main.Node)} main.Node)} map[string]main.Node)} main.Node) +// (struct{("hello" string),(map{("1" string):(struct{("world" string),(map{("1" string):(struct{("sunshine" string),(map{} map[string]main.Node)} main.Node)} map[string]main.Node)} main.Node)} map[string]main.Node)} main.Node) diff --git a/gnovm/tests/files/struct53b.gno b/gnovm/tests/files/struct53b.gno index b0f9be2659d..a367b109d30 100644 --- a/gnovm/tests/files/struct53b.gno +++ b/gnovm/tests/files/struct53b.gno @@ -18,4 +18,4 @@ func main() { } // Output: -// struct{(nil *main.T)} +// (struct{(nil *main.T)} main.T2) diff --git a/gnovm/tests/files/type0.gno b/gnovm/tests/files/type0.gno index 739cd711f93..38e385a04d9 100644 --- a/gnovm/tests/files/type0.gno +++ b/gnovm/tests/files/type0.gno @@ -8,4 +8,4 @@ func main() { } // Output: -// 0 +// (0 main.newInt) diff --git a/gnovm/tests/files/zpersist_valids.gno b/gnovm/tests/files/zpersist_valids.gno index 33280b54e57..2709a243adf 100644 --- a/gnovm/tests/files/zpersist_valids.gno +++ b/gnovm/tests/files/zpersist_valids.gno @@ -108,7 +108,7 @@ func printVars(phase string) { } // Output: -// preinit 16 true 22 16.16 16.16 16 16 16 16 16 97 hello slice[("A" string)] A struct{(16 int),("A" string)} 16 16 16 16 16 struct{(16 float32)} A -// postinit 32 false 44 32.32 32.32 32 32 32 32 32 66 helloB slice[("A" string),("B" string)] A struct{(32 int),("B" string)} 32 32 32 32 32 struct{("B" string)} B -// premain 32 false 44 32.32 32.32 32 32 32 32 32 66 helloB slice[("A" string),("B" string)] A struct{(32 int),("B" string)} 32 32 32 32 32 struct{("B" string)} B -// postmain 64 true 88 64.64 64.64 64 64 64 64 64 67 helloBC slice[("A" string),("B" string),("C" string)] A struct{(64 int),("C" string)} 64 64 64 64 64 struct{("C" string)} C +// preinit 16 true 22 16.16 16.16 16 16 16 16 16 97 hello slice[("A" string)] A (struct{(16 int),("A" string)} gno.land/r/demo/tests_test.myStruct) 16 16 16 16 16 struct{(16 float32)} A +// postinit 32 false 44 32.32 32.32 32 32 32 32 32 66 helloB slice[("A" string),("B" string)] A (struct{(32 int),("B" string)} gno.land/r/demo/tests_test.myStruct) 32 32 32 32 32 struct{("B" string)} B +// premain 32 false 44 32.32 32.32 32 32 32 32 32 66 helloB slice[("A" string),("B" string)] A (struct{(32 int),("B" string)} gno.land/r/demo/tests_test.myStruct) 32 32 32 32 32 struct{("B" string)} B +// postmain 64 true 88 64.64 64.64 64 64 64 64 64 67 helloBC slice[("A" string),("B" string),("C" string)] A (struct{(64 int),("C" string)} gno.land/r/demo/tests_test.myStruct) 64 64 64 64 64 struct{("C" string)} C diff --git a/gnovm/tests/files/zrealm10.gno b/gnovm/tests/files/zrealm10.gno index 12925ddd680..97bb9d439e2 100644 --- a/gnovm/tests/files/zrealm10.gno +++ b/gnovm/tests/files/zrealm10.gno @@ -18,8 +18,8 @@ func main() { } // Output: -// struct{(1 int)} -// struct{(3 int)} +// (struct{(1 int)} gno.land/r/test.MyStruct) +// (struct{(3 int)} gno.land/r/test.MyStruct) // Realm: // switchrealm["gno.land/r/test"] diff --git a/gnovm/tests/files/zrealm11.gno b/gnovm/tests/files/zrealm11.gno index 0f1616db14d..0f4d26a44c0 100644 --- a/gnovm/tests/files/zrealm11.gno +++ b/gnovm/tests/files/zrealm11.gno @@ -18,8 +18,8 @@ func main() { } // Output: -// struct{(1 int)} -// struct{(-1 int)} +// (struct{(1 int)} gno.land/r/test.MyStruct) +// (struct{(-1 int)} gno.land/r/test.MyStruct) // Realm: // switchrealm["gno.land/r/test"] diff --git a/gnovm/tests/files/zrealm8.gno b/gnovm/tests/files/zrealm8.gno index e8ca92c8b69..1452301dac6 100644 --- a/gnovm/tests/files/zrealm8.gno +++ b/gnovm/tests/files/zrealm8.gno @@ -18,8 +18,8 @@ func main() { } // Output: -// struct{(1 int)} -// struct{(2 int)} +// (struct{(1 int)} gno.land/r/test.MyStruct) +// (struct{(2 int)} gno.land/r/test.MyStruct) // Realm: // switchrealm["gno.land/r/test"] diff --git a/gnovm/tests/files/zrealm9.gno b/gnovm/tests/files/zrealm9.gno index 52e2da3565e..306ca02a92a 100644 --- a/gnovm/tests/files/zrealm9.gno +++ b/gnovm/tests/files/zrealm9.gno @@ -18,8 +18,8 @@ func main() { } // Output: -// struct{(1 int)} -// struct{(0 int)} +// (struct{(1 int)} gno.land/r/test.MyStruct) +// (struct{(0 int)} gno.land/r/test.MyStruct) // Realm: // switchrealm["gno.land/r/test"] diff --git a/gnovm/tests/files/zrealm_crossrealm0.gno b/gnovm/tests/files/zrealm_crossrealm0.gno index 053e2258465..5bf34c2c852 100644 --- a/gnovm/tests/files/zrealm_crossrealm0.gno +++ b/gnovm/tests/files/zrealm_crossrealm0.gno @@ -14,4 +14,4 @@ func main() { } // Output: -// struct{("test" string)} +// (struct{("test" string)} gno.land/r/demo/tests.TestRealmObject) diff --git a/gnovm/tests/files/zrealm_crossrealm1.gno b/gnovm/tests/files/zrealm_crossrealm1.gno index 59b2d317b8a..686468b40c7 100644 --- a/gnovm/tests/files/zrealm_crossrealm1.gno +++ b/gnovm/tests/files/zrealm_crossrealm1.gno @@ -17,4 +17,4 @@ func main() { } // Output: -// struct{("test" string)} +// (struct{("test" string)} gno.land/r/demo/tests.TestRealmObject) diff --git a/gnovm/tests/files/zrealm_crossrealm6.gno b/gnovm/tests/files/zrealm_crossrealm6.gno index c17e317f2eb..d2e7a4b096a 100644 --- a/gnovm/tests/files/zrealm_crossrealm6.gno +++ b/gnovm/tests/files/zrealm_crossrealm6.gno @@ -18,4 +18,4 @@ func main() { } // Output: -// struct{("modified" string)} +// (struct{("modified" string)} gno.land/p/demo/tests.TestRealmObject2) diff --git a/gnovm/tests/files/zrealm_std1.gno b/gnovm/tests/files/zrealm_std1.gno index 85391bd26b1..87f75bcb871 100644 --- a/gnovm/tests/files/zrealm_std1.gno +++ b/gnovm/tests/files/zrealm_std1.gno @@ -25,7 +25,7 @@ func main() { } // Output: -// slice[ref(1ed29bd278d735e20e296bd4afe927501941392f:4)] +// (slice[ref(1ed29bd278d735e20e296bd4afe927501941392f:4)] std.AddressList) // error: address already exists // has: true // has: false diff --git a/gnovm/tests/files/zrealm_std2.gno b/gnovm/tests/files/zrealm_std2.gno index 68c09a741d8..1ae1fb4a881 100644 --- a/gnovm/tests/files/zrealm_std2.gno +++ b/gnovm/tests/files/zrealm_std2.gno @@ -26,7 +26,7 @@ func main() { } // Output: -// slice[ref(1ed29bd278d735e20e296bd4afe927501941392f:4)] +// (slice[ref(1ed29bd278d735e20e296bd4afe927501941392f:4)] std.AddressList) // error: address already exists // has: true // has: false