InlineAssembly: Extracting tests for name clashes.

This commit is contained in:
Christian Parpart 2020-10-19 15:49:14 +02:00
parent 55f9eab51f
commit 3597c8343d
6 changed files with 34 additions and 24 deletions

View File

@ -228,30 +228,6 @@ BOOST_AUTO_TEST_CASE(opcode_for_function_args)
CHECK_PARSE_ERROR("{ function f() -> gas { } }", ParserError, "Cannot use builtin");
}
BOOST_AUTO_TEST_CASE(name_clashes)
{
CHECK_PARSE_ERROR("{ let g := 2 function g() { } }", DeclarationError, "Variable name g already taken in this scope");
}
BOOST_AUTO_TEST_CASE(name_clashes_function_subscope)
{
CHECK_PARSE_ERROR("{ function g() { function g() {} } }", DeclarationError, "Function name g already taken in this scope");
}
BOOST_AUTO_TEST_CASE(name_clashes_function_subscope_reverse)
{
CHECK_PARSE_ERROR("{ { function g() {} } function g() { } }", DeclarationError, "Function name g already taken in this scope");
}
BOOST_AUTO_TEST_CASE(name_clashes_function_variable_subscope)
{
CHECK_PARSE_ERROR("{ function g() { let g := 0 } }", DeclarationError, "Variable name g already taken in this scope");
}
BOOST_AUTO_TEST_CASE(name_clashes_function_variable_subscope_reverse)
{
CHECK_PARSE_ERROR("{ { let g := 0 } function g() { } }", DeclarationError, "Variable name g already taken in this scope");
}
BOOST_AUTO_TEST_CASE(variable_access_cross_functions)
{
CHECK_PARSE_ERROR("{ let x := 2 function g() { pop(x) } }", DeclarationError, "Identifier not found.");

View File

@ -0,0 +1,7 @@
{
function g() {
let g := 0
}
}
// ----
// DeclarationError 1395: (20-30): Variable name g already taken in this scope.

View File

@ -0,0 +1,6 @@
{
{ let g := 0 }
function g() {}
}
// ----
// DeclarationError 1395: (5-15): Variable name g already taken in this scope.

View File

@ -0,0 +1,7 @@
{
function g() {
function g() {}
}
}
// ----
// DeclarationError 6052: (20-35): Function name g already taken in this scope.

View File

@ -0,0 +1,8 @@
{
{
function g() {}
}
function g() {}
}
// ----
// DeclarationError 6052: (7-22): Function name g already taken in this scope.

View File

@ -0,0 +1,6 @@
{
let g := 2
function g() { }
}
// ----
// DeclarationError 1395: (6-16): Variable name g already taken in this scope.