@@ -2659,12 +2659,7 @@ void TypeChecker::endVisit(NewExpression const& _newExpression)
2659
2659
" Linearized base contracts not yet available."
2660
2660
);
2661
2661
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);
2668
2663
}
2669
2664
2670
2665
_newExpression.annotation ().type = FunctionType::newExpressionType (*contract);
@@ -2950,11 +2945,8 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
2950
2945
" \" runtimeCode\" is not available for contracts containing immutable variables."
2951
2946
);
2952
2947
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 ());
2958
2950
}
2959
2951
else if (magicType->kind () == MagicType::Kind::MetaType && memberName == " name" )
2960
2952
annotation.isPure = true ;
@@ -2975,12 +2967,8 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
2975
2967
else if (m_currentContract || m_currentFreeFunction)
2976
2968
if (auto typeType = dynamic_cast <TypeType const *>(exprType))
2977
2969
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 ());
2984
2972
2985
2973
if (
2986
2974
_memberAccess.expression ().annotation ().type ->category () == Type::Category::Address &&
0 commit comments