www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18939] New: Wrong order slice lengths in array length

https://issues.dlang.org/show_bug.cgi?id=18939

          Issue ID: 18939
           Summary: Wrong order slice lengths in array length mismatch
                    error message
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: luis luismarques.eu

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.

--
Jun 03 2018