From a77f82c1fdc24c452455106715439a22a52c5bfb Mon Sep 17 00:00:00 2001 From: Craig Roy Date: Wed, 30 Oct 2024 13:55:44 +0000 Subject: [PATCH] feat: Make FC reporting in errors nicer (#39) --- brat/Brat/Error.hs | 10 +++++++++- brat/Brat/FC.hs | 6 +++++- brat/test/golden/binding/cons.brat.golden | 2 +- brat/test/golden/binding/let.brat.golden | 2 +- brat/test/golden/error/apply_two_thunks.brat.golden | 2 +- .../golden/error/arith_implicit_conversion.brat.golden | 2 +- .../error/arith_implicit_conversion2.brat.golden | 2 +- .../error/arith_implicit_conversion3.brat.golden | 2 +- brat/test/golden/error/bad_rpat.brat.golden | 2 +- brat/test/golden/error/bad_underscore.brat.golden | 2 +- brat/test/golden/error/bad_underscore2.brat.golden | 2 +- brat/test/golden/error/badvec.brat.golden | 2 +- brat/test/golden/error/badvec2.brat.golden | 2 +- brat/test/golden/error/badvec3.brat.golden | 2 +- brat/test/golden/error/badvec4.brat.golden | 2 +- brat/test/golden/error/empty_into.brat.golden | 2 +- brat/test/golden/error/fanin-diff-types.brat.golden | 2 +- .../test/golden/error/fanin-dynamic-length.brat.golden | 2 +- brat/test/golden/error/fanin-list.brat.golden | 2 +- .../golden/error/fanin-not-enough-overs.brat.golden | 2 +- .../test/golden/error/fanin-too-many-overs.brat.golden | 2 +- brat/test/golden/error/fanout-diff-types.brat.golden | 2 +- .../golden/error/fanout-dynamic-length.brat.golden | 2 +- brat/test/golden/error/fanout-list.brat.golden | 2 +- .../golden/error/fanout-not-enough-overs.brat.golden | 2 +- .../golden/error/fanout-too-many-overs.brat.golden | 2 +- brat/test/golden/error/inconsistentclauses.brat.golden | 2 +- brat/test/golden/error/kbadvec.brat.golden | 2 +- brat/test/golden/error/kbadvec2.brat.golden | 2 +- brat/test/golden/error/kbadvec3.brat.golden | 2 +- brat/test/golden/error/kbadvec4.brat.golden | 2 +- brat/test/golden/error/kvarnotfound.brat.golden | 2 +- brat/test/golden/error/multilambda-id.brat.golden | 2 +- brat/test/golden/error/multilambda-id2.brat.golden | 2 +- brat/test/golden/error/multilambda-id3.brat.golden | 2 +- brat/test/golden/error/nameclash1.brat.golden | 2 +- brat/test/golden/error/nameclash2.brat.golden | 2 +- brat/test/golden/error/no_thunk.brat.golden | 2 +- brat/test/golden/error/noovers.brat.golden | 2 +- brat/test/golden/error/pair.brat.golden | 2 +- brat/test/golden/error/pass.brat.golden | 2 +- brat/test/golden/error/pass_empty.brat.golden | 2 +- brat/test/golden/error/portpull-ambiguous.brat.golden | 2 +- brat/test/golden/error/portpull.brat.golden | 2 +- brat/test/golden/error/simpleterm.brat.golden | 2 +- brat/test/golden/error/toplevel-leftovers.brat.golden | 2 +- brat/test/golden/error/toplevel-leftovers2.brat.golden | 2 +- brat/test/golden/error/toplevel-leftovers3.brat.golden | 2 +- brat/test/golden/error/type-arith.brat.golden | 2 +- brat/test/golden/error/type-arith2.brat.golden | 2 +- brat/test/golden/error/unmatched_bracket.brat.golden | 2 +- brat/test/golden/error/varnotfound.brat.golden | 2 +- brat/test/golden/error/vecpat.brat.golden | 2 +- brat/test/golden/error/vecpat2.brat.golden | 2 +- brat/test/golden/error/vecpat3.brat.golden | 2 +- brat/test/golden/imports/alias-clash.brat.golden | 2 +- brat/test/golden/imports/non-existent1.brat.golden | 2 +- brat/test/golden/imports/non-existent2.brat.golden | 2 +- brat/test/golden/imports/use-illegal-z.brat.golden | 2 +- brat/test/golden/imports/use-illegal-z2.brat.golden | 2 +- brat/test/golden/imports/use-illegal-z3.brat.golden | 2 +- brat/test/golden/imports/use-illegal-z4.brat.golden | 2 +- brat/test/golden/imports/use-unqualified.brat.golden | 2 +- .../test/golden/imports/use-without-rename.brat.golden | 2 +- brat/test/golden/kernel/classical_return.brat.golden | 2 +- brat/test/golden/kernel/copy.brat.golden | 2 +- brat/test/golden/kernel/delete.brat.golden | 2 +- brat/test/golden/kernel/deleteFst.brat.golden | 2 +- brat/test/golden/kernel/deleteSnd.brat.golden | 2 +- brat/test/golden/kernel/duplicate_abs.brat.golden | 2 +- brat/test/golden/kernel/kernel_application.brat.golden | 2 +- brat/test/golden/kernel/let_del.brat.golden | 2 +- brat/test/golden/kernel/typed_th.brat.golden | 2 +- 73 files changed, 85 insertions(+), 73 deletions(-) diff --git a/brat/Brat/Error.hs b/brat/Brat/Error.hs index 9f680ed8..32cea48a 100644 --- a/brat/Brat/Error.hs +++ b/brat/Brat/Error.hs @@ -191,9 +191,17 @@ addSrcContext _ _ (Right r) = Right r addSrcContext fname cts (Left err@Err{fc=fc}) = Left (SrcErr msg err) where msg = case fc of - Just fc -> unlines (errHeader (fname ++ '@':show fc):showFileContext cts fc) + Just fc -> unlines (errHeader (fname ++ prettyFC fc) + :showFileContext cts fc + ) Nothing -> errHeader fname + prettyFC fc = let Pos startLine _ = start fc + Pos endLine _ = end fc + in if startLine == endLine + then " on line " ++ show startLine + else " on lines " ++ show startLine ++ "-" ++ show endLine + showFileContext :: String -> FC -> [String] showFileContext contents fc = let -- taking 1 off to convert 1-indexed user line numbers to 0-indexed list indices diff --git a/brat/Brat/FC.hs b/brat/Brat/FC.hs index ab50a96f..958df5d1 100644 --- a/brat/Brat/FC.hs +++ b/brat/Brat/FC.hs @@ -2,7 +2,11 @@ module Brat.FC where data Pos = Pos { line :: Int , col :: Int - } deriving (Eq, Show) + } deriving Eq + +instance Show Pos where + show (Pos { .. }) = show line ++ ":" ++ show col + instance Ord Pos where compare (Pos l c) (Pos l' c') | l == l' = compare c c' diff --git a/brat/test/golden/binding/cons.brat.golden b/brat/test/golden/binding/cons.brat.golden index 760511cd..5742b0a3 100644 --- a/brat/test/golden/binding/cons.brat.golden +++ b/brat/test/golden/binding/cons.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/binding/cons.brat@FC {start = Pos {line = 7, col = 10}, end = Pos {line = 7, col = 23}}: +Error in test/golden/binding/cons.brat on line 7: badUncons(cons(stuff)) = stuff ^^^^^^^^^^^^^ diff --git a/brat/test/golden/binding/let.brat.golden b/brat/test/golden/binding/let.brat.golden index 2cde36ed..95c5c1c9 100644 --- a/brat/test/golden/binding/let.brat.golden +++ b/brat/test/golden/binding/let.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/binding/let.brat@FC {start = Pos {line = 7, col = 14}, end = Pos {line = 7, col = 36}}: +Error in test/golden/binding/let.brat on line 7: badBinding = let x = twoThings in x ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/brat/test/golden/error/apply_two_thunks.brat.golden b/brat/test/golden/error/apply_two_thunks.brat.golden index 204774e3..a35d6110 100644 --- a/brat/test/golden/error/apply_two_thunks.brat.golden +++ b/brat/test/golden/error/apply_two_thunks.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/apply_two_thunks.brat@FC {start = Pos {line = 9, col = 9}, end = Pos {line = 9, col = 18}}: +Error in test/golden/error/apply_two_thunks.brat on line 9: go(n) = thunks(n) ^^^^^^^^^ diff --git a/brat/test/golden/error/arith_implicit_conversion.brat.golden b/brat/test/golden/error/arith_implicit_conversion.brat.golden index a38d0194..5073fa16 100644 --- a/brat/test/golden/error/arith_implicit_conversion.brat.golden +++ b/brat/test/golden/error/arith_implicit_conversion.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/arith_implicit_conversion.brat@FC {start = Pos {line = 2, col = 20}, end = Pos {line = 2, col = 21}}: +Error in test/golden/error/arith_implicit_conversion.brat on line 2: f(x, y) = x + (x * y) ^ diff --git a/brat/test/golden/error/arith_implicit_conversion2.brat.golden b/brat/test/golden/error/arith_implicit_conversion2.brat.golden index 10241649..accb93d3 100644 --- a/brat/test/golden/error/arith_implicit_conversion2.brat.golden +++ b/brat/test/golden/error/arith_implicit_conversion2.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/arith_implicit_conversion2.brat@FC {start = Pos {line = 2, col = 16}, end = Pos {line = 2, col = 17}}: +Error in test/golden/error/arith_implicit_conversion2.brat on line 2: f(x, y) = x + (y - x) ^ diff --git a/brat/test/golden/error/arith_implicit_conversion3.brat.golden b/brat/test/golden/error/arith_implicit_conversion3.brat.golden index cf59a64b..0348f851 100644 --- a/brat/test/golden/error/arith_implicit_conversion3.brat.golden +++ b/brat/test/golden/error/arith_implicit_conversion3.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/arith_implicit_conversion3.brat@FC {start = Pos {line = 2, col = 11}, end = Pos {line = 2, col = 12}}: +Error in test/golden/error/arith_implicit_conversion3.brat on line 2: f(x, y) = y + x ^ diff --git a/brat/test/golden/error/bad_rpat.brat.golden b/brat/test/golden/error/bad_rpat.brat.golden index 1fc4e633..f5828b8e 100644 --- a/brat/test/golden/error/bad_rpat.brat.golden +++ b/brat/test/golden/error/bad_rpat.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/bad_rpat.brat@FC {start = Pos {line = 2, col = 8}, end = Pos {line = 2, col = 19}}: +Error in test/golden/error/bad_rpat.brat on line 2: test = cons(1, []) ^^^^^^^^^^^ diff --git a/brat/test/golden/error/bad_underscore.brat.golden b/brat/test/golden/error/bad_underscore.brat.golden index a491843e..c2a19fc5 100644 --- a/brat/test/golden/error/bad_underscore.brat.golden +++ b/brat/test/golden/error/bad_underscore.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/bad_underscore.brat@FC {start = Pos {line = 2, col = 12}, end = Pos {line = 2, col = 18}}: +Error in test/golden/error/bad_underscore.brat on line 2: uscore = { i => _ } ^^^^^^ diff --git a/brat/test/golden/error/bad_underscore2.brat.golden b/brat/test/golden/error/bad_underscore2.brat.golden index 263b2ae7..6a1bed76 100644 --- a/brat/test/golden/error/bad_underscore2.brat.golden +++ b/brat/test/golden/error/bad_underscore2.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/bad_underscore2.brat@FC {start = Pos {line = 2, col = 13}, end = Pos {line = 2, col = 14}}: +Error in test/golden/error/bad_underscore2.brat on line 2: uscore(i) = _ ^ diff --git a/brat/test/golden/error/badvec.brat.golden b/brat/test/golden/error/badvec.brat.golden index 9098c931..35e9fc33 100644 --- a/brat/test/golden/error/badvec.brat.golden +++ b/brat/test/golden/error/badvec.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/badvec.brat@FC {start = Pos {line = 2, col = 6}, end = Pos {line = 2, col = 9}}: +Error in test/golden/error/badvec.brat on line 2: v3 = [1] ^^^ diff --git a/brat/test/golden/error/badvec2.brat.golden b/brat/test/golden/error/badvec2.brat.golden index ea4dae90..2029db69 100644 --- a/brat/test/golden/error/badvec2.brat.golden +++ b/brat/test/golden/error/badvec2.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/badvec2.brat@FC {start = Pos {line = 2, col = 6}, end = Pos {line = 2, col = 9}}: +Error in test/golden/error/badvec2.brat on line 2: v3 = nil ^^^ diff --git a/brat/test/golden/error/badvec3.brat.golden b/brat/test/golden/error/badvec3.brat.golden index 8e337fc8..76e928b2 100644 --- a/brat/test/golden/error/badvec3.brat.golden +++ b/brat/test/golden/error/badvec3.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/badvec3.brat@FC {start = Pos {line = 2, col = 6}, end = Pos {line = 2, col = 18}}: +Error in test/golden/error/badvec3.brat on line 2: v3 = cons(1, nil) ^^^^^^^^^^^^ diff --git a/brat/test/golden/error/badvec4.brat.golden b/brat/test/golden/error/badvec4.brat.golden index 53262957..7fe59dfd 100644 --- a/brat/test/golden/error/badvec4.brat.golden +++ b/brat/test/golden/error/badvec4.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/badvec4.brat@FC {start = Pos {line = 2, col = 6}, end = Pos {line = 2, col = 11}}: +Error in test/golden/error/badvec4.brat on line 2: v3 = [1,2] ^^^^^ diff --git a/brat/test/golden/error/empty_into.brat.golden b/brat/test/golden/error/empty_into.brat.golden index b300d675..9f669992 100644 --- a/brat/test/golden/error/empty_into.brat.golden +++ b/brat/test/golden/error/empty_into.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/empty_into.brat@FC {start = Pos {line = 5, col = 11}, end = Pos {line = 5, col = 21}}: +Error in test/golden/error/empty_into.brat on line 5: intoErr = |> makeInt ^^^^^^^^^^ diff --git a/brat/test/golden/error/fanin-diff-types.brat.golden b/brat/test/golden/error/fanin-diff-types.brat.golden index 1524722f..f97d0b45 100644 --- a/brat/test/golden/error/fanin-diff-types.brat.golden +++ b/brat/test/golden/error/fanin-diff-types.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/fanin-diff-types.brat@FC {start = Pos {line = 2, col = 5}, end = Pos {line = 2, col = 13}}: +Error in test/golden/error/fanin-diff-types.brat on line 2: f = { [\/] } ^^^^^^^^ diff --git a/brat/test/golden/error/fanin-dynamic-length.brat.golden b/brat/test/golden/error/fanin-dynamic-length.brat.golden index 98321968..993c4357 100644 --- a/brat/test/golden/error/fanin-dynamic-length.brat.golden +++ b/brat/test/golden/error/fanin-dynamic-length.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/fanin-dynamic-length.brat@FC {start = Pos {line = 2, col = 8}, end = Pos {line = 2, col = 16}}: +Error in test/golden/error/fanin-dynamic-length.brat on line 2: f(n) = { [\/] } ^^^^^^^^ diff --git a/brat/test/golden/error/fanin-list.brat.golden b/brat/test/golden/error/fanin-list.brat.golden index 704b9089..6a8a2989 100644 --- a/brat/test/golden/error/fanin-list.brat.golden +++ b/brat/test/golden/error/fanin-list.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/fanin-list.brat@FC {start = Pos {line = 2, col = 5}, end = Pos {line = 2, col = 13}}: +Error in test/golden/error/fanin-list.brat on line 2: f = { [\/] } ^^^^^^^^ diff --git a/brat/test/golden/error/fanin-not-enough-overs.brat.golden b/brat/test/golden/error/fanin-not-enough-overs.brat.golden index 58cfd7be..82d88b1c 100644 --- a/brat/test/golden/error/fanin-not-enough-overs.brat.golden +++ b/brat/test/golden/error/fanin-not-enough-overs.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/fanin-not-enough-overs.brat@FC {start = Pos {line = 2, col = 5}, end = Pos {line = 2, col = 13}}: +Error in test/golden/error/fanin-not-enough-overs.brat on line 2: f = { [\/] } ^^^^^^^^ diff --git a/brat/test/golden/error/fanin-too-many-overs.brat.golden b/brat/test/golden/error/fanin-too-many-overs.brat.golden index 91e24787..df271f79 100644 --- a/brat/test/golden/error/fanin-too-many-overs.brat.golden +++ b/brat/test/golden/error/fanin-too-many-overs.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/fanin-too-many-overs.brat@FC {start = Pos {line = 2, col = 5}, end = Pos {line = 2, col = 13}}: +Error in test/golden/error/fanin-too-many-overs.brat on line 2: f = { [\/] } ^^^^^^^^ diff --git a/brat/test/golden/error/fanout-diff-types.brat.golden b/brat/test/golden/error/fanout-diff-types.brat.golden index 1d4ad441..1f52499e 100644 --- a/brat/test/golden/error/fanout-diff-types.brat.golden +++ b/brat/test/golden/error/fanout-diff-types.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/fanout-diff-types.brat@FC {start = Pos {line = 2, col = 5}, end = Pos {line = 2, col = 13}}: +Error in test/golden/error/fanout-diff-types.brat on line 2: f = { [/\] } ^^^^^^^^ diff --git a/brat/test/golden/error/fanout-dynamic-length.brat.golden b/brat/test/golden/error/fanout-dynamic-length.brat.golden index 2034ff3a..2d79c6e4 100644 --- a/brat/test/golden/error/fanout-dynamic-length.brat.golden +++ b/brat/test/golden/error/fanout-dynamic-length.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/fanout-dynamic-length.brat@FC {start = Pos {line = 2, col = 8}, end = Pos {line = 2, col = 16}}: +Error in test/golden/error/fanout-dynamic-length.brat on line 2: f(n) = { [/\] } ^^^^^^^^ diff --git a/brat/test/golden/error/fanout-list.brat.golden b/brat/test/golden/error/fanout-list.brat.golden index 74061199..8214f883 100644 --- a/brat/test/golden/error/fanout-list.brat.golden +++ b/brat/test/golden/error/fanout-list.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/fanout-list.brat@FC {start = Pos {line = 2, col = 5}, end = Pos {line = 2, col = 13}}: +Error in test/golden/error/fanout-list.brat on line 2: f = { [/\] } ^^^^^^^^ diff --git a/brat/test/golden/error/fanout-not-enough-overs.brat.golden b/brat/test/golden/error/fanout-not-enough-overs.brat.golden index 5fa8e3ae..a1ac9d3c 100644 --- a/brat/test/golden/error/fanout-not-enough-overs.brat.golden +++ b/brat/test/golden/error/fanout-not-enough-overs.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/fanout-not-enough-overs.brat@FC {start = Pos {line = 2, col = 5}, end = Pos {line = 2, col = 13}}: +Error in test/golden/error/fanout-not-enough-overs.brat on line 2: f = { [/\] } ^^^^^^^^ diff --git a/brat/test/golden/error/fanout-too-many-overs.brat.golden b/brat/test/golden/error/fanout-too-many-overs.brat.golden index 7b13154a..bcf8c6b5 100644 --- a/brat/test/golden/error/fanout-too-many-overs.brat.golden +++ b/brat/test/golden/error/fanout-too-many-overs.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/fanout-too-many-overs.brat@FC {start = Pos {line = 2, col = 5}, end = Pos {line = 2, col = 13}}: +Error in test/golden/error/fanout-too-many-overs.brat on line 2: f = { [/\] } ^^^^^^^^ diff --git a/brat/test/golden/error/inconsistentclauses.brat.golden b/brat/test/golden/error/inconsistentclauses.brat.golden index e715923b..8111d3ab 100644 --- a/brat/test/golden/error/inconsistentclauses.brat.golden +++ b/brat/test/golden/error/inconsistentclauses.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/inconsistentclauses.brat@FC {start = Pos {line = 1, col = 1}, end = Pos {line = 3, col = 9}}: +Error in test/golden/error/inconsistentclauses.brat on lines 1-3: f(Bool, Nat) -> Nat ^^^^^^^^^^^^^^^^^^^ f(true, n) = 1 diff --git a/brat/test/golden/error/kbadvec.brat.golden b/brat/test/golden/error/kbadvec.brat.golden index c14904dd..07a9e553 100644 --- a/brat/test/golden/error/kbadvec.brat.golden +++ b/brat/test/golden/error/kbadvec.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/kbadvec.brat@FC {start = Pos {line = 2, col = 17}, end = Pos {line = 2, col = 20}}: +Error in test/golden/error/kbadvec.brat on line 2: triple = { b => [b] } ^^^ diff --git a/brat/test/golden/error/kbadvec2.brat.golden b/brat/test/golden/error/kbadvec2.brat.golden index 102d2f0a..c70190e9 100644 --- a/brat/test/golden/error/kbadvec2.brat.golden +++ b/brat/test/golden/error/kbadvec2.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/kbadvec2.brat@FC {start = Pos {line = 2, col = 17}, end = Pos {line = 2, col = 20}}: +Error in test/golden/error/kbadvec2.brat on line 2: triple = { b => nil } ^^^ diff --git a/brat/test/golden/error/kbadvec3.brat.golden b/brat/test/golden/error/kbadvec3.brat.golden index b9552ded..97be8bec 100644 --- a/brat/test/golden/error/kbadvec3.brat.golden +++ b/brat/test/golden/error/kbadvec3.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/kbadvec3.brat@FC {start = Pos {line = 2, col = 19}, end = Pos {line = 2, col = 31}}: +Error in test/golden/error/kbadvec3.brat on line 2: constNil = { b => cons(1, nil) } ^^^^^^^^^^^^ diff --git a/brat/test/golden/error/kbadvec4.brat.golden b/brat/test/golden/error/kbadvec4.brat.golden index 8d2c78b8..9b17e59f 100644 --- a/brat/test/golden/error/kbadvec4.brat.golden +++ b/brat/test/golden/error/kbadvec4.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/kbadvec4.brat@FC {start = Pos {line = 2, col = 7}, end = Pos {line = 2, col = 12}}: +Error in test/golden/error/kbadvec4.brat on line 2: f = { [1,2] => true } ^^^^^ diff --git a/brat/test/golden/error/kvarnotfound.brat.golden b/brat/test/golden/error/kvarnotfound.brat.golden index 86403950..c6c6bba6 100644 --- a/brat/test/golden/error/kvarnotfound.brat.golden +++ b/brat/test/golden/error/kvarnotfound.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/kvarnotfound.brat@FC {start = Pos {line = 2, col = 12}, end = Pos {line = 2, col = 13}}: +Error in test/golden/error/kvarnotfound.brat on line 2: f = { x => y } ^ diff --git a/brat/test/golden/error/multilambda-id.brat.golden b/brat/test/golden/error/multilambda-id.brat.golden index 17e551d1..68205867 100644 --- a/brat/test/golden/error/multilambda-id.brat.golden +++ b/brat/test/golden/error/multilambda-id.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/multilambda-id.brat@FC {start = Pos {line = 2, col = 15}, end = Pos {line = 2, col = 16}}: +Error in test/golden/error/multilambda-id.brat on line 2: f = { true => | ^ diff --git a/brat/test/golden/error/multilambda-id2.brat.golden b/brat/test/golden/error/multilambda-id2.brat.golden index 6e6f381e..ead31661 100644 --- a/brat/test/golden/error/multilambda-id2.brat.golden +++ b/brat/test/golden/error/multilambda-id2.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/multilambda-id2.brat@FC {start = Pos {line = 2, col = 12}, end = Pos {line = 2, col = 13}}: +Error in test/golden/error/multilambda-id2.brat on line 2: g = { 0 => ||succ(n) => | } ^ diff --git a/brat/test/golden/error/multilambda-id3.brat.golden b/brat/test/golden/error/multilambda-id3.brat.golden index 9630157d..e97e87e5 100644 --- a/brat/test/golden/error/multilambda-id3.brat.golden +++ b/brat/test/golden/error/multilambda-id3.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/multilambda-id3.brat@FC {start = Pos {line = 2, col = 15}, end = Pos {line = 2, col = 18}}: +Error in test/golden/error/multilambda-id3.brat on line 2: f = { true => |;||false =>|;|;|} ^^^ diff --git a/brat/test/golden/error/nameclash1.brat.golden b/brat/test/golden/error/nameclash1.brat.golden index 98783e75..6277961c 100644 --- a/brat/test/golden/error/nameclash1.brat.golden +++ b/brat/test/golden/error/nameclash1.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/nameclash1.brat@FC {start = Pos {line = 1, col = 1}, end = Pos {line = 1, col = 16}}: +Error in test/golden/error/nameclash1.brat on line 1: type Nat(x) = x ^^^^^^^^^^^^^^^ diff --git a/brat/test/golden/error/nameclash2.brat.golden b/brat/test/golden/error/nameclash2.brat.golden index dfbc7f18..82ff9d34 100644 --- a/brat/test/golden/error/nameclash2.brat.golden +++ b/brat/test/golden/error/nameclash2.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/nameclash2.brat@FC {start = Pos {line = 2, col = 1}, end = Pos {line = 2, col = 16}}: +Error in test/golden/error/nameclash2.brat on line 2: type A(x,y) = y ^^^^^^^^^^^^^^^ diff --git a/brat/test/golden/error/no_thunk.brat.golden b/brat/test/golden/error/no_thunk.brat.golden index 5188661e..49a4ba6b 100644 --- a/brat/test/golden/error/no_thunk.brat.golden +++ b/brat/test/golden/error/no_thunk.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/no_thunk.brat@FC {start = Pos {line = 8, col = 14}, end = Pos {line = 8, col = 15}}: +Error in test/golden/error/no_thunk.brat on line 8: Rz(2.0 / n); X ^ diff --git a/brat/test/golden/error/noovers.brat.golden b/brat/test/golden/error/noovers.brat.golden index d0100d4e..8acaa5c5 100644 --- a/brat/test/golden/error/noovers.brat.golden +++ b/brat/test/golden/error/noovers.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/noovers.brat@FC {start = Pos {line = 2, col = 2}, end = Pos {line = 2, col = 8}}: +Error in test/golden/error/noovers.brat on line 2: f(a, b) = [] ^^^^^^ diff --git a/brat/test/golden/error/pair.brat.golden b/brat/test/golden/error/pair.brat.golden index 64d6b521..51074f8a 100644 --- a/brat/test/golden/error/pair.brat.golden +++ b/brat/test/golden/error/pair.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/pair.brat@FC {start = Pos {line = 5, col = 8}, end = Pos {line = 5, col = 11}}: +Error in test/golden/error/pair.brat on line 5: pair = row -- Distinct from a pair ^^^ diff --git a/brat/test/golden/error/pass.brat.golden b/brat/test/golden/error/pass.brat.golden index 1ab96a9e..6001f98f 100644 --- a/brat/test/golden/error/pass.brat.golden +++ b/brat/test/golden/error/pass.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/pass.brat@FC {start = Pos {line = 5, col = 12}, end = Pos {line = 5, col = 13}}: +Error in test/golden/error/pass.brat on line 5: f = { .., (x => x) } ^ diff --git a/brat/test/golden/error/pass_empty.brat.golden b/brat/test/golden/error/pass_empty.brat.golden index dcbe380b..3b988718 100644 --- a/brat/test/golden/error/pass_empty.brat.golden +++ b/brat/test/golden/error/pass_empty.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/pass_empty.brat@FC {start = Pos {line = 2, col = 17}, end = Pos {line = 2, col = 19}}: +Error in test/golden/error/pass_empty.brat on line 2: f = { (x => x), .. } ^^ diff --git a/brat/test/golden/error/portpull-ambiguous.brat.golden b/brat/test/golden/error/portpull-ambiguous.brat.golden index b56ade4d..bc45791d 100644 --- a/brat/test/golden/error/portpull-ambiguous.brat.golden +++ b/brat/test/golden/error/portpull-ambiguous.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/portpull-ambiguous.brat@FC {start = Pos {line = 6, col = 22}, end = Pos {line = 6, col = 31}}: +Error in test/golden/error/portpull-ambiguous.brat on line 6: id2 = x, y => (id,id)(a1:x, y) ^^^^^^^^^ diff --git a/brat/test/golden/error/portpull.brat.golden b/brat/test/golden/error/portpull.brat.golden index e85c8257..f6a2fd2a 100644 --- a/brat/test/golden/error/portpull.brat.golden +++ b/brat/test/golden/error/portpull.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/portpull.brat@FC {start = Pos {line = 6, col = 22}, end = Pos {line = 6, col = 31}}: +Error in test/golden/error/portpull.brat on line 6: id2 = x,y => (id, id)(a1:x, y) ^^^^^^^^^ diff --git a/brat/test/golden/error/simpleterm.brat.golden b/brat/test/golden/error/simpleterm.brat.golden index 5dbff3c5..65cfce10 100644 --- a/brat/test/golden/error/simpleterm.brat.golden +++ b/brat/test/golden/error/simpleterm.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/simpleterm.brat@FC {start = Pos {line = 2, col = 10}, end = Pos {line = 2, col = 14}}: +Error in test/golden/error/simpleterm.brat on line 2: simple = true ^^^^ diff --git a/brat/test/golden/error/toplevel-leftovers.brat.golden b/brat/test/golden/error/toplevel-leftovers.brat.golden index 0dd4cdbf..797eac59 100644 --- a/brat/test/golden/error/toplevel-leftovers.brat.golden +++ b/brat/test/golden/error/toplevel-leftovers.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/toplevel-leftovers.brat@FC {start = Pos {line = 2, col = 5}, end = Pos {line = 2, col = 7}}: +Error in test/golden/error/toplevel-leftovers.brat on line 2: f = 42 ^^ diff --git a/brat/test/golden/error/toplevel-leftovers2.brat.golden b/brat/test/golden/error/toplevel-leftovers2.brat.golden index cd19807c..7951cf7e 100644 --- a/brat/test/golden/error/toplevel-leftovers2.brat.golden +++ b/brat/test/golden/error/toplevel-leftovers2.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/toplevel-leftovers2.brat@FC {start = Pos {line = 2, col = 8}, end = Pos {line = 2, col = 9}}: +Error in test/golden/error/toplevel-leftovers2.brat on line 2: f(x) = x ^ diff --git a/brat/test/golden/error/toplevel-leftovers3.brat.golden b/brat/test/golden/error/toplevel-leftovers3.brat.golden index 1d094a04..23727f22 100644 --- a/brat/test/golden/error/toplevel-leftovers3.brat.golden +++ b/brat/test/golden/error/toplevel-leftovers3.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/toplevel-leftovers3.brat@FC {start = Pos {line = 2, col = 2}, end = Pos {line = 2, col = 5}}: +Error in test/golden/error/toplevel-leftovers3.brat on line 2: f(x) = x ^^^ diff --git a/brat/test/golden/error/type-arith.brat.golden b/brat/test/golden/error/type-arith.brat.golden index ac2ab7bf..17c59fb2 100644 --- a/brat/test/golden/error/type-arith.brat.golden +++ b/brat/test/golden/error/type-arith.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/type-arith.brat@FC {start = Pos {line = 1, col = 20}, end = Pos {line = 1, col = 25}}: +Error in test/golden/error/type-arith.brat on line 1: f(n :: #, Vec(Nat, n ^ 3)) -> Bool ^^^^^ diff --git a/brat/test/golden/error/type-arith2.brat.golden b/brat/test/golden/error/type-arith2.brat.golden index f6e41097..98be78b1 100644 --- a/brat/test/golden/error/type-arith2.brat.golden +++ b/brat/test/golden/error/type-arith2.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/type-arith2.brat@FC {start = Pos {line = 1, col = 20}, end = Pos {line = 1, col = 25}}: +Error in test/golden/error/type-arith2.brat on line 1: f(n :: #, Vec(Nat, n * n)) -> Bool ^^^^^ diff --git a/brat/test/golden/error/unmatched_bracket.brat.golden b/brat/test/golden/error/unmatched_bracket.brat.golden index 427aac74..f61aa5d2 100644 --- a/brat/test/golden/error/unmatched_bracket.brat.golden +++ b/brat/test/golden/error/unmatched_bracket.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/unmatched_bracket.brat@FC {start = Pos {line = 1, col = 17}, end = Pos {line = 1, col = 19}}: +Error in test/golden/error/unmatched_bracket.brat on line 1: f(n, Vec([], n) -> Vec([], n) -- First bracket never closed ^^ diff --git a/brat/test/golden/error/varnotfound.brat.golden b/brat/test/golden/error/varnotfound.brat.golden index 07b26355..4ee9bb72 100644 --- a/brat/test/golden/error/varnotfound.brat.golden +++ b/brat/test/golden/error/varnotfound.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/varnotfound.brat@FC {start = Pos {line = 2, col = 8}, end = Pos {line = 2, col = 9}}: +Error in test/golden/error/varnotfound.brat on line 2: f(x) = g(x) ^ diff --git a/brat/test/golden/error/vecpat.brat.golden b/brat/test/golden/error/vecpat.brat.golden index 0d9e24a2..34f98e75 100644 --- a/brat/test/golden/error/vecpat.brat.golden +++ b/brat/test/golden/error/vecpat.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/vecpat.brat@FC {start = Pos {line = 3, col = 5}, end = Pos {line = 3, col = 10}}: +Error in test/golden/error/vecpat.brat on line 3: fst3(nil) = none ^^^^^ diff --git a/brat/test/golden/error/vecpat2.brat.golden b/brat/test/golden/error/vecpat2.brat.golden index 7fc56984..9009111f 100644 --- a/brat/test/golden/error/vecpat2.brat.golden +++ b/brat/test/golden/error/vecpat2.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/vecpat2.brat@FC {start = Pos {line = 3, col = 5}, end = Pos {line = 3, col = 14}}: +Error in test/golden/error/vecpat2.brat on line 3: fst3(some(x)) = none ^^^^^^^^^ diff --git a/brat/test/golden/error/vecpat3.brat.golden b/brat/test/golden/error/vecpat3.brat.golden index 53b3521f..3eedcbce 100644 --- a/brat/test/golden/error/vecpat3.brat.golden +++ b/brat/test/golden/error/vecpat3.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/error/vecpat3.brat@FC {start = Pos {line = 3, col = 5}, end = Pos {line = 3, col = 12}}: +Error in test/golden/error/vecpat3.brat on line 3: fst3([a,b]) = none ^^^^^^^ diff --git a/brat/test/golden/imports/alias-clash.brat.golden b/brat/test/golden/imports/alias-clash.brat.golden index 516b319c..30c7ec65 100644 --- a/brat/test/golden/imports/alias-clash.brat.golden +++ b/brat/test/golden/imports/alias-clash.brat.golden @@ -1,4 +1,4 @@ -Error in alias-clash@FC {start = Pos {line = 2, col = 15}, end = Pos {line = 2, col = 16}}: +Error in alias-clash on line 2: import lib as A (z) ^ diff --git a/brat/test/golden/imports/non-existent1.brat.golden b/brat/test/golden/imports/non-existent1.brat.golden index cb8dd7bd..74d9e9ee 100644 --- a/brat/test/golden/imports/non-existent1.brat.golden +++ b/brat/test/golden/imports/non-existent1.brat.golden @@ -1,4 +1,4 @@ -Error in non-existent1@FC {start = Pos {line = 1, col = 16}, end = Pos {line = 1, col = 17}}: +Error in non-existent1 on line 1: import lib (x, a) ^ diff --git a/brat/test/golden/imports/non-existent2.brat.golden b/brat/test/golden/imports/non-existent2.brat.golden index d05fb076..5d7c8013 100644 --- a/brat/test/golden/imports/non-existent2.brat.golden +++ b/brat/test/golden/imports/non-existent2.brat.golden @@ -1,4 +1,4 @@ -Error in non-existent2@FC {start = Pos {line = 1, col = 23}, end = Pos {line = 1, col = 24}}: +Error in non-existent2 on line 1: import lib hiding (y, a) ^ diff --git a/brat/test/golden/imports/use-illegal-z.brat.golden b/brat/test/golden/imports/use-illegal-z.brat.golden index 3ae4986b..15cf6d9d 100644 --- a/brat/test/golden/imports/use-illegal-z.brat.golden +++ b/brat/test/golden/imports/use-illegal-z.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/imports/use-illegal-z.brat@FC {start = Pos {line = 4, col = 14}, end = Pos {line = 4, col = 15}}: +Error in test/golden/imports/use-illegal-z.brat on line 4: main = x, y, z ^ diff --git a/brat/test/golden/imports/use-illegal-z2.brat.golden b/brat/test/golden/imports/use-illegal-z2.brat.golden index ea8e7997..ee1abe14 100644 --- a/brat/test/golden/imports/use-illegal-z2.brat.golden +++ b/brat/test/golden/imports/use-illegal-z2.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/imports/use-illegal-z2.brat@FC {start = Pos {line = 4, col = 22}, end = Pos {line = 4, col = 27}}: +Error in test/golden/imports/use-illegal-z2.brat on line 4: main = lib.x, lib.y, lib.z ^^^^^ diff --git a/brat/test/golden/imports/use-illegal-z3.brat.golden b/brat/test/golden/imports/use-illegal-z3.brat.golden index d7bdb736..9ce6bf22 100644 --- a/brat/test/golden/imports/use-illegal-z3.brat.golden +++ b/brat/test/golden/imports/use-illegal-z3.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/imports/use-illegal-z3.brat@FC {start = Pos {line = 4, col = 14}, end = Pos {line = 4, col = 15}}: +Error in test/golden/imports/use-illegal-z3.brat on line 4: main = x, y, z ^ diff --git a/brat/test/golden/imports/use-illegal-z4.brat.golden b/brat/test/golden/imports/use-illegal-z4.brat.golden index b7b7e893..9b42741a 100644 --- a/brat/test/golden/imports/use-illegal-z4.brat.golden +++ b/brat/test/golden/imports/use-illegal-z4.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/imports/use-illegal-z4.brat@FC {start = Pos {line = 4, col = 22}, end = Pos {line = 4, col = 27}}: +Error in test/golden/imports/use-illegal-z4.brat on line 4: main = lib.x, lib.y, lib.z ^^^^^ diff --git a/brat/test/golden/imports/use-unqualified.brat.golden b/brat/test/golden/imports/use-unqualified.brat.golden index 37b38428..569a9569 100644 --- a/brat/test/golden/imports/use-unqualified.brat.golden +++ b/brat/test/golden/imports/use-unqualified.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/imports/use-unqualified.brat@FC {start = Pos {line = 4, col = 8}, end = Pos {line = 4, col = 9}}: +Error in test/golden/imports/use-unqualified.brat on line 4: main = x ^ diff --git a/brat/test/golden/imports/use-without-rename.brat.golden b/brat/test/golden/imports/use-without-rename.brat.golden index a688f80e..b7483909 100644 --- a/brat/test/golden/imports/use-without-rename.brat.golden +++ b/brat/test/golden/imports/use-without-rename.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/imports/use-without-rename.brat@FC {start = Pos {line = 4, col = 8}, end = Pos {line = 4, col = 13}}: +Error in test/golden/imports/use-without-rename.brat on line 4: main = lib.x ^^^^^ diff --git a/brat/test/golden/kernel/classical_return.brat.golden b/brat/test/golden/kernel/classical_return.brat.golden index cd162a4d..46c1a2eb 100644 --- a/brat/test/golden/kernel/classical_return.brat.golden +++ b/brat/test/golden/kernel/classical_return.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/kernel/classical_return.brat@FC {start = Pos {line = 5, col = 1}, end = Pos {line = 6, col = 18}}: +Error in test/golden/kernel/classical_return.brat on lines 5-6: -- `Bool`. We could probably catch this and make the error message nicer. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ f :: { Qubit -o Qubit, Int } diff --git a/brat/test/golden/kernel/copy.brat.golden b/brat/test/golden/kernel/copy.brat.golden index b53a285b..1938ca9a 100644 --- a/brat/test/golden/kernel/copy.brat.golden +++ b/brat/test/golden/kernel/copy.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/kernel/copy.brat@FC {start = Pos {line = 2, col = 8}, end = Pos {line = 2, col = 21}}: +Error in test/golden/kernel/copy.brat on line 2: copy = { q => q, q } ^^^^^^^^^^^^^ diff --git a/brat/test/golden/kernel/delete.brat.golden b/brat/test/golden/kernel/delete.brat.golden index a9ae4a5a..3734c119 100644 --- a/brat/test/golden/kernel/delete.brat.golden +++ b/brat/test/golden/kernel/delete.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/kernel/delete.brat@FC {start = Pos {line = 2, col = 13}, end = Pos {line = 2, col = 29}}: +Error in test/golden/kernel/delete.brat on line 2: deleteFst = { q0, q1 => q1 } ^^^^^^^^^^^^^^^^ diff --git a/brat/test/golden/kernel/deleteFst.brat.golden b/brat/test/golden/kernel/deleteFst.brat.golden index a9dcf31a..050cdbab 100644 --- a/brat/test/golden/kernel/deleteFst.brat.golden +++ b/brat/test/golden/kernel/deleteFst.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/kernel/deleteFst.brat@FC {start = Pos {line = 2, col = 13}, end = Pos {line = 2, col = 29}}: +Error in test/golden/kernel/deleteFst.brat on line 2: deleteFst = { q0, q1 => q1 } ^^^^^^^^^^^^^^^^ diff --git a/brat/test/golden/kernel/deleteSnd.brat.golden b/brat/test/golden/kernel/deleteSnd.brat.golden index 7dbea77e..b4297b53 100644 --- a/brat/test/golden/kernel/deleteSnd.brat.golden +++ b/brat/test/golden/kernel/deleteSnd.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/kernel/deleteSnd.brat@FC {start = Pos {line = 2, col = 13}, end = Pos {line = 2, col = 29}}: +Error in test/golden/kernel/deleteSnd.brat on line 2: deleteSnd = { q0, q1 => q0 } ^^^^^^^^^^^^^^^^ diff --git a/brat/test/golden/kernel/duplicate_abs.brat.golden b/brat/test/golden/kernel/duplicate_abs.brat.golden index 0e79a8db..22586e4d 100644 --- a/brat/test/golden/kernel/duplicate_abs.brat.golden +++ b/brat/test/golden/kernel/duplicate_abs.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/kernel/duplicate_abs.brat@FC {start = Pos {line = 5, col = 8}, end = Pos {line = 5, col = 12}}: +Error in test/golden/kernel/duplicate_abs.brat on line 5: h2 = { p, p => f(p) } ^^^^ diff --git a/brat/test/golden/kernel/kernel_application.brat.golden b/brat/test/golden/kernel/kernel_application.brat.golden index 5301c43c..ed0aa8bf 100644 --- a/brat/test/golden/kernel/kernel_application.brat.golden +++ b/brat/test/golden/kernel/kernel_application.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/kernel/kernel_application.brat@FC {start = Pos {line = 16, col = 17}, end = Pos {line = 16, col = 28}}: +Error in test/golden/kernel/kernel_application.brat on line 16: rotate = { q => maybeRotate(true) } ^^^^^^^^^^^ diff --git a/brat/test/golden/kernel/let_del.brat.golden b/brat/test/golden/kernel/let_del.brat.golden index fde5deb5..683b8a3b 100644 --- a/brat/test/golden/kernel/let_del.brat.golden +++ b/brat/test/golden/kernel/let_del.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/kernel/let_del.brat@FC {start = Pos {line = 4, col = 12}, end = Pos {line = 4, col = 33}}: +Error in test/golden/kernel/let_del.brat on line 4: f = { q => let q' = X(q) in true } ^^^^^^^^^^^^^^^^^^^^^ diff --git a/brat/test/golden/kernel/typed_th.brat.golden b/brat/test/golden/kernel/typed_th.brat.golden index 67114bc9..e2843cbf 100644 --- a/brat/test/golden/kernel/typed_th.brat.golden +++ b/brat/test/golden/kernel/typed_th.brat.golden @@ -1,4 +1,4 @@ -Error in test/golden/kernel/typed_th.brat@FC {start = Pos {line = 5, col = 17}, end = Pos {line = 5, col = 24}}: +Error in test/golden/kernel/typed_th.brat on line 5: id2 = { let f = {id;id} in q,q' => f(q),f(q') } ^^^^^^^