mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
fixup! Type inference draft.
This commit is contained in:
parent
6621dc6ba5
commit
1ffd65f089
@ -839,7 +839,7 @@ bool TypeInference::visit(TypeDefinition const& _typeDefinition)
|
|||||||
|
|
||||||
TypeConstructor constructor = typeConstructor(&_typeDefinition);
|
TypeConstructor constructor = typeConstructor(&_typeDefinition);
|
||||||
auto [members, newlyInserted] = annotation().members.emplace(constructor, std::map<std::string, TypeMember>{});
|
auto [members, newlyInserted] = annotation().members.emplace(constructor, std::map<std::string, TypeMember>{});
|
||||||
solAssert(newlyInserted);
|
solAssert(newlyInserted, fmt::format("Members of type '{}' are already defined.", m_typeSystem.constructorInfo(constructor).name));
|
||||||
if (underlyingType)
|
if (underlyingType)
|
||||||
{
|
{
|
||||||
members->second.emplace("abs", TypeMember{helper.functionType(*underlyingType, definedType)});
|
members->second.emplace("abs", TypeMember{helper.functionType(*underlyingType, definedType)});
|
||||||
|
@ -297,7 +297,10 @@ experimental::Type TypeSystem::type(TypeConstructor _constructor, std::vector<Ty
|
|||||||
{
|
{
|
||||||
// TODO: proper error handling
|
// TODO: proper error handling
|
||||||
auto const& info = m_typeConstructors.at(_constructor.m_index);
|
auto const& info = m_typeConstructors.at(_constructor.m_index);
|
||||||
solAssert(info.arguments() == _arguments.size(), "Invalid arity.");
|
solAssert(
|
||||||
|
info.arguments() == _arguments.size(),
|
||||||
|
fmt::format("Type constructor '{}' accepts {} type arguments (got {}).", constructorInfo(_constructor).name, info.arguments(), _arguments.size())
|
||||||
|
);
|
||||||
return TypeConstant{_constructor, _arguments};
|
return TypeConstant{_constructor, _arguments};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user