Skip to content

Commit f8291a0

Browse files
nikola-maticcameel
authored andcommitted
Introduce via-ir option for syntax tests
1 parent 56ad90e commit f8291a0

11 files changed

+16
-4
lines changed

Diff for: test/libsolidity/SyntaxTest.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ SyntaxTest::SyntaxTest(
4646
m_minSeverity(_minSeverity)
4747
{
4848
m_optimiseYul = m_reader.boolSetting("optimize-yul", true);
49+
m_viaIr = m_reader.boolSetting("via-ir", false);
4950
}
5051

5152
void SyntaxTest::setupCompiler(CompilerStack& _compiler)
@@ -58,6 +59,7 @@ void SyntaxTest::setupCompiler(CompilerStack& _compiler)
5859
OptimiserSettings::full() :
5960
OptimiserSettings::minimal()
6061
);
62+
_compiler.setViaIR(m_viaIr);
6163
_compiler.setMetadataFormat(CompilerStack::MetadataFormat::NoMetadata);
6264
_compiler.setMetadataHash(CompilerStack::MetadataHash::None);
6365
}
@@ -67,13 +69,13 @@ void SyntaxTest::parseAndAnalyze()
6769
try
6870
{
6971
runFramework(withPreamble(m_sources.sources), PipelineStage::Compilation);
70-
if (!pipelineSuccessful() && stageSuccessful(PipelineStage::Analysis) && !compiler().isExperimentalAnalysis())
72+
if (!pipelineSuccessful() && stageSuccessful(PipelineStage::Analysis))
7173
{
72-
ErrorList const& errors = compiler().errors();
73-
auto codeGeneretionErrorCount = count_if(errors.cbegin(), errors.cend(), [](auto const& error) {
74+
ErrorList const &errors = compiler().errors();
75+
auto codeGeneretionErrorCount = count_if(errors.cbegin(), errors.cend(), [](auto const &error) {
7476
return error->type() == Error::Type::CodeGenerationError;
7577
});
76-
auto errorCount = count_if(errors.cbegin(), errors.cend(), [](auto const& error) {
78+
auto errorCount = count_if(errors.cbegin(), errors.cend(), [](auto const &error) {
7779
return Error::isError(error->type());
7880
});
7981
// failing compilation after successful analysis is a rare case,

Diff for: test/libsolidity/SyntaxTest.h

+1
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+
bool m_viaIr{};
5657
langutil::Error::Severity m_minSeverity{};
5758
};
5859

Diff for: test/libsolidity/syntaxTests/experimental/builtin/builtin_type_definition.sol

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ contract C {
3131
}
3232
// ====
3333
// EVMVersion: >=constantinople
34+
// via-ir: true
3435
// ----
3536
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
3637
// Info 4164: (31-61): Inferred type: void

Diff for: test/libsolidity/syntaxTests/experimental/builtin/builtin_type_definition_duplicate.sol

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ type fun1(T, U) = __builtin("fun");
1010
type fun2(T, U) = __builtin("fun");
1111
// ====
1212
// EVMVersion: >=constantinople
13+
// via-ir: true
1314
// ----
1415
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
1516
// TypeError 9609: (63-94): Duplicate builtin type definition.

Diff for: test/libsolidity/syntaxTests/experimental/builtin/builtin_type_definition_unknown.sol

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pragma experimental solidity;
33
type someUnknownType = __builtin("someUnknownType");
44
// ====
55
// EVMVersion: >=constantinople
6+
// via-ir: true
67
// ----
78
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
89
// TypeError 7758: (31-81): Expected the name of a built-in primitive type.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
pragma experimental solidity;
22
// ====
33
// EVMVersion: >=constantinople
4+
// via-ir: true
45
// ----
56
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.

Diff for: test/libsolidity/syntaxTests/experimental/import/parsing_stdlib_import_1.sol

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pragma experimental solidity;
33
import std.stub;
44
// ====
55
// EVMVersion: >=constantinople
6+
// via-ir: 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.

Diff for: test/libsolidity/syntaxTests/experimental/import/parsing_stdlib_import_2.sol

+1
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+
// via-ir: 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.

Diff for: test/libsolidity/syntaxTests/experimental/import/parsing_stdlib_import_3.sol

+1
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+
// via-ir: 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.

Diff for: test/libsolidity/syntaxTests/experimental/import/parsing_stdlib_import_4.sol

+1
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+
// via-ir: 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.

Diff for: test/libsolidity/syntaxTests/experimental/inference/import_and_call_stdlib_function.sol

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ contract C
1212

1313
// ====
1414
// EVMVersion: >=constantinople
15+
// via-ir: true
1516
// ----
1617
// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments.
1718
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.

0 commit comments

Comments
 (0)