Skip to content

Commit 7fcdd3b

Browse files
committed
Merge pull request #14660 from ethereum/new-analysis-patch-codegen-issues-to-make-tests-pass
Patch codegen issues enough to make tests pass in experimental analysis
2 parents 9befcb8 + 4ad35e3 commit 7fcdd3b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Diff for: libsolidity/experimental/codegen/IRGeneratorForStatements.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ bool IRGeneratorForStatements::visit(ElementaryTypeNameExpression const&)
299299
void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
300300
{
301301
Type functionType = type(_functionCall.expression());
302+
solUnimplementedAssert(m_expressionDeclaration.count(&_functionCall.expression()) != 0, "No support for calling functions pointers yet.");
302303
auto declaration = m_expressionDeclaration.at(&_functionCall.expression());
303304
if (auto builtin = std::get_if<Builtins>(&declaration))
304305
{
@@ -322,7 +323,10 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
322323
functionType = m_context.env->resolveRecursive(functionType);
323324
m_context.enqueueFunctionDefinition(functionDefinition, functionType);
324325
// TODO: account for return stack size
325-
m_code << "let " << IRNames::localVariable(_functionCall) << " := " << IRNames::function(*m_context.env, *functionDefinition, functionType) << "(";
326+
solAssert(!functionDefinition->returnParameterList());
327+
if (functionDefinition->experimentalReturnExpression())
328+
m_code << "let " << IRNames::localVariable(_functionCall) << " := ";
329+
m_code << IRNames::function(*m_context.env, *functionDefinition, functionType) << "(";
326330
auto const& arguments = _functionCall.arguments();
327331
if (arguments.size() > 1)
328332
for (auto arg: arguments | ranges::views::drop_last(1))

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

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ contract C {
3333
// EVMVersion: >=constantinople
3434
// compileViaYul: true
3535
// ----
36+
// UnimplementedFeatureError: No support for calling functions pointers yet.
3637
// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments.
3738
// Info 4164: (31-61): Inferred type: void
3839
// Info 4164: (63-93): Inferred type: bool

0 commit comments

Comments
 (0)