@@ -544,10 +544,10 @@ public Literal visitIntervalLiteral(IntervalLiteralContext ctx) {
544544 "Invalid interval declaration; trailing unit [{}] specified but the value is with numeric (single unit), "
545545 + "use the string notation instead" , trailing );
546546 }
547- value = of (interval .valueNumeric , negative , leading );
547+ value = of (interval .valueNumeric , leading );
548548 valueAsText = interval .valueNumeric .getText ();
549549 } else {
550- value = visitIntervalValue (interval .valuePattern , negative , intervalType );
550+ value = of (interval .valuePattern , negative , intervalType );
551551 valueAsText = interval .valuePattern .getText ();
552552 }
553553
@@ -559,8 +559,9 @@ public Literal visitIntervalLiteral(IntervalLiteralContext ctx) {
559559 return new Literal (source (ctx ), name , timeInterval , intervalType );
560560 }
561561
562- private TemporalAmount of (NumberContext valueNumeric , boolean negative , TimeUnit unit ) {
562+ private TemporalAmount of (NumberContext valueNumeric , TimeUnit unit ) {
563563 // expect numbers for now
564+ // as the number parsing handles the -, there's no need to look at that
564565 Literal value = (Literal ) visit (valueNumeric );
565566 Number numeric = (Number ) value .fold ();
566567
@@ -571,7 +572,7 @@ private TemporalAmount of(NumberContext valueNumeric, boolean negative, TimeUnit
571572 return Intervals .of (source (valueNumeric ), numeric .longValue (), unit );
572573 }
573574
574- private TemporalAmount visitIntervalValue (StringContext valuePattern , boolean negative , DataType intervalType ) {
575+ private TemporalAmount of (StringContext valuePattern , boolean negative , DataType intervalType ) {
575576 String valueString = string (valuePattern );
576577 Location loc = source (valuePattern );
577578 TemporalAmount interval = Intervals .parseInterval (loc , valueString , intervalType );
0 commit comments