[ error ] Add an FC to record constructors for better error messages (#2769)

This commit is contained in:
Steve Dunham 2022-11-12 21:58:23 -08:00
parent d1e1d0636c
commit ea733181c5
5 changed files with 18 additions and 2 deletions

View File

@ -129,7 +129,7 @@ elabRecord {vars} eopts fc env nest newns vis mbtot tn_in params opts conName_in
let conty = mkTy paramTelescope $
mkTy (map farg fields) (recTy tn)
let boundNames = paramNames ++ map fname fields ++ vars
let con = MkImpTy EmptyFC EmptyFC cname
let con = MkImpTy (virtualiseFC fc) EmptyFC cname
!(bindTypeNames fc [] boundNames conty)
let dt = MkImpData fc tn !(bindTypeNames fc [] boundNames (mkDataTy fc params)) opts [con]
log "declare.record" 5 $ "Record data type " ++ show dt

View File

@ -93,7 +93,7 @@ idrisTestsError = MkTestPool "Error messages" [] Nothing
"perror001", "perror002", "perror003", "perror004", "perror005",
"perror006", "perror007", "perror008", "perror009", "perror010",
"perror011", "perror012", "perror013", "perror014", "perror015",
"perror016", "perror017", "perror018", "perror019"]
"perror016", "perror017", "perror018", "perror019", "perror020"]
idrisTestsInteractive : TestPool
idrisTestsInteractive = MkTestPool "Interactive editing" [] Nothing

View File

@ -0,0 +1,5 @@
module Issue2769
record SomeRecord where
constructor SomeRecord
field : Int

View File

@ -0,0 +1,8 @@
1/1: Building Issue2769 (Issue2769.idr)
Error: Issue2769.SomeRecord is already defined.
Issue2769:3:1--5:14
3 | record SomeRecord where
4 | constructor SomeRecord
5 | field : Int

View File

@ -0,0 +1,3 @@
rm -rf build
$1 --no-banner --no-color --console-width 0 --check Issue2769.idr