Skip to content

Commit d569f78

Browse files
committed
wip
1 parent f593c29 commit d569f78

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

libsolidity/analysis/TypeChecker.cpp

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2659,12 +2659,7 @@ void TypeChecker::endVisit(NewExpression const& _newExpression)
26592659
"Linearized base contracts not yet available."
26602660
);
26612661

2662-
if (!addContractDependency(*currentContractDependencies(), contract))
2663-
m_errorReporter.typeError(
2664-
4579_error,
2665-
_newExpression.location(),
2666-
"Circular reference for contract creation (cannot create instance of derived or same contract)."
2667-
);
2662+
currentContractDependencies()->contractDependencies.insert(contract);
26682663
}
26692664

26702665
_newExpression.annotation().type = FunctionType::newExpressionType(*contract);
@@ -2950,11 +2945,8 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
29502945
"\"runtimeCode\" is not available for contracts containing immutable variables."
29512946
);
29522947

2953-
if (
2954-
(m_currentContract || m_currentFreeFunction) &&
2955-
!addContractDependency(*currentContractDependencies(), &accessedContractType.contractDefinition())
2956-
)
2957-
triggerCircularError();
2948+
if (m_currentContract || m_currentFreeFunction)
2949+
currentContractDependencies()->contractDependencies.insert(&accessedContractType.contractDefinition());
29582950
}
29592951
else if (magicType->kind() == MagicType::Kind::MetaType && memberName == "name")
29602952
annotation.isPure = true;
@@ -2975,12 +2967,8 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
29752967
else if (m_currentContract || m_currentFreeFunction)
29762968
if (auto typeType = dynamic_cast<TypeType const*>(exprType))
29772969
if (auto contractType = dynamic_cast<ContractType const*>(typeType->actualType()))
2978-
if (
2979-
&contractType->contractDefinition() != m_currentContract &&
2980-
!addContractDependency(*currentContractDependencies(), &contractType->contractDefinition())
2981-
)
2982-
triggerCircularError();
2983-
2970+
if (&contractType->contractDefinition() != m_currentContract)
2971+
currentContractDependencies()->contractDependencies.insert(&contractType->contractDefinition());
29842972

29852973
if (
29862974
_memberAccess.expression().annotation().type->category() == Type::Category::Address &&

0 commit comments

Comments
 (0)