You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an incorrect repetition depth is used within a definition macro or an expression macro, Racket and DrRacket don't trace the error to the correct line.
In the following Rhombus code, x is used with the wrong repetition depth:
And Racket throws an error that correctly traces the wrong repetition depth to the correct line:
example.rhm:5:1: x: used with wrong repetition depth
in: x
expected: 2
actual: 1
#(73 1)
However, if an incorrect repetition depth is used with a definition or expression macro (shown here as a definition macro but switching defn.macro to expr.macro gives the same error message), as in this code where a.var is used with the wrong depth:
The error message traces the wrong usage to a Racket file in the Rhombus source instead of the line in the macro where the wrong repetition depth is used:
Library/Racket/8.13/pkgs/rhombus-lib/rhombus/private/amalgam/pattern-variable.rkt:112:64: a: used with wrong repetition depth
in: a.var
expected: 2
actual: 1
Ideally, the error message should trace the error back to line 8 in this file, instead of to a Racket file in the Rhombus source.
The text was updated successfully, but these errors were encountered:
This is a problem specifically with pattern variables, which handle repetitions in a unique way (related: #534). For example, the following program can reproduce the same unhelpful error message:
#lang rhombus
match '[a, b, c]'
| '[$(pattern a
| '$variable':
field [var, ...] = [variable]),
...]':
[[a.var, ...]]
In fact, the source location points to the repetition handler in pattern variables.
usaoc
changed the title
Unhelpful error message when wrong repetition depth used in macro
Unhelpful error message when nested attributes are used with wrong repetition depth
Aug 9, 2024
When an incorrect repetition depth is used within a definition macro or an expression macro, Racket and DrRacket don't trace the error to the correct line.
In the following Rhombus code,
x
is used with the wrong repetition depth:And Racket throws an error that correctly traces the wrong repetition depth to the correct line:
However, if an incorrect repetition depth is used with a definition or expression macro (shown here as a definition macro but switching
defn.macro
toexpr.macro
gives the same error message), as in this code wherea.var
is used with the wrong depth:The error message traces the wrong usage to a Racket file in the Rhombus source instead of the line in the macro where the wrong repetition depth is used:
Ideally, the error message should trace the error back to line 8 in this file, instead of to a Racket file in the Rhombus source.
The text was updated successfully, but these errors were encountered: