kadena-io / pact-5

The New Pact
BSD 3-Clause "New" or "Revised" License
9 stars 7 forks source link

Fix location for span infos, report better error locations in repl #284

Open jmcardon opened 1 week ago

jmcardon commented 1 week ago

Closes #262

Using the example in #262:

Before this PR:

pact>(load "scratch/main-script.repl" true)
"Loading scratch/main-script.repl..."
"Loading nested-script.repl..."
Loaded repl defun just-fail
scratch/main-script.repl:12:2: We fail
 12 | ; Hello
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^
  at (#repl.just-fail.{I3JlcGw})

After this PR:

pact>(load "scratch/main-script.repl" true)
"Loading scratch/main-script.repl..."
"Loading nested-script.repl..."
Loaded repl defun just-fail
()
scratch/nested-script.repl:12:2: We fail
 12 |   (enforce false "We fail")
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^
  at(#repl.just-fail.{I3JlcGw}):scratch/main-script.repl 2:0-2:11

PR checklist:

Additionally, please justify why you should or should not do the following: