Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move around tests #14524

Merged
merged 2 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libsolidity/experimental/analysis/TypeInference.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class TypeInference: public ASTConstVisitor
bool visit(SourceUnit const&) override { return true; }
bool visit(ContractDefinition const&) override { return true; }
bool visit(InlineAssembly const& _inlineAssembly) override;
bool visit(ImportDirective const&) override { return true; }
bool visit(PragmaDirective const&) override { return false; }

bool visit(IfStatement const&) override { return true; }
Expand Down
7 changes: 7 additions & 0 deletions libsolidity/interface/CompilerStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,13 @@ class CompilerStack: public langutil::CharStreamProvider
/// @returns false on error.
bool compile(State _stopAfter = State::CompilationSuccessful);

/// Checks whether experimental analysis is on; used in SyntaxTests to skip compilation in case it's ``true``.
/// @returns true if experimental analysis is set
bool isExperimentalAnalysis() const
{
return !!m_experimentalAnalysis;
}

/// @returns the list of sources (paths) used
std::vector<std::string> sourceNames() const;

Expand Down
10 changes: 9 additions & 1 deletion scripts/ASTImportTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,15 @@ esac
# boost_filesystem_bug specifically tests a local fix for a boost::filesystem
# bug. Since the test involves a malformed path, there is no point in running
# tests on it. See https://github.com/boostorg/filesystem/issues/176
IMPORT_TEST_FILES=$(find "${TEST_DIRS[@]}" -name "*.sol" -and -not -name "boost_filesystem_bug.sol" -not -path "*/experimental/*")
# In addition, exclude all experimental Solidity tests (new type inference system)
EXCLUDE_FILES=(
boost_filesystem_bug.sol
pragma_experimental_solidity.sol
)
IMPORT_TEST_FILES=$(find "${TEST_DIRS[@]}" -name "*.sol" -and $(printf "! -name %s " ${EXCLUDE_FILES[@]}) -not -path "*/experimental/*")

echo $IMPORT_TEST_FILES
exit

NSOURCES="$(echo "${IMPORT_TEST_FILES}" | wc -l)"
echo "Looking at ${NSOURCES} .sol files..."
Expand Down
2 changes: 1 addition & 1 deletion test/libsolidity/SyntaxTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void SyntaxTest::parseAndAnalyze()
{
setupCompiler();

if (compiler().parse() && compiler().analyze())
if (compiler().parse() && compiler().analyze() && !compiler().isExperimentalAnalysis())
try
{
if (!compiler().compile())
Expand Down
2 changes: 2 additions & 0 deletions test/libsolidity/semanticTests/experimental/stub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ contract C {
}
}
// ====
// EVMVersion: >=constantinople
// ====
// compileViaYul: true
// ----
// (): 0 -> 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ import std.stub;
// ----
// 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.
// Info 4164: (std.stub:94-117): Inferred type: () -> ()
// Info 4164: (std.stub:111-113): Inferred type: ()
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ import std.stub as stub;
// ----
// 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.
// Info 4164: (std.stub:94-117): Inferred type: () -> ()
// Info 4164: (std.stub:111-113): Inferred type: ()
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ import { identity } from std.stub;
// ----
// 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.
// Info 4164: (std.stub:94-117): Inferred type: () -> ()
// Info 4164: (std.stub:111-113): Inferred type: ()
// Info 4164: (40-48): Inferred type: () -> ()
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ import * as stub from std.stub;
// ----
// 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.
// Info 4164: (std.stub:94-117): Inferred type: () -> ()
// Info 4164: (std.stub:111-113): Inferred type: ()
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
pragma experimental solidity;

import { identity as id } from std.stub;

contract C
{
fallback() external
{
id();
}
}

// ====
// EVMVersion: >=constantinople
// ----
// 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.
// Info 4164: (std.stub:94-117): Inferred type: () -> ()
// Info 4164: (std.stub:111-113): Inferred type: ()
// Info 4164: (40-48): Inferred type: () -> ()
// Info 4164: (90-135): Inferred type: () -> ()
// Info 4164: (98-100): Inferred type: ()
// Info 4164: (124-128): Inferred type: ()
// Info 4164: (124-126): Inferred type: () -> ()
2 changes: 1 addition & 1 deletion test/stopAfterParseTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ while read -r file; do
echo "$file"
exit 1
fi
done < <(find "${REPO_ROOT}/test" -iname "*.sol" -and -not -name "documentation.sol" -and -not -name "boost_filesystem_bug.sol")
done < <(find "${REPO_ROOT}/test" -iname "*.sol" -and -not -name "documentation.sol" -and -not -name "boost_filesystem_bug.sol" -not -path "*/experimental/*")
echo