Add PreInc
This commit is contained in:
parent
bc1e2a2b21
commit
21e37cd4f2
1 changed files with 12 additions and 0 deletions
|
|
@ -832,6 +832,18 @@ impl TypeChecker {
|
|||
}
|
||||
}
|
||||
}
|
||||
UnOp::PreInc => {
|
||||
if !matches!(typed_inner.ty, Type::Int | Type::Float) {
|
||||
return Err(TypeError {
|
||||
kind: TypeErrorKind::TypeMismatch(
|
||||
Type::Int,
|
||||
typed_inner.ty.clone(),
|
||||
),
|
||||
span: inner.span.clone(),
|
||||
});
|
||||
}
|
||||
typed_inner.ty.clone()
|
||||
}
|
||||
};
|
||||
(
|
||||
TypedExprKind::UnOp(op.clone(), Box::new(typed_inner)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue