mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'origin/develop' into breaking
This commit is contained in:
+25
-15
@@ -254,26 +254,37 @@ printTask "Running general commandline tests..."
|
||||
cd "$REPO_ROOT"/test/cmdlineTests/
|
||||
for tdir in */
|
||||
do
|
||||
if [ -e "${tdir}/input.json" ]
|
||||
printTask " - ${tdir}"
|
||||
|
||||
# Strip trailing slash from $tdir. `find` on MacOS X won't strip it and will produce double slashes.
|
||||
tdir=$(basename "${tdir}")
|
||||
|
||||
inputFiles="$(find "${tdir}" -name 'input.*' -type f -exec printf "%s\n" "{}" \;)"
|
||||
inputCount="$(echo "${inputFiles}" | wc -l)"
|
||||
if (( ${inputCount} == 0 ))
|
||||
then
|
||||
printError "No input files found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if (( ${inputCount} > 1 ))
|
||||
then
|
||||
printError "Ambiguous input. Found input files in multiple formats:"
|
||||
echo -e "${inputFiles}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Use printf to get rid of the trailing newline
|
||||
inputFile=$(printf "%s" "${inputFiles}")
|
||||
|
||||
if [ "${inputFile}" = "${tdir}/input.json" ]
|
||||
then
|
||||
stdin="${inputFile}"
|
||||
inputFile=""
|
||||
stdin="${tdir}/input.json"
|
||||
stdout="$(cat ${tdir}/output.json 2>/dev/null || true)"
|
||||
stdoutExpectationFile="${tdir}/output.json"
|
||||
args="--standard-json "$(cat ${tdir}/args 2>/dev/null || true)
|
||||
else
|
||||
if [[ -e "${tdir}input.yul" && -e "${tdir}input.sol" ]]
|
||||
then
|
||||
printError "Ambiguous input. Found both input.sol and input.yul."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -e "${tdir}input.yul" ]
|
||||
then
|
||||
inputFile="${tdir}input.yul"
|
||||
else
|
||||
inputFile="${tdir}input.sol"
|
||||
fi
|
||||
stdin=""
|
||||
stdout="$(cat ${tdir}/output 2>/dev/null || true)"
|
||||
stdoutExpectationFile="${tdir}/output"
|
||||
@@ -282,7 +293,6 @@ printTask "Running general commandline tests..."
|
||||
exitCode=$(cat ${tdir}/exit 2>/dev/null || true)
|
||||
err="$(cat ${tdir}/err 2>/dev/null || true)"
|
||||
stderrExpectationFile="${tdir}/err"
|
||||
printTask " - ${tdir}"
|
||||
test_solc_behaviour "$inputFile" \
|
||||
"$args" \
|
||||
"$stdin" \
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
--standard-json
|
||||
@@ -0,0 +1 @@
|
||||
File not found: standard_file_not_found/input.sol
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -2,7 +2,7 @@
|
||||
"language": "Solidity",
|
||||
"sources": {
|
||||
"a.sol": {
|
||||
"content": "// SPDX-License-Identifier: GPL-3.0\ncontract A { uint256 immutable x = 1; function f() public view returns (uint256) { return x; } }"
|
||||
"content": "// SPDX-License-Identifier: GPL-3.0\ncontract A { uint256 immutable x = 1 + 3; function f() public pure returns (uint256) { return x; } }"
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
{"contracts":{"a.sol":{"A":{"evm":{"deployedBytecode":{"generatedSources":[],"immutableReferences":{"3":[{"length":32,"start":77}]},"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"36:96:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;74:56;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;108:7;126:1;119:8;;74:56;:::o"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version!
|
||||
{"contracts":{"a.sol":{"A":{"evm":{"deployedBytecode":{"generatedSources":[],"immutableReferences":{"5":[{"length":32,"start":77}]},"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"36:100:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;78:56;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;112:7;130:1;123:8;;78:56;:::o"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version!
|
||||
","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"}],"sources":{"a.sol":{"id":0}}}
|
||||
|
||||
+1
-1
@@ -15,6 +15,6 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint32, (uint128, uint256[][2], uint32)): 55, 0x40, 77, 0x60, 88, 0x40, 0x40, 2, 1, 2 -> 55, 77, 1, 2, 88
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
contract C {
|
||||
uint immutable x = 1;
|
||||
|
||||
function readX() internal view returns(uint) {
|
||||
function readX() internal pure returns(uint) {
|
||||
return x + 3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,3 @@ contract B {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2527: (100-101): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
|
||||
+12
-1
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include <libsolutil/CommonIO.h>
|
||||
#include <libsolutil/Exceptions.h>
|
||||
#include <liblangutil/ErrorReporter.h>
|
||||
#include <liblangutil/Scanner.h>
|
||||
#include <libyul/AsmAnalysis.h>
|
||||
@@ -243,8 +244,18 @@ Allowed options)",
|
||||
}
|
||||
|
||||
string input;
|
||||
try
|
||||
{
|
||||
input = readFileAsString(arguments["input-file"].as<string>());
|
||||
}
|
||||
catch (FileNotFound const& _exception)
|
||||
{
|
||||
cerr << "File not found:" << _exception.comment() << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (arguments.count("input-file"))
|
||||
YulOpti{}.runInteractive(readFileAsString(arguments["input-file"].as<string>()));
|
||||
YulOpti{}.runInteractive(input);
|
||||
else
|
||||
cout << options;
|
||||
|
||||
|
||||
+12
-2
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <libsolutil/CommonIO.h>
|
||||
#include <libsolutil/CommonData.h>
|
||||
#include <libsolutil/Exceptions.h>
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
@@ -137,10 +138,19 @@ Allowed options)",
|
||||
else
|
||||
{
|
||||
string input;
|
||||
|
||||
if (arguments.count("input-file"))
|
||||
for (string path: arguments["input-file"].as<vector<string>>())
|
||||
input += readFileAsString(path);
|
||||
{
|
||||
try
|
||||
{
|
||||
input += readFileAsString(path);
|
||||
}
|
||||
catch (FileNotFound const&)
|
||||
{
|
||||
cerr << "File not found: " << path << endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
input = readStandardInput();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user