mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-09-11 13:36:08 +03:00
[ elab ] Print script's FC in the bad elaboration script error
This commit is contained in:
parent
f6c000e27e
commit
a643e3af62
@ -603,6 +603,10 @@ perrorRaw (BadRunElab fc env script desc)
|
||||
= pure $ errorDesc (reflow "Bad elaborator script" <++> code !(pshow env script)
|
||||
<++> parens (pretty0 desc) <+> dot)
|
||||
<+> line <+> !(ploc fc)
|
||||
<+> !(let scriptFC = getLoc script in
|
||||
if isJust (isNonEmptyFC scriptFC)
|
||||
then pure $ line <+> reflow "Stuck place in the script:" <+> line <+> !(ploc scriptFC)
|
||||
else pure emptyDoc)
|
||||
perrorRaw (RunElabFail e)
|
||||
= pure $ reflow "Error during reflection" <+> colon <++> !(perrorRaw e)
|
||||
perrorRaw (GenericMsg fc str) = pure $ pretty0 str <+> line <+> !(ploc fc)
|
||||
|
14
tests/idris2/reflection/reflection022/BadElabScript.idr
Normal file
14
tests/idris2/reflection/reflection022/BadElabScript.idr
Normal file
@ -0,0 +1,14 @@
|
||||
module BadElabScript
|
||||
|
||||
import Language.Reflection
|
||||
|
||||
%language ElabReflection
|
||||
|
||||
x : Elab Nat
|
||||
x = do
|
||||
ignore $ check {expected=Type} `(Nat)
|
||||
?someHole
|
||||
check `(%search)
|
||||
|
||||
y : Nat
|
||||
y = %runElab x
|
21
tests/idris2/reflection/reflection022/expected
Normal file
21
tests/idris2/reflection/reflection022/expected
Normal file
@ -0,0 +1,21 @@
|
||||
1/1: Building BadElabScript (BadElabScript.idr)
|
||||
Error: While processing right hand side of y. Bad elaborator script ?someHole [no locals in scope] (script is not a data value).
|
||||
|
||||
BadElabScript:14:5--14:15
|
||||
10 | ?someHole
|
||||
11 | check `(%search)
|
||||
12 |
|
||||
13 | y : Nat
|
||||
14 | y = %runElab x
|
||||
^^^^^^^^^^
|
||||
|
||||
Stuck place in the script:
|
||||
|
||||
BadElabScript:10:3--10:12
|
||||
06 |
|
||||
07 | x : Elab Nat
|
||||
08 | x = do
|
||||
09 | ignore $ check {expected=Type} `(Nat)
|
||||
10 | ?someHole
|
||||
^^^^^^^^^
|
||||
|
3
tests/idris2/reflection/reflection022/run
Executable file
3
tests/idris2/reflection/reflection022/run
Executable file
@ -0,0 +1,3 @@
|
||||
. ../../../testutils.sh
|
||||
|
||||
check BadElabScript.idr
|
Loading…
Reference in New Issue
Block a user