mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Emit warning when using the Yul optimiser
This commit is contained in:
parent
dce27bb452
commit
0432401e20
@ -179,6 +179,12 @@ bool CompilerStack::parse()
|
||||
if (SemVerVersion{string(VersionString)}.isPrerelease())
|
||||
m_errorReporter.warning("This is a pre-release compiler version, please do not use it in production.");
|
||||
|
||||
if (m_optimiserSettings.runYulOptimiser)
|
||||
m_errorReporter.warning(
|
||||
"The Yul optimiser is still experimental. "
|
||||
"Do not use it in production unless correctness of generated code is verified with extensive tests."
|
||||
);
|
||||
|
||||
vector<string> sourcesToParse;
|
||||
for (auto const& s: m_sources)
|
||||
sourcesToParse.push_back(s.first);
|
||||
|
@ -1,3 +1,4 @@
|
||||
Warning: The Yul optimiser is still experimental. Do not use it in production unless correctness of generated code is verified with extensive tests.
|
||||
gas_test_abiv2_optimize_yul/input.sol:2:1: Warning: Experimental features are turned on. Do not use experimental features on live deployments.
|
||||
pragma experimental ABIEncoderV2;
|
||||
^-------------------------------^
|
||||
|
17
test/cmdlineTests/standard_optimizer_yul/input.json
Normal file
17
test/cmdlineTests/standard_optimizer_yul/input.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"content": "pragma solidity >=0.0; contract C { function f() public pure {} }"
|
||||
}
|
||||
},
|
||||
"settings":
|
||||
{
|
||||
"optimizer": {
|
||||
"enabled": true,
|
||||
"details": { "yul": true }
|
||||
}
|
||||
}
|
||||
}
|
1
test/cmdlineTests/standard_optimizer_yul/output.json
Normal file
1
test/cmdlineTests/standard_optimizer_yul/output.json
Normal file
@ -0,0 +1 @@
|
||||
{"errors":[{"component":"general","formattedMessage":"Warning: The Yul optimiser is still experimental. Do not use it in production unless correctness of generated code is verified with extensive tests.\n","message":"The Yul optimiser is still experimental. Do not use it in production unless correctness of generated code is verified with extensive tests.","severity":"warning","type":"Warning"}],"sources":{"A":{"id":0}}}
|
16
test/cmdlineTests/standard_optimizer_yulDetails/input.json
Normal file
16
test/cmdlineTests/standard_optimizer_yulDetails/input.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources":
|
||||
{
|
||||
"A":
|
||||
{
|
||||
"content": "pragma solidity >=0.0; contract C { function f() public pure {} }"
|
||||
}
|
||||
},
|
||||
"settings":
|
||||
{
|
||||
"optimizer": {
|
||||
"details": { "yul": true, "yulDetails": {} }
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
{"errors":[{"component":"general","formattedMessage":"Warning: The Yul optimiser is still experimental. Do not use it in production unless correctness of generated code is verified with extensive tests.\n","message":"The Yul optimiser is still experimental. Do not use it in production unless correctness of generated code is verified with extensive tests.","severity":"warning","type":"Warning"}],"sources":{"A":{"id":0}}}
|
@ -996,6 +996,12 @@ BOOST_AUTO_TEST_CASE(optimizer_settings_details_different)
|
||||
)";
|
||||
Json::Value result = compile(input);
|
||||
BOOST_CHECK(containsAtMostWarnings(result));
|
||||
BOOST_CHECK(containsError(
|
||||
result,
|
||||
"Warning",
|
||||
"The Yul optimiser is still experimental. "
|
||||
"Do not use it in production unless correctness of generated code is verified with extensive tests."
|
||||
));
|
||||
Json::Value contract = getContractResult(result, "fileA", "A");
|
||||
BOOST_CHECK(contract.isObject());
|
||||
BOOST_CHECK(contract["metadata"].isString());
|
||||
|
Loading…
Reference in New Issue
Block a user