mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-09-19 01:37:34 +03:00
Fix bug
This commit is contained in:
parent
d2b84e501f
commit
fd22fb9ec4
@ -321,12 +321,11 @@ impl<'a> TypeChecker<'a> {
|
||||
|
||||
/// Returns the `struct` type and emits an error if the `expected` type does not match.
|
||||
pub(crate) fn check_expected_struct(&mut self, struct_: Identifier, expected: &Option<Type>, span: Span) -> Type {
|
||||
if let Some(Type::Identifier(expected)) = expected {
|
||||
if !struct_.matches(expected) {
|
||||
self.emit_err(TypeCheckerError::type_should_be(struct_.name, expected.name, span));
|
||||
if let Some(expected) = expected {
|
||||
if !Type::Identifier(struct_).eq_flat(expected) {
|
||||
self.emit_err(TypeCheckerError::type_should_be(struct_.name, expected, span));
|
||||
}
|
||||
}
|
||||
|
||||
Type::Identifier(struct_)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user