September 04 [Issue 24745] New: Better error message when creating an associative array with the wrong syntax | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24745 Issue ID: 24745 Summary: Better error message when creating an associative array with the wrong syntax Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: lance@lancebachmeier.com If you accidentally do this when creating an AA int[int] f = {1: 1, 2: 2}; The error message is confusing: Error: comma expected separating field initializers Error: expression expected, not `:` In this case, the error message could include something to indicate that [] are used to create an associative array. It's also unclear what the error message in its current form means, since {1: 1, 2: 2} is designated initializer syntax. The only problem is that 1 and 2 are not valid names. -- |
Copyright © 1999-2021 by the D Language Foundation