Equality operator allowed for external function types

This commit is contained in:
nishant-sachdeva
2022-01-19 15:20:31 +05:30
parent a07b3ec70f
commit a0d6c11860
11 changed files with 244 additions and 12 deletions
+11 -1
View File
@@ -3018,8 +3018,18 @@ TypeResult FunctionType::binaryOperatorResult(Token _operator, Type const* _othe
if (_other->category() != category() || !(_operator == Token::Equal || _operator == Token::NotEqual))
return nullptr;
FunctionType const& other = dynamic_cast<FunctionType const&>(*_other);
if (kind() == Kind::Internal && other.kind() == Kind::Internal && sizeOnStack() == 1 && other.sizeOnStack() == 1)
if (kind() == Kind::Internal && sizeOnStack() == 1 && other.kind() == Kind::Internal && other.sizeOnStack() == 1)
return commonType(this, _other);
else if (
kind() == Kind::External &&
sizeOnStack() == 2 &&
!bound() &&
other.kind() == Kind::External &&
other.sizeOnStack() == 2 &&
!other.bound()
)
return commonType(this, _other);
return nullptr;
}