Extend type(X) validation to support structs

This commit is contained in:
Anton Bukov 2023-05-06 23:53:57 +03:00
parent 66c54ef128
commit e8a311268d
2 changed files with 3 additions and 1 deletions

View File

@ -316,6 +316,7 @@ TypePointers TypeChecker::typeCheckMetaTypeFunctionAndRetrieveReturnType(Functio
wrongType = contractType->isSuper();
else if (
typeCategory != Type::Category::Integer &&
typeCategory != Type::Category::Struct &&
typeCategory != Type::Category::Enum
)
wrongType = true;

View File

@ -563,10 +563,11 @@ MagicType const* TypeProvider::meta(Type const* _type)
solAssert(
_type && (
_type->category() == Type::Category::Contract ||
_type->category() == Type::Category::Struct ||
_type->category() == Type::Category::Integer ||
_type->category() == Type::Category::Enum
),
"Only enum, contracts or integer types supported for now."
"Only enum, contract, struct or integer types supported for now."
);
return createAndGet<MagicType>(_type);
}