Merge pull request #4625 from ethereum/pragma-cleanup

Remove unnecessary or stray version pragmas
This commit is contained in:
Alex Beregszaszi 2018-07-31 11:15:45 +01:00 committed by GitHub
commit fe28814d83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 20 deletions

View File

@ -74,9 +74,9 @@ public:
unsigned const _optimizeRuns = 200 unsigned const _optimizeRuns = 200
) )
{ {
m_nonOptimizedBytecode = compileAndRunWithOptimizer(_sourceCode, _value, _contractName, false, _optimizeRuns); m_nonOptimizedBytecode = compileAndRunWithOptimizer("pragma solidity >=0.0;\n" + _sourceCode, _value, _contractName, false, _optimizeRuns);
m_nonOptimizedContract = m_contractAddress; m_nonOptimizedContract = m_contractAddress;
m_optimizedBytecode = compileAndRunWithOptimizer(_sourceCode, _value, _contractName, true, _optimizeRuns); m_optimizedBytecode = compileAndRunWithOptimizer("pragma solidity >=0.0;\n" + _sourceCode, _value, _contractName, true, _optimizeRuns);
size_t nonOptimizedSize = numInstructions(m_nonOptimizedBytecode); size_t nonOptimizedSize = numInstructions(m_nonOptimizedBytecode);
size_t optimizedSize = numInstructions(m_optimizedBytecode); size_t optimizedSize = numInstructions(m_optimizedBytecode);
BOOST_CHECK_MESSAGE( BOOST_CHECK_MESSAGE(
@ -441,8 +441,6 @@ BOOST_AUTO_TEST_CASE(constant_optimization_early_exit)
// This tests that the constant optimizer does not try to find the best representation // This tests that the constant optimizer does not try to find the best representation
// indefinitely but instead stops after some number of iterations. // indefinitely but instead stops after some number of iterations.
char const* sourceCode = R"( char const* sourceCode = R"(
pragma solidity ^0.4.0;
contract HexEncoding { contract HexEncoding {
function hexEncodeTest(address addr) public returns (bytes32 ret) { function hexEncodeTest(address addr) public returns (bytes32 ret) {
uint x = uint(addr) / 2**32; uint x = uint(addr) / 2**32;

View File

@ -1,4 +1,3 @@
pragma solidity ^0.4.3;
contract C { contract C {
event SomeEvent(); event SomeEvent();
function a() public { function a() public {
@ -6,4 +5,4 @@ contract C {
} }
} }
// ---- // ----
// ParserError: (95-99): Expected primary expression. // ParserError: (71-75): Expected primary expression.

View File

@ -1,4 +1,3 @@
pragma solidity ^0.4.3;
contract C { contract C {
function f() private pure {} function f() private pure {}
function a() public pure { function a() public pure {
@ -8,5 +7,5 @@ contract C {
} }
} }
// ---- // ----
// TypeError: (162-165): Tuple component cannot be empty. // TypeError: (138-141): Tuple component cannot be empty.
// TypeError: (181-184): Tuple component cannot be empty. // TypeError: (157-160): Tuple component cannot be empty.

View File

@ -1,4 +1,3 @@
pragma solidity ^0.4.3;
contract C { contract C {
function f() private pure {} function f() private pure {}
function a() public { function a() public {
@ -8,6 +7,6 @@ contract C {
} }
} }
// ---- // ----
// TypeError: (146-149): Tuple component cannot be empty. // TypeError: (122-125): Tuple component cannot be empty.
// TypeError: (151-154): Tuple component cannot be empty. // TypeError: (127-130): Tuple component cannot be empty.
// TypeError: (145-155): Type tuple(tuple(),tuple()) is not implicitly convertible to expected type tuple(uint256,uint256). // TypeError: (121-131): Type tuple(tuple(),tuple()) is not implicitly convertible to expected type tuple(uint256,uint256).

View File

@ -1,4 +1,3 @@
pragma solidity ^0.4.3;
contract C { contract C {
function f() private pure {} function f() private pure {}
function a() public { function a() public {
@ -8,4 +7,4 @@ contract C {
} }
} }
// ---- // ----
// TypeError: (146-149): Array component cannot be empty. // TypeError: (122-125): Array component cannot be empty.

View File

@ -1,5 +1,3 @@
pragma solidity ^0.4.20;
contract C { contract C {
function f() internal pure {} function f() internal pure {}
function g() internal pure returns (uint) { return 1; } function g() internal pure returns (uint) { return 1; }
@ -13,6 +11,6 @@ contract C {
} }
// ---- // ----
// SyntaxError: (249-261): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. // SyntaxError: (223-235): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.
// SyntaxError: (271-283): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. // SyntaxError: (245-257): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.
// SyntaxError: (293-306): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty. // SyntaxError: (267-280): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.