Idris2
Idris2 copied to clipboard
"Error: Error:" Redundancy in Compiler Error Reporting
Some compiler errors seem to have "Error" printed twice before the error description when used in custom backends.
Steps to Reproduce
- Create the following file:
import Compiler.Common
import Idris.Syntax
import Core.Context
import Idris.Driver
compile : Ref Ctxt Defs -> Ref Syn SyntaxInfo -> String -> String ->
ClosedTerm -> String -> Core (Maybe String)
compile _ _ _ _ _ _ = coreFail (UserError "user error when compiling")
execute : Ref Ctxt Defs -> Ref Syn SyntaxInfo -> String -> ClosedTerm -> Core ()
execute _ _ _ _ = coreFail (UserError "user error when executing")
failingCompiler : Codegen
failingCompiler = MkCG compile execute Nothing Nothing
main : IO ()
main = mainWithCodegens [("failure", failingCompiler)]
- Compile it with
idris2 -p idris2 -p network file.idr -o out
- Open the new REPL by running
./build/exec/out
- Try
:exec
-ing something, such as:exec printLn "something"
Expected Behavior
The REPL should output something like Error: user error when executing
.
Observed Behavior
Main> :exec printLn "something"
Error: Error: user error when executing
The first Error
is red, the second is not.
Extra Information
When running this file (compiled with idris2 -p idris2 file.idr -o out
):
import Core.Context
core : Core ()
core = coreFail (UserError "user error")
main : IO ()
main = coreRun core printLn pure
The output only includes one (non-red) Error
:
Error: user error