Changing the UserDefinedValueType::toString to userdefined <name>

This commit is contained in:
hrkrshnn 2021-09-15 11:59:13 +02:00
parent 42c8310a63
commit 48e16ceb88
8 changed files with 37 additions and 37 deletions

View File

@ -2555,7 +2555,7 @@ bool UserDefinedValueType::operator==(Type const& _other) const
string UserDefinedValueType::toString(bool /* _short */) const
{
return "user defined type " + *definition().annotation().canonicalName;
return *definition().annotation().canonicalName;
}
vector<tuple<string, Type const*>> UserDefinedValueType::makeStackItems() const

View File

@ -36,7 +36,7 @@ contract C {
// "outputs":
// [
// {
// "internalType": "user defined type C.MyAddress",
// "internalType": "C.MyAddress",
// "name": "",
// "type": "address"
// }
@ -50,7 +50,7 @@ contract C {
// "outputs":
// [
// {
// "internalType": "user defined type MyByte1",
// "internalType": "MyByte1",
// "name": "",
// "type": "bytes1"
// }
@ -64,7 +64,7 @@ contract C {
// "outputs":
// [
// {
// "internalType": "user defined type C.MyBytes32",
// "internalType": "C.MyBytes32",
// "name": "",
// "type": "bytes32"
// }
@ -78,7 +78,7 @@ contract C {
// "outputs":
// [
// {
// "internalType": "user defined type MyInt",
// "internalType": "MyInt",
// "name": "",
// "type": "int256"
// }
@ -92,7 +92,7 @@ contract C {
// "outputs":
// [
// {
// "internalType": "user defined type C.MyUInt8",
// "internalType": "C.MyUInt8",
// "name": "",
// "type": "uint8"
// }
@ -104,7 +104,7 @@ contract C {
// "inputs":
// [
// {
// "internalType": "user defined type C.MyAddress",
// "internalType": "C.MyAddress",
// "name": "a",
// "type": "address"
// }
@ -118,7 +118,7 @@ contract C {
// "inputs":
// [
// {
// "internalType": "user defined type MyByte1",
// "internalType": "MyByte1",
// "name": "a",
// "type": "bytes1"
// }
@ -132,7 +132,7 @@ contract C {
// "inputs":
// [
// {
// "internalType": "user defined type C.MyBytes32",
// "internalType": "C.MyBytes32",
// "name": "a",
// "type": "bytes32"
// }
@ -146,7 +146,7 @@ contract C {
// "inputs":
// [
// {
// "internalType": "user defined type MyInt",
// "internalType": "MyInt",
// "name": "a",
// "type": "int256"
// }
@ -160,7 +160,7 @@ contract C {
// "inputs":
// [
// {
// "internalType": "user defined type C.MyUInt8",
// "internalType": "C.MyUInt8",
// "name": "a",
// "type": "uint8"
// }

View File

@ -91,7 +91,7 @@
"typeDescriptions":
{
"typeIdentifier": "t_userDefinedValueType$_MyAddress_$2",
"typeString": "user defined type MyAddress"
"typeString": "MyAddress"
},
"typeName":
{
@ -110,7 +110,7 @@
"typeDescriptions":
{
"typeIdentifier": "t_userDefinedValueType$_MyAddress_$2",
"typeString": "user defined type MyAddress"
"typeString": "MyAddress"
}
},
"visibility": "internal"
@ -141,7 +141,7 @@
"typeDescriptions":
{
"typeIdentifier": "t_userDefinedValueType$_MyUInt_$4",
"typeString": "user defined type MyUInt"
"typeString": "MyUInt"
},
"typeName":
{
@ -160,7 +160,7 @@
"typeDescriptions":
{
"typeIdentifier": "t_userDefinedValueType$_MyUInt_$4",
"typeString": "user defined type MyUInt"
"typeString": "MyUInt"
}
},
"visibility": "internal"
@ -269,7 +269,7 @@
"typeDescriptions":
{
"typeIdentifier": "t_mapping$_t_userDefinedValueType$_MyAddress_$18_$_t_userDefinedValueType$_MyUInt_$20_$",
"typeString": "mapping(user defined type C.MyAddress => user defined type C.MyUInt)"
"typeString": "mapping(C.MyAddress => C.MyUInt)"
},
"typeName":
{
@ -291,7 +291,7 @@
"typeDescriptions":
{
"typeIdentifier": "t_userDefinedValueType$_MyAddress_$18",
"typeString": "user defined type C.MyAddress"
"typeString": "C.MyAddress"
}
},
"nodeType": "Mapping",
@ -299,7 +299,7 @@
"typeDescriptions":
{
"typeIdentifier": "t_mapping$_t_userDefinedValueType$_MyAddress_$18_$_t_userDefinedValueType$_MyUInt_$20_$",
"typeString": "mapping(user defined type C.MyAddress => user defined type C.MyUInt)"
"typeString": "mapping(C.MyAddress => C.MyUInt)"
},
"valueType":
{
@ -318,7 +318,7 @@
"typeDescriptions":
{
"typeIdentifier": "t_userDefinedValueType$_MyUInt_$20",
"typeString": "user defined type C.MyUInt"
"typeString": "C.MyUInt"
}
}
},

View File

@ -14,11 +14,11 @@ function f() pure {
MyUInt.unwrap(AnotherUInt.wrap(10));
}
// ----
// TypeError 9640: (99-109): Explicit type conversion not allowed from "int_const -1" to "user defined type MyUInt".
// TypeError 9640: (115-128): Explicit type conversion not allowed from "int_const -1" to "user defined type MyAddress".
// TypeError 9640: (134-143): Explicit type conversion not allowed from "int_const 5" to "user defined type MyUInt".
// TypeError 9640: (149-170): Explicit type conversion not allowed from "address" to "user defined type MyAddress".
// TypeError 9640: (177-204): Explicit type conversion not allowed from "user defined type MyUInt" to "user defined type AnotherUInt".
// TypeError 9640: (210-238): Explicit type conversion not allowed from "user defined type AnotherUInt" to "user defined type MyUInt".
// TypeError 9553: (263-277): Invalid type for argument in function call. Invalid implicit conversion from user defined type MyUInt to user defined type AnotherUInt requested.
// TypeError 9553: (298-318): Invalid type for argument in function call. Invalid implicit conversion from user defined type AnotherUInt to user defined type MyUInt requested.
// TypeError 9640: (99-109): Explicit type conversion not allowed from "int_const -1" to "MyUInt".
// TypeError 9640: (115-128): Explicit type conversion not allowed from "int_const -1" to "MyAddress".
// TypeError 9640: (134-143): Explicit type conversion not allowed from "int_const 5" to "MyUInt".
// TypeError 9640: (149-170): Explicit type conversion not allowed from "address" to "MyAddress".
// TypeError 9640: (177-204): Explicit type conversion not allowed from "MyUInt" to "AnotherUInt".
// TypeError 9640: (210-238): Explicit type conversion not allowed from "AnotherUInt" to "MyUInt".
// TypeError 9553: (263-277): Invalid type for argument in function call. Invalid implicit conversion from MyUInt to AnotherUInt requested.
// TypeError 9553: (298-318): Invalid type for argument in function call. Invalid implicit conversion from AnotherUInt to MyUInt requested.

View File

@ -14,9 +14,9 @@ function f(int a) pure returns (int) {
return e;
}
// ----
// TypeError 9574: (62-73): Type int256 is not implicitly convertible to expected type user defined type MyInt.
// TypeError 9574: (80-89): Type user defined type MyInt is not implicitly convertible to expected type int256.
// TypeError 9574: (96-109): Type user defined type MyInt is not implicitly convertible to expected type address.
// TypeError 9574: (116-127): Type address is not implicitly convertible to expected type user defined type MyInt.
// TypeError 9640: (160-168): Explicit type conversion not allowed from "uint256" to "user defined type MyInt".
// TypeError 6359: (182-183): Return argument type user defined type MyInt is not implicitly convertible to expected type (type of first return variable) int256.
// TypeError 9574: (62-73): Type int256 is not implicitly convertible to expected type MyInt.
// TypeError 9574: (80-89): Type MyInt is not implicitly convertible to expected type int256.
// TypeError 9574: (96-109): Type MyInt is not implicitly convertible to expected type address.
// TypeError 9574: (116-127): Type address is not implicitly convertible to expected type MyInt.
// TypeError 9640: (160-168): Explicit type conversion not allowed from "uint256" to "MyInt".
// TypeError 6359: (182-183): Return argument type MyInt is not implicitly convertible to expected type (type of first return variable) int256.

View File

@ -4,5 +4,5 @@ function test() pure {
function (int) returns (MyInt) g = MyInt.wrap;
}
// ----
// TypeError 9574: (46-93): Type function (user defined type MyInt) pure returns (int256) is not implicitly convertible to expected type function (user defined type MyInt) returns (int256). Special functions can not be converted to function types.
// TypeError 9574: (99-144): Type function (int256) pure returns (user defined type MyInt) is not implicitly convertible to expected type function (int256) returns (user defined type MyInt). Special functions can not be converted to function types.
// TypeError 9574: (46-93): Type function (MyInt) pure returns (int256) is not implicitly convertible to expected type function (MyInt) returns (int256). Special functions can not be converted to function types.
// TypeError 9574: (99-144): Type function (int256) pure returns (MyInt) is not implicitly convertible to expected type function (int256) returns (MyInt). Special functions can not be converted to function types.

View File

@ -11,6 +11,6 @@ function f() {
// TypeError 6160: (38-57): Wrong argument count for function call: 3 arguments given but expected 1.
// TypeError 4974: (63-84): Named argument "test" does not match function declaration.
// TypeError 6160: (90-102): Wrong argument count for function call: 0 arguments given but expected 1.
// TypeError 9553: (121-122): Invalid type for argument in function call. Invalid implicit conversion from int_const 5 to user defined type MyInt requested.
// TypeError 9553: (121-122): Invalid type for argument in function call. Invalid implicit conversion from int_const 5 to MyInt requested.
// TypeError 4974: (129-152): Named argument "test" does not match function declaration.
// TypeError 6160: (158-200): Wrong argument count for function call: 2 arguments given but expected 1.

View File

@ -5,4 +5,4 @@ contract D
C.T x = L.T.wrap(uint(1));
}
// ----
// TypeError 7407: (86-103): Type user defined type L.T is not implicitly convertible to expected type user defined type C.T.
// TypeError 7407: (86-103): Type L.T is not implicitly convertible to expected type C.T.