Remove Yul instruction PC and adapt tests accordingly.

This commit is contained in:
Christian Parpart 2020-05-27 16:03:01 +02:00
parent 894478ff8c
commit 9820df58ab
4 changed files with 13 additions and 10 deletions

View File

@ -8,6 +8,7 @@ Breaking changes:
* Type Checker: Disallow shifts by signed types. * Type Checker: Disallow shifts by signed types.
Language Features: Language Features:
* Yul: Disallow EVM instruction `pc()`.
Compiler Features: Compiler Features:

View File

@ -556,16 +556,18 @@ bool AsmAnalyzer::warnOnInstructions(evmasm::Instruction _instr, SourceLocation
errorForVM("only available for Constantinople-compatible"); errorForVM("only available for Constantinople-compatible");
else if (_instr == evmasm::Instruction::CHAINID && !m_evmVersion.hasChainID()) else if (_instr == evmasm::Instruction::CHAINID && !m_evmVersion.hasChainID())
errorForVM("only available for Istanbul-compatible"); errorForVM("only available for Istanbul-compatible");
else if (_instr == evmasm::Instruction::PC)
m_errorReporter.warning(
2450_error,
_location,
"The \"" +
boost::to_lower_copy(instructionInfo(_instr).name) +
"\" instruction is deprecated and will be removed in the next breaking release."
);
else if (_instr == evmasm::Instruction::SELFBALANCE && !m_evmVersion.hasSelfBalance()) else if (_instr == evmasm::Instruction::SELFBALANCE && !m_evmVersion.hasSelfBalance())
errorForVM("only available for Istanbul-compatible"); errorForVM("only available for Istanbul-compatible");
else if (_instr == evmasm::Instruction::PC)
{
m_errorReporter.error(
4316_error,
Error::Type::SyntaxError,
_location,
"PC instruction is a low-level EVM feature. "
"Because of that PC is disallowed in strict assembly."
);
}
else if ( else if (
_instr == evmasm::Instruction::JUMP || _instr == evmasm::Instruction::JUMP ||
_instr == evmasm::Instruction::JUMPI || _instr == evmasm::Instruction::JUMPI ||

View File

@ -6,4 +6,4 @@ contract C {
} }
} }
// ---- // ----
// Warning: (61-63): The "pc" instruction is deprecated and will be removed in the next breaking release. // SyntaxError: (61-63): PC instruction is a low-level EVM feature. Because of that PC is disallowed in strict assembly.

View File

@ -4,4 +4,4 @@
// ==== // ====
// dialect: evmTyped // dialect: evmTyped
// ---- // ----
// Warning: (10-12): The "pc" instruction is deprecated and will be removed in the next breaking release. // SyntaxError: (10-12): PC instruction is a low-level EVM feature. Because of that PC is disallowed in strict assembly.