mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Display string literal as hex in error messages if it is not printable ASCII
This commit is contained in:
@@ -2,4 +2,4 @@ contract C {
|
||||
string s = string("\xa0\x00");
|
||||
}
|
||||
// ----
|
||||
// TypeError 9640: (28-46): Explicit type conversion not allowed from "literal_string (contains invalid UTF-8 sequence at position 0)" to "string memory".
|
||||
// TypeError 9640: (28-46): Explicit type conversion not allowed from "literal_string hex"a000" (contains invalid UTF-8 sequence at position 0)" to "string memory".
|
||||
|
||||
@@ -2,4 +2,4 @@ contract C {
|
||||
string s = hex"a000";
|
||||
}
|
||||
// ----
|
||||
// TypeError 7407: (28-37): Type literal_string (contains invalid UTF-8 sequence at position 0) is not implicitly convertible to expected type string storage ref.
|
||||
// TypeError 7407: (28-37): Type literal_string hex"a000" (contains invalid UTF-8 sequence at position 0) is not implicitly convertible to expected type string storage ref.
|
||||
|
||||
@@ -2,4 +2,4 @@ contract C {
|
||||
string s = "\xa0\x00";
|
||||
}
|
||||
// ----
|
||||
// TypeError 7407: (28-38): Type literal_string (contains invalid UTF-8 sequence at position 0) is not implicitly convertible to expected type string storage ref.
|
||||
// TypeError 7407: (28-38): Type literal_string hex"a000" (contains invalid UTF-8 sequence at position 0) is not implicitly convertible to expected type string storage ref.
|
||||
|
||||
@@ -3,4 +3,4 @@ contract C {
|
||||
}
|
||||
// ----
|
||||
// SyntaxError 8452: (28-38): Contains invalid UTF-8 sequence at position 0.
|
||||
// TypeError 7407: (28-38): Type literal_string (contains invalid UTF-8 sequence at position 0) is not implicitly convertible to expected type string storage ref.
|
||||
// TypeError 7407: (28-38): Type literal_string hex"c0" (contains invalid UTF-8 sequence at position 0) is not implicitly convertible to expected type string storage ref.
|
||||
|
||||
@@ -4,4 +4,4 @@ contract test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 6359: (86-92): Return argument type literal_string (contains invalid UTF-8 sequence at position 0) is not implicitly convertible to expected type (type of first return variable) string memory.
|
||||
// TypeError 6359: (86-92): Return argument type literal_string hex"c1" (contains invalid UTF-8 sequence at position 0) is not implicitly convertible to expected type (type of first return variable) string memory.
|
||||
|
||||
@@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9640: (76-95): Explicit type conversion not allowed from "literal_string "4V"" to "bytes2". Literal is larger than the type.
|
||||
// TypeError 9640: (76-95): Explicit type conversion not allowed from "literal_string hex"123456"" to "bytes2". Literal is larger than the type.
|
||||
|
||||
+4
-4
@@ -14,7 +14,7 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9640: (92-109): Explicit type conversion not allowed from "literal_string "4"" to "bytes1". Literal is larger than the type.
|
||||
// TypeError 9640: (198-217): Explicit type conversion not allowed from "literal_string "4V"" to "bytes2". Literal is larger than the type.
|
||||
// TypeError 9640: (310-331): Explicit type conversion not allowed from "literal_string "4Vx"" to "bytes3". Literal is larger than the type.
|
||||
// TypeError 9640: (430-453): Explicit type conversion not allowed from "literal_string (contains invalid UTF-8 sequence at position 4)" to "bytes4". Literal is larger than the type.
|
||||
// TypeError 9640: (92-109): Explicit type conversion not allowed from "literal_string hex"1234"" to "bytes1". Literal is larger than the type.
|
||||
// TypeError 9640: (198-217): Explicit type conversion not allowed from "literal_string hex"123456"" to "bytes2". Literal is larger than the type.
|
||||
// TypeError 9640: (310-331): Explicit type conversion not allowed from "literal_string hex"12345678"" to "bytes3". Literal is larger than the type.
|
||||
// TypeError 9640: (430-453): Explicit type conversion not allowed from "literal_string hex"1234567890" (contains invalid UTF-8 sequence at position 4)" to "bytes4". Literal is larger than the type.
|
||||
|
||||
Reference in New Issue
Block a user