summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/typst/src/eval/ops.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/typst/src/eval/ops.rs b/crates/typst/src/eval/ops.rs
index 4a64cfed..093eaa5f 100644
--- a/crates/typst/src/eval/ops.rs
+++ b/crates/typst/src/eval/ops.rs
@@ -52,6 +52,16 @@ pub fn pos(value: Value) -> StrResult<Value> {
Ratio(v) => Ratio(v),
Relative(v) => Relative(v),
Fraction(v) => Fraction(v),
+ Symbol(_) | Str(_) | Bytes(_) | Content(_) | Array(_) | Dict(_) | Datetime(_) => {
+ mismatch!("cannot apply unary '+' to {}", value)
+ }
+ Dyn(d) => {
+ if d.is::<Align>() {
+ mismatch!("cannot apply unary '+' to {}", d)
+ } else {
+ mismatch!("cannot apply '+' to {}", d)
+ }
+ }
v => mismatch!("cannot apply '+' to {}", v),
})
}
@@ -67,6 +77,7 @@ pub fn neg(value: Value) -> StrResult<Value> {
Relative(v) => Relative(-v),
Fraction(v) => Fraction(-v),
Duration(v) => Duration(-v),
+ Datetime(_) => mismatch!("cannot apply unary '-' to {}", value),
v => mismatch!("cannot apply '-' to {}", v),
})
}