Skip to content

Commit e98f174

Browse files
authored
Merge pull request #14599 from ethereum/introduce-via-ir-syntax-test-option
Introduce ``compileViaYul`` syntax test option
2 parents 3dab116 + 211cd24 commit e98f174

File tree

6 files changed

+11
-0
lines changed

6 files changed

+11
-0
lines changed

test/libsolidity/SyntaxTest.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ SyntaxTest::SyntaxTest(
4545
CommonSyntaxTest(_filename, _evmVersion),
4646
m_minSeverity(_minSeverity)
4747
{
48+
static std::set<std::string> const compileViaYulAllowedValues{"true", "false"};
49+
50+
m_compileViaYul = m_reader.stringSetting("compileViaYul", "false");
51+
if (!util::contains(compileViaYulAllowedValues, m_compileViaYul))
52+
BOOST_THROW_EXCEPTION(std::runtime_error("Invalid compileViaYul value: " + m_compileViaYul + "."));
4853
m_optimiseYul = m_reader.boolSetting("optimize-yul", true);
4954
}
5055

@@ -58,6 +63,7 @@ void SyntaxTest::setupCompiler(CompilerStack& _compiler)
5863
OptimiserSettings::full() :
5964
OptimiserSettings::minimal()
6065
);
66+
_compiler.setViaIR(m_compileViaYul == "true");
6167
_compiler.setMetadataFormat(CompilerStack::MetadataFormat::NoMetadata);
6268
_compiler.setMetadataHash(CompilerStack::MetadataHash::None);
6369
}

test/libsolidity/SyntaxTest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class SyntaxTest: public AnalysisFramework, public solidity::test::CommonSyntaxT
5353
virtual void filterObtainedErrors();
5454

5555
bool m_optimiseYul{};
56+
std::string m_compileViaYul{};
5657
langutil::Error::Severity m_minSeverity{};
5758
};
5859

test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_1.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pragma experimental solidity;
33
import std.stub;
44
// ====
55
// EVMVersion: >=constantinople
6+
// compileViaYul: true
67
// ----
78
// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments.
89
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.

test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_2.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pragma experimental solidity;
33
import std.stub as stub;
44
// ====
55
// EVMVersion: >=constantinople
6+
// compileViaYul: true
67
// ----
78
// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments.
89
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.

test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_3.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pragma experimental solidity;
33
import { identity } from std.stub;
44
// ====
55
// EVMVersion: >=constantinople
6+
// compileViaYul: true
67
// ----
78
// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments.
89
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.

test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_4.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pragma experimental solidity;
33
import * as stub from std.stub;
44
// ====
55
// EVMVersion: >=constantinople
6+
// compileViaYul: true
67
// ----
78
// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments.
89
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.

0 commit comments

Comments
 (0)