From e8d2deca906f971014e90e631a620c8a3eec2d15 Mon Sep 17 00:00:00 2001 From: Brendan Hansknecht Date: Sun, 3 Dec 2023 08:22:04 -0800 Subject: [PATCH] fix off by one in roc_dbg --- crates/cli/tests/cli_run.rs | 11 ++++++----- crates/cli_testing_examples/expects/expects.roc | 1 + crates/compiler/can/src/operator.rs | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/crates/cli/tests/cli_run.rs b/crates/cli/tests/cli_run.rs index 6e41b19a20..59b0b28153 100644 --- a/crates/cli/tests/cli_run.rs +++ b/crates/cli/tests/cli_run.rs @@ -562,11 +562,12 @@ mod cli_run { words : List Str words = ["this", "will", "for", "sure", "be", "a", "large", "string", "so", "when", "we", "split", "it", "it", "will", "use", "seamless", "slices", "which", "affect", "printing"] - [:21] x = 42 - [:22] "Fjoer en ferdjer frieten oan dyn geve lea" = "Fjoer en ferdjer frieten oan dyn geve lea" - [:12] x = "abc" - [:12] x = 10 - [:12] x = (A (B C)) + [:22] x = 42 + [:23] "Fjoer en ferdjer frieten oan dyn geve lea" = "Fjoer en ferdjer frieten oan dyn geve lea" + [:24] "this is line 24" = "this is line 24" + [:13] x = "abc" + [:13] x = 10 + [:13] x = (A (B C)) Program finished! "# ), diff --git a/crates/cli_testing_examples/expects/expects.roc b/crates/cli_testing_examples/expects/expects.roc index c25b73bc68..68f1a433dd 100644 --- a/crates/cli_testing_examples/expects/expects.roc +++ b/crates/cli_testing_examples/expects/expects.roc @@ -21,6 +21,7 @@ main = x = 42 dbg x dbg "Fjoer en ferdjer frieten oan dyn geve lea" + dbg "this is line 24" r = {x : polyDbg "abc", y: polyDbg 10u8, z : polyDbg (A (B C))} diff --git a/crates/compiler/can/src/operator.rs b/crates/compiler/can/src/operator.rs index 8489a06c2f..b3cc8b1a12 100644 --- a/crates/compiler/can/src/operator.rs +++ b/crates/compiler/can/src/operator.rs @@ -661,7 +661,7 @@ pub fn desugar_expr<'a>( arena.alloc(Loc { value: LowLevelDbg( arena.alloc(( - &*arena.alloc_str(&format!("{}:{}", module_path, line_col.line)), + &*arena.alloc_str(&format!("{}:{}", module_path, line_col.line + 1)), &*arena.alloc_str(dbg_src), )), dbg_str,