Skip to content

Commit 14ef22c

Browse files
committed
Hot fix for library name updates in isoltest semantics tests.
1 parent bed4d98 commit 14ef22c

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

test/libsolidity/SemanticTest.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,7 @@ TestCase::TestResult SemanticTest::runTest(
386386
// For convenience, in semantic tests we assume that an unqualified name like `L` is equivalent to one
387387
// with an empty source unit name (`:L`). This is fine because the compiler never uses unqualified
388388
// names in the Yul code it produces and does not allow `linkersymbol()` at all in inline assembly.
389-
if (test.call().signature.find(':') == string::npos)
390-
libraries[":" + test.call().signature] = m_contractAddress;
391-
else
392-
libraries[test.call().signature] = m_contractAddress;
389+
libraries[test.call().libraryFile + ":" + test.call().signature] = m_contractAddress;
393390
continue;
394391
}
395392
else

test/libsolidity/util/SoltestTypes.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ struct FunctionValue
268268
struct FunctionCall
269269
{
270270
/// Signature of the function call, e.g. `f(uint256, uint256)`.
271+
/// For a library deployment, this contains the library name.
271272
std::string signature;
272273
/// Optional value that can be sent with the call.
273274
/// Value is expressed in wei, smallest unit of ether
@@ -313,6 +314,8 @@ struct FunctionCall
313314
std::vector<std::string> expectedSideEffects{};
314315
/// A textual representation of the actual side-effect of the function call.
315316
std::vector<std::string> actualSideEffects{};
317+
/// File name of the library. Always empty, unless this is a library deployment call.
318+
std::string libraryFile{};
316319
};
317320

318321
using Builtin = std::function<std::optional<bytes>(FunctionCall const&)>;

test/libsolidity/util/TestFileParser.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ vector<solidity::frontend::test::FunctionCall> TestFileParser::parseFunctionCall
107107
string libraryName;
108108
if (accept(Token::String))
109109
{
110-
libraryName = m_scanner.currentLiteral();
110+
call.libraryFile = m_scanner.currentLiteral();
111111
expect(Token::String);
112112
expect(Token::Colon);
113-
libraryName += ':' + m_scanner.currentLiteral();
113+
libraryName += m_scanner.currentLiteral();
114114
expect(Token::Identifier);
115115
}
116116
else if (accept(Token::Colon, true))
117117
{
118-
libraryName = ':' + m_scanner.currentLiteral();
118+
libraryName = m_scanner.currentLiteral();
119119
expect(Token::Identifier);
120120
}
121121
else

test/libsolidity/util/TestFunctionCall.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ string TestFunctionCall::format(
5858

5959
if (m_call.kind == FunctionCall::Kind::Library)
6060
{
61-
stream << _linePrefix << newline << ws << "library:" << ws << m_call.signature;
61+
stream << _linePrefix << newline << ws << "library:" << ws;
62+
if (!m_call.libraryFile.empty())
63+
stream << "\"" << m_call.libraryFile << "\":";
64+
stream << m_call.signature;
6265
return;
6366
}
6467

0 commit comments

Comments
 (0)