From bd3e3e72b3da91c4ee83debcb17051465d5af382 Mon Sep 17 00:00:00 2001 From: aldenhu Date: Thu, 21 Jul 2022 09:57:33 -0700 Subject: [PATCH] fixup! move stdlib: type_info::type_name() --- .../aptos-stdlib/sources/type_info.move | 28 +++++++++---------- aptos-move/framework/src/natives/mod.rs | 2 +- aptos-move/framework/src/natives/type_info.rs | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/aptos-move/framework/aptos-stdlib/sources/type_info.move b/aptos-move/framework/aptos-stdlib/sources/type_info.move index 1483267cc1100..5bdc186a31dd6 100644 --- a/aptos-move/framework/aptos-stdlib/sources/type_info.move +++ b/aptos-move/framework/aptos-stdlib/sources/type_info.move @@ -20,7 +20,7 @@ module aptos_std::type_info { } public native fun type_of(): TypeInfo; - public native fun full_name(): string::String; + public native fun type_name(): string::String; #[test] fun test() { @@ -31,29 +31,29 @@ module aptos_std::type_info { } #[test] - fun test_full_name() { + fun test_type_name() { use aptos_std::table::Table; - assert!(full_name() == string::utf8(b"bool"), 0); - assert!(full_name() == string::utf8(b"u8"), 1); - assert!(full_name() == string::utf8(b"u64"), 2); - assert!(full_name() == string::utf8(b"u128"), 3); - assert!(full_name
() == string::utf8(b"address"), 4); - assert!(full_name() == string::utf8(b"signer"), 5); + assert!(type_name() == string::utf8(b"bool"), 0); + assert!(type_name() == string::utf8(b"u8"), 1); + assert!(type_name() == string::utf8(b"u64"), 2); + assert!(type_name() == string::utf8(b"u128"), 3); + assert!(type_name
() == string::utf8(b"address"), 4); + assert!(type_name() == string::utf8(b"signer"), 5); // vector - assert!(full_name>() == string::utf8(b"vector"), 6); - assert!(full_name>>() == string::utf8(b"vector>"), 7); - assert!(full_name>>() == string::utf8(b"vector>"), 8); + assert!(type_name>() == string::utf8(b"vector"), 6); + assert!(type_name>>() == string::utf8(b"vector>"), 7); + assert!(type_name>>() == string::utf8(b"vector>"), 8); // struct - assert!(full_name() == string::utf8(b"0x1::type_info::TypeInfo"), 9); - assert!(full_name< + assert!(type_name() == string::utf8(b"0x1::type_info::TypeInfo"), 9); + assert!(type_name< Table< TypeInfo, Table> > - >() == string::utf8(b"0x1::table::Table<0x1::type_info::TypeInfo, 0x1::table::Table>"), 10); + >() == string::utf8(b"0x1::table::Table<0x1::type_info::TypeInfo, 0x1::table::Table>>"), 10); } } diff --git a/aptos-move/framework/src/natives/mod.rs b/aptos-move/framework/src/natives/mod.rs index 9bba3f9a5d1e7..1c74fa539e53c 100644 --- a/aptos-move/framework/src/natives/mod.rs +++ b/aptos-move/framework/src/natives/mod.rs @@ -51,7 +51,7 @@ pub fn all_natives(framework_addr: AccountAddress) -> NativeFunctionTable { signature::native_secp256k1_recover, ), ("type_info", "type_of", type_info::type_of), - ("type_info", "full_name", type_info::full_name), + ("type_info", "type_name", type_info::type_name), ("hash", "sip_hash", hash::native_sip_hash), ]; NATIVES diff --git a/aptos-move/framework/src/natives/type_info.rs b/aptos-move/framework/src/natives/type_info.rs index 98b6c2efabd52..d475e56e9e6d4 100644 --- a/aptos-move/framework/src/natives/type_info.rs +++ b/aptos-move/framework/src/natives/type_info.rs @@ -44,7 +44,7 @@ pub fn type_of( } /// Returns a string representing the TypeTag of the parameter. -pub fn full_name( +pub fn type_name( context: &mut NativeContext, ty_args: Vec, arguments: VecDeque,