on master help sign in
Merge pull request #3482 from PoroCYon/master

Fix .lidr compiler message source position.

commitbb3bc16f5d1be8c27044dfad14f05666f7d5559f authorNiklas Larsson <metaniklas@gmail.com> dateSun 23 Oct 2016, 23:24 (10 years ago) parent5609f014a23805
4 files changed+9−8
src/Idris/Unlit.hs+4−3 test/basic010/run+2−2 test/regression002/expected+2−2 test/totality011/expected+1−1
src/Idris/Unlit.hs+4−3
@@ -19,8 +19,9 @@ unlit f s = do let s' = map ulLine (lines s)
1919data LineType = Prog | Blank | Comm
2020
2121ulLine :: String -> (LineType, String)
22−ulLine ('>':' ':xs) = (Prog, xs)
23−ulLine ('>':xs) = (Prog, xs)
22+ulLine ('>':' ':xs) = (Prog, ' ':' ':xs) -- Replace with spaces, otherwise text position numbers will be bogus.
23+ulLine ('>':xs) = (Prog, ' ' :xs) -- The parser can deal with this, because /every/ (code) line is prefixed
24+ -- with a '>'.
2425ulLine xs | all isSpace xs = (Blank, "")
2526-- make sure it's not a doc comment
2627 | otherwise = (Comm, '-':'-':' ':'>':xs)
@@ -29,7 +30,7 @@ check :: FilePath -> Int -> [(LineType, String)] -> TC ()
2930check f l (a:b:cs) = do chkAdj f l (fst a) (fst b)
3031 check f (l+1) (b:cs)
3132check f l [x] = return ()
32−check f l [] = return ()
33+check f l [ ] = return ()
3334
3435-- Issue #1593 on the issue checker.
3536--
test/basic010/run+2−2
@@ -4,7 +4,7 @@ set -eu
44
55TIMEOUT=../scripts/timeout
66
7−$TIMEOUT 10 "${IDRIS:-idris}" "$@" Main.idr --nocolour --check --warnreach -o basic010
8−$TIMEOUT 5 ./basic010
7+$TIMEOUT 20 "${IDRIS:-idris}" "$@" Main.idr --nocolour --check --warnreach -o basic010
8+$TIMEOUT 20 ./basic010
99
1010rm -f -- *.ibc basic010
test/regression002/expected+2−2
@@ -6,8 +6,8 @@ reg003a.idr:9:6:When checking type of Main.test:
66No such variable EvenList
77reg006.idr:17:1:
88RBTree.lookup is possibly not total due to recursive path RBTree.lookup --> RBTree.lookup
9−reg007.lidr:8:1:A.n is already defined
10−reg007.lidr:12:11-17:When checking right hand side of hurrah with expected type
9+reg007.lidr:8:3:A.n is already defined
10+reg007.lidr:12:13-19:When checking right hand side of hurrah with expected type
1111 0 = 1
1212
1313Type mismatch between
test/totality011/expected+1−1
@@ -1,2 +1,2 @@
1−totality011.lidr:22:1:
1+totality011.lidr:22:3:
22Main.weCanOnlyGetOlder is not total as there are missing cases