Bug 18939 – Wrong order slice lengths in array length mismatch error message

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-06-03T18:22:13Z
Last change time
2024-12-13T18:59:01Z
Assigned to
No Owner
Creator
Luís Marques
Moved to GitHub: dmd#19443 →

Comments

Comment #0 by luis — 2018-06-03T18:22:13Z
I was confused by this message: a[x..y] = b[]; object.Error@(0): Array lengths don't match for copy: 3932160 != 1310720 I looked around wondering how the heck x..y had become 3932160, only to realize that the order of "3932160 != 1310720" doesn't match the order of a[] = b[], it's the other way around. It seems to me like printing the lengths in the same order as the source code assignment would make more intuitive sense.
Comment #1 by bitworld — 2018-09-11T02:33:32Z
Here is another test: __gshared string[] zeros; shared static this() { zeros[] = new string[64]; // There is no callstatck info. // It just give these error: // object.Error@(0): Array lengths don't match for copy: 64 != 0 // If I have a big source file, it really hard to locate the error. } void main() { // zeros[] = new string[64]; // Can get the callstatck info }
Comment #2 by robert.schadek — 2024-12-13T18:59:01Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19443 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB