Bug 21852 – diagnostic: One-liner errors with formatted Loc should print context when -verrors=context
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-04-23T11:06:50Z
Last change time
2023-08-11T01:06:06Z
Keywords
diagnostic, pull
Assigned to
No Owner
Creator
Iain Buclaw
Comments
Comment #0 by ibuclaw — 2021-04-23T11:06:50Z
For example:
---
char skip()
{
goto Lskip;
char ch = '!';
Lskip:
return ch;
}
---
Reports:
---
mod.d(3): Error: goto skips declaration of variable mod.skip.ch at mod.d(4)
goto Lskip;
^
---
Whereas a better error that takes advantage of `-verrors=context' would be:
---
mod.d(3): Error: `goto` skips declaration of variable `mod.skip.ch`
goto Lskip;
^
mod.d(4): declared here
char ch = '!';
^
---
Comment #1 by dlang-bot — 2023-08-10T18:02:35Z
@ntrel created dlang/dmd pull request #15529 "Use separate line for extra Loc in various error messages" fixing this issue:
- Fix Issue 21852 - diagnostic: One-liner errors with formatted Loc should print context when -verrors=context
https://github.com/dlang/dmd/pull/15529
Comment #2 by dlang-bot — 2023-08-11T01:06:06Z
dlang/dmd pull request #15529 "Use separate line for extra Loc in various error messages" was merged into master:
- 1b3ca87ed28bff0e2defae317afb6d252a30122d by Nick Treleaven:
Fix Issue 21852 - diagnostic: One-liner errors with formatted Loc should print context when -verrors=context
https://github.com/dlang/dmd/pull/15529