Merge remote-tracking branch 'origin/develop' into develop_060

This commit is contained in:
chriseth
2019-11-26 16:19:35 +01:00
65 changed files with 1942 additions and 203 deletions
+1 -1
View File
@@ -505,7 +505,7 @@ BOOST_AUTO_TEST_CASE(valid_hex_literal)
{
Scanner scanner(CharStream("{ hex\"00112233FF\"", ""));
BOOST_CHECK_EQUAL(scanner.currentToken(), Token::LBrace);
BOOST_CHECK_EQUAL(scanner.next(), Token::StringLiteral);
BOOST_CHECK_EQUAL(scanner.next(), Token::HexStringLiteral);
BOOST_CHECK_EQUAL(scanner.currentLiteral(), std::string("\x00\x11\x22\x33\xFF", 5));
}
@@ -0,0 +1,13 @@
contract C {
function f1() external pure returns (string memory) { return "abcabc"; }
function f2() external pure returns (string memory) { return "abcabc`~12345677890- _=+!@#$%^&*()[{]}|;:',<.>?"; }
function g() external pure returns (bytes32) { return "abcabc"; }
function h() external pure returns (bytes4) { return 0xcafecafe; }
}
// ====
// compileViaYul: only
// ----
// f1() -> 0x20, 6, left(0x616263616263)
// f2() -> 32, 47, 44048183223289766195424279195050628400112610419087780792899004030957505095210, 18165586057823232067963737336409268114628061002662705707816940456850361417728
// g() -> left(0x616263616263)
// h() -> left(0xcafecafe)
@@ -0,0 +1,8 @@
contract test {
function f() public pure returns (bytes32) {
bytes32 escapeCharacters = hex"aa" hex"b";
return escapeCharacters;
}
}
// ----
// ParserError: (108-112): Expected even number of hex-nibbles within double-quotes.
@@ -0,0 +1,9 @@
contract test {
function f() public pure returns (bytes32) {
bytes32 escapeCharacters = hex"0000"
hex"deaf"
hex"feed";
return escapeCharacters;
}
}
// ----
@@ -0,0 +1,10 @@
contract test {
function f() public pure returns (bytes32) {
bytes32 escapeCharacters = hex"0000"
"deaf"
"feed";
return escapeCharacters;
}
}
// ----
// ParserError: (118-124): Expected ';' but got 'StringLiteral'
@@ -0,0 +1,8 @@
contract test {
function f() public pure returns (bytes32) {
bytes32 escapeCharacters = hex"aa" hex"bb" "cc";
return escapeCharacters;
}
}
// ----
// ParserError: (116-120): Expected ';' but got 'StringLiteral'
@@ -0,0 +1,8 @@
contract test {
function f() public pure returns (bytes32) {
bytes32 escapeCharacters = "foo" "bar" hex"aa";
return escapeCharacters;
}
}
// ----
// ParserError: (112-119): Expected ';' but got 'HexStringLiteral'
@@ -0,0 +1,7 @@
contract test {
function f() public pure returns (bytes32) {
bytes32 escapeCharacters = "first" "second" "third";
return escapeCharacters;
}
}
// ----