Bug 13802 – Improve pretty-print result for the const(string) type

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-12-01T14:39:00Z
Last change time
2015-02-18T03:40:33Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2014-12-01T14:39:00Z
Compiler knows the name 'string' as an alias of immutable(char)[] type. string s; char[] a = s; -------- Error: cannot implicitly convert expression (s) of type string to char[] But, if the 'string' type is qualified, the diagnostic message will be difficult to read. const(string) cs; char[] a = cs; -------- Error: cannot implicitly convert expression (cs) of type const(immutable(char)[]) to char[] I think it should be improved to: Error: cannot implicitly convert expression (cs) of type const(string) to char[]
Comment #1 by bearophile_hugs — 2014-12-01T14:42:12Z
The errors with dstring/wstring are not common, but the error messages where I read things like "const(immutable(char)[])" are quite common. So this will be a nice improvement of errors readability.
Comment #2 by k.hara.pg — 2014-12-01T14:43:29Z
Comment #3 by github-bugzilla — 2014-12-01T19:52:03Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/20e0c679fd468bdc2800008ab04380a854c85890 fix Issue 13802 - Improve pretty-print result for the const(string) type https://github.com/D-Programming-Language/dmd/commit/a23603e4a1ab219d8e0e8ec184db6e95de4be28e Merge pull request #4185 from 9rnsr/fix_pp_string Issue 13802 & 13803 - Improve pretty-print result for the three string types
Comment #4 by github-bugzilla — 2015-02-18T03:40:33Z