Skip to content

Commit

Permalink
Introduce via-ir option for syntax tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nikola-matic committed Oct 10, 2023
1 parent 2d65092 commit d7d4de0
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/libsolidity/SyntaxTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ SyntaxTest::SyntaxTest(
m_minSeverity(_minSeverity)
{
m_optimiseYul = m_reader.boolSetting("optimize-yul", true);
m_viaIr = m_reader.boolSetting("via-ir", false);
}

void SyntaxTest::setupCompiler(CompilerStack& _compiler)
Expand All @@ -58,6 +59,7 @@ void SyntaxTest::setupCompiler(CompilerStack& _compiler)
OptimiserSettings::full() :
OptimiserSettings::minimal()
);
_compiler.setViaIR(m_viaIr);
_compiler.setMetadataFormat(CompilerStack::MetadataFormat::NoMetadata);
_compiler.setMetadataHash(CompilerStack::MetadataHash::None);
}
Expand All @@ -67,13 +69,13 @@ void SyntaxTest::parseAndAnalyze()
try
{
runFramework(withPreamble(m_sources.sources), PipelineStage::Compilation);
if (!pipelineSuccessful() && stageSuccessful(PipelineStage::Analysis) && !compiler().isExperimentalAnalysis())
if (!pipelineSuccessful() && stageSuccessful(PipelineStage::Analysis))
{
ErrorList const& errors = compiler().errors();
auto codeGeneretionErrorCount = count_if(errors.cbegin(), errors.cend(), [](auto const& error) {
ErrorList const &errors = compiler().errors();
auto codeGeneretionErrorCount = count_if(errors.cbegin(), errors.cend(), [](auto const &error) {
return error->type() == Error::Type::CodeGenerationError;
});
auto errorCount = count_if(errors.cbegin(), errors.cend(), [](auto const& error) {
auto errorCount = count_if(errors.cbegin(), errors.cend(), [](auto const &error) {
return Error::isError(error->type());
});
// failing compilation after successful analysis is a rare case,
Expand Down
1 change: 1 addition & 0 deletions test/libsolidity/SyntaxTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class SyntaxTest: public AnalysisFramework, public solidity::test::CommonSyntaxT
virtual void filterObtainedErrors();

bool m_optimiseYul{};
bool m_viaIr{};
langutil::Error::Severity m_minSeverity{};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ contract C {
}
// ====
// EVMVersion: >=constantinople
// via-ir: true
// ----
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
// Info 4164: (31-61): Inferred type: void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type fun1(T, U) = __builtin("fun");
type fun2(T, U) = __builtin("fun");
// ====
// EVMVersion: >=constantinople
// via-ir: true
// ----
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError 9609: (63-94): Duplicate builtin type definition.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma experimental solidity;
type someUnknownType = __builtin("someUnknownType");
// ====
// EVMVersion: >=constantinople
// via-ir: true
// ----
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError 7758: (31-81): Expected the name of a built-in primitive type.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pragma experimental solidity;
// ====
// EVMVersion: >=constantinople
// via-ir: true
// ----
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma experimental solidity;
import std.stub;
// ====
// EVMVersion: >=constantinople
// via-ir: true
// ----
// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma experimental solidity;
import std.stub as stub;
// ====
// EVMVersion: >=constantinople
// via-ir: true
// ----
// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma experimental solidity;
import { identity } from std.stub;
// ====
// EVMVersion: >=constantinople
// via-ir: true
// ----
// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma experimental solidity;
import * as stub from std.stub;
// ====
// EVMVersion: >=constantinople
// via-ir: true
// ----
// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ contract C

// ====
// EVMVersion: >=constantinople
// via-ir: true
// ----
// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments.
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
Expand Down

0 comments on commit d7d4de0

Please sign in to comment.