From 4bb0467b6148e2cd0c90a9385323926a271f982c Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Mon, 9 Oct 2023 16:17:18 -0700 Subject: [PATCH] fixup! [const-eval] error on NaN and infinite floats --- src/proc/constant_evaluator.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/proc/constant_evaluator.rs b/src/proc/constant_evaluator.rs index c3796ccc69..61adf0fdd5 100644 --- a/src/proc/constant_evaluator.rs +++ b/src/proc/constant_evaluator.rs @@ -1158,9 +1158,11 @@ impl<'a> ConstantEvaluator<'a> { expr: Expression, span: Span, ) -> Result, ConstantEvaluatorError> { - match expr { - Expression::Literal(literal) => crate::valid::validate_literal(literal)?, - _ => {} + // It suffices to only check literals, since we only register one + // expression at a time, `Compose` expressions can only refer to other + // expressions, and `ZeroValue` expressions are always okay. + if let Expression::Literal(literal) = expr { + crate::valid::validate_literal(literal)?; } if let Some(FunctionLocalData {