Add PreInc

This commit is contained in:
flameyosflow 2025-12-16 12:12:08 +02:00
commit 21e37cd4f2

View file

@ -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)),