mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge branch 'origin/develop' into develop_060
This commit is contained in:
@@ -568,7 +568,7 @@ BOOST_AUTO_TEST_CASE(multiline_comment_at_eos)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(regular_line_break_in_single_line_comment)
|
||||
{
|
||||
for (auto const& nl: {"\r", "\n"})
|
||||
for (auto const& nl: {"\r", "\n", "\r\n"})
|
||||
{
|
||||
Scanner scanner(CharStream("// abc " + string(nl) + " def ", ""));
|
||||
BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), "");
|
||||
@@ -595,7 +595,7 @@ BOOST_AUTO_TEST_CASE(irregular_line_breaks_in_single_line_comment)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(regular_line_breaks_in_single_line_doc_comment)
|
||||
{
|
||||
for (auto const& nl: {"\r", "\n"})
|
||||
for (auto const& nl: {"\r", "\n", "\r\n"})
|
||||
{
|
||||
Scanner scanner(CharStream("/// abc " + string(nl) + " def ", ""));
|
||||
BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), "abc ");
|
||||
@@ -605,6 +605,22 @@ BOOST_AUTO_TEST_CASE(regular_line_breaks_in_single_line_doc_comment)
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(regular_line_breaks_in_multiline_doc_comment)
|
||||
{
|
||||
// Test CR, LF, CRLF as line valid terminators for code comments.
|
||||
// Any accepted non-LF is being canonicalized to LF.
|
||||
for (auto const& nl : {"\r"s, "\n"s, "\r\n"s})
|
||||
{
|
||||
Scanner scanner{CharStream{"/// Hello" + nl + "/// World" + nl + "ident", ""}};
|
||||
auto const& lit = scanner.currentCommentLiteral();
|
||||
BOOST_CHECK_EQUAL(lit, "Hello\n World");
|
||||
BOOST_CHECK_EQUAL(scanner.currentCommentLiteral(), "Hello\n World");
|
||||
BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Identifier);
|
||||
BOOST_CHECK_EQUAL(scanner.currentLiteral(), "ident");
|
||||
BOOST_CHECK_EQUAL(scanner.next(), Token::EOS);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(irregular_line_breaks_in_single_line_doc_comment)
|
||||
{
|
||||
for (auto const& nl: {"\v", "\f", "\xE2\x80\xA8", "\xE2\x80\xA9"})
|
||||
@@ -622,9 +638,9 @@ BOOST_AUTO_TEST_CASE(irregular_line_breaks_in_single_line_doc_comment)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(regular_line_breaks_in_strings)
|
||||
{
|
||||
for (auto const& nl: {"\n", "\r"})
|
||||
for (auto const& nl: {"\r"s, "\n"s, "\r\n"s})
|
||||
{
|
||||
Scanner scanner(CharStream("\"abc " + string(nl) + " def\"", ""));
|
||||
Scanner scanner(CharStream("\"abc " + nl + " def\"", ""));
|
||||
BOOST_CHECK_EQUAL(scanner.currentToken(), Token::Illegal);
|
||||
BOOST_CHECK_EQUAL(scanner.next(), Token::Identifier);
|
||||
BOOST_CHECK_EQUAL(scanner.currentLiteral(), "def");
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
contract Test {
|
||||
struct RecursiveStruct {
|
||||
RecursiveStruct[] vals;
|
||||
}
|
||||
|
||||
function func() public pure {
|
||||
RecursiveStruct[1] memory val = [ RecursiveStruct(new RecursiveStruct[](42)) ];
|
||||
assert(val[0].vals.length == 42);
|
||||
}
|
||||
}
|
||||
// -----
|
||||
// func() ->
|
||||
@@ -5,4 +5,4 @@ library A {}
|
||||
==== Source: c ====
|
||||
import {A} from "./a"; import {A} from "./b";
|
||||
// ----
|
||||
// DeclarationError: (c:23-45): Identifier already declared.
|
||||
// DeclarationError: (c:31-32): Identifier already declared.
|
||||
|
||||
@@ -3,4 +3,4 @@ contract C {}
|
||||
==== Source: b ====
|
||||
import {C as msg} from "B.sol";
|
||||
// ----
|
||||
// Warning: (B.sol:0-13): This declaration shadows a builtin symbol.
|
||||
// Warning: (b:13-16): This declaration shadows a builtin symbol.
|
||||
|
||||
@@ -7,5 +7,5 @@ contract C {
|
||||
// ----
|
||||
// Warning: (B.sol:0-15): This declaration shadows a builtin symbol.
|
||||
// Warning: (B.sol:16-32): This declaration shadows a builtin symbol.
|
||||
// Warning: (B.sol:0-15): This declaration shadows a builtin symbol.
|
||||
// Warning: (B.sol:16-32): This declaration shadows a builtin symbol.
|
||||
// Warning: (b:8-11): This declaration shadows a builtin symbol.
|
||||
// Warning: (b:13-18): This declaration shadows a builtin symbol.
|
||||
|
||||
@@ -5,4 +5,4 @@ library A {}
|
||||
==== Source: c ====
|
||||
import {A} from "./a"; import {A} from "./b";
|
||||
// ----
|
||||
// DeclarationError: (c:23-45): Identifier already declared.
|
||||
// DeclarationError: (c:31-32): Identifier already declared.
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
contract Test {
|
||||
struct RecursiveStruct {
|
||||
RecursiveStruct[] vals;
|
||||
}
|
||||
|
||||
function func() private pure {
|
||||
RecursiveStruct[1] memory val;
|
||||
val;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user