diff --git a/test/libsolidity/SemanticTest.cpp b/test/libsolidity/SemanticTest.cpp index 3ad191cee..785a32fdc 100644 --- a/test/libsolidity/SemanticTest.cpp +++ b/test/libsolidity/SemanticTest.cpp @@ -386,10 +386,7 @@ TestCase::TestResult SemanticTest::runTest( // For convenience, in semantic tests we assume that an unqualified name like `L` is equivalent to one // with an empty source unit name (`:L`). This is fine because the compiler never uses unqualified // names in the Yul code it produces and does not allow `linkersymbol()` at all in inline assembly. - if (test.call().signature.find(':') == string::npos) - libraries[":" + test.call().signature] = m_contractAddress; - else - libraries[test.call().signature] = m_contractAddress; + libraries[test.call().libraryFile + ":" + test.call().signature] = m_contractAddress; continue; } else diff --git a/test/libsolidity/util/SoltestTypes.h b/test/libsolidity/util/SoltestTypes.h index bd954f042..b5b746e32 100644 --- a/test/libsolidity/util/SoltestTypes.h +++ b/test/libsolidity/util/SoltestTypes.h @@ -268,6 +268,7 @@ struct FunctionValue struct FunctionCall { /// Signature of the function call, e.g. `f(uint256, uint256)`. + /// For a library deployment, this contains the library name. std::string signature; /// Optional value that can be sent with the call. /// Value is expressed in wei, smallest unit of ether @@ -313,6 +314,8 @@ struct FunctionCall std::vector expectedSideEffects{}; /// A textual representation of the actual side-effect of the function call. std::vector actualSideEffects{}; + /// File name of the library. Always empty, unless this is a library deployment call. + std::string libraryFile{}; }; using Builtin = std::function(FunctionCall const&)>; diff --git a/test/libsolidity/util/TestFileParser.cpp b/test/libsolidity/util/TestFileParser.cpp index 11cfdbb86..4ad0701e4 100644 --- a/test/libsolidity/util/TestFileParser.cpp +++ b/test/libsolidity/util/TestFileParser.cpp @@ -107,15 +107,15 @@ vector TestFileParser::parseFunctionCall string libraryName; if (accept(Token::String)) { - libraryName = m_scanner.currentLiteral(); + call.libraryFile = m_scanner.currentLiteral(); expect(Token::String); expect(Token::Colon); - libraryName += ':' + m_scanner.currentLiteral(); + libraryName += m_scanner.currentLiteral(); expect(Token::Identifier); } else if (accept(Token::Colon, true)) { - libraryName = ':' + m_scanner.currentLiteral(); + libraryName = m_scanner.currentLiteral(); expect(Token::Identifier); } else diff --git a/test/libsolidity/util/TestFunctionCall.cpp b/test/libsolidity/util/TestFunctionCall.cpp index c51dbec97..7531d8ce5 100644 --- a/test/libsolidity/util/TestFunctionCall.cpp +++ b/test/libsolidity/util/TestFunctionCall.cpp @@ -58,7 +58,10 @@ string TestFunctionCall::format( if (m_call.kind == FunctionCall::Kind::Library) { - stream << _linePrefix << newline << ws << "library:" << ws << m_call.signature; + stream << _linePrefix << newline << ws << "library:" << ws; + if (!m_call.libraryFile.empty()) + stream << "\"" << m_call.libraryFile << "\":"; + stream << m_call.signature; return; }