Resolve NaN todo!()
s for addition and subtraction with other numbers (#40)
* Replace todo's for propagating NaN * Propagate NaN for remainder as well
This commit is contained in:
parent
8e060950d5
commit
7539762a0c
@ -317,9 +317,9 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
|
||||
format!("-{}", right.to_css_string(self.span)?),
|
||||
QuoteKind::None,
|
||||
),
|
||||
Value::Dimension(None, ..) => todo!(),
|
||||
v @ Value::Dimension(None, ..) => v,
|
||||
Value::Dimension(Some(num), unit, _) => match right {
|
||||
Value::Dimension(None, ..) => todo!(),
|
||||
v @ Value::Dimension(None, ..) => v,
|
||||
Value::Dimension(Some(num2), unit2, _) => {
|
||||
if !unit.comparable(&unit2) {
|
||||
return Err((
|
||||
@ -643,9 +643,9 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
|
||||
v => panic!("{:?}", v),
|
||||
};
|
||||
Ok(match left {
|
||||
Value::Dimension(None, ..) => todo!(),
|
||||
v @ Value::Dimension(None, ..) => v,
|
||||
Value::Dimension(Some(n), u, _) => match right {
|
||||
Value::Dimension(None, ..) => todo!(),
|
||||
v @ Value::Dimension(None, ..) => v,
|
||||
Value::Dimension(Some(n2), u2, _) => {
|
||||
if !u.comparable(&u2) {
|
||||
return Err(
|
||||
|
@ -282,6 +282,16 @@ test!(
|
||||
"a {\n color: foo - red;\n}\n",
|
||||
"a {\n color: foo-red;\n}\n"
|
||||
);
|
||||
test!(
|
||||
sub_nan_left,
|
||||
"a {\n left:0/0-0;\n}\n",
|
||||
"a {\n left: NaN;\n}\n"
|
||||
);
|
||||
test!(
|
||||
sub_nan_right,
|
||||
"a {\n left:0-0/0;\n}\n",
|
||||
"a {\n left: NaN;\n}\n"
|
||||
);
|
||||
error!(
|
||||
number_minus_color,
|
||||
"a {\n color: 1 - #abc;\n}\n", "Error: Undefined operation \"1 - #abc\"."
|
||||
|
Loading…
x
Reference in New Issue
Block a user