Bug 13999 – [REG2.067a] Associative array literal with static array keys must now have matching key lengths

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-01-18T03:01:00Z
Last change time
2015-01-19T09:43:07Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
jakobovrum

Comments

Comment #0 by jakobovrum — 2015-01-18T03:01:15Z
--- void main() { string[immutable(dchar[2])] aa = ["ああ": "foo", "あ": "bar"]; } --- test.d(3): Error: cannot implicitly convert expression (["\xe3\x81\x82\xe3\x81\x82":"foo", "\xe3\x81\x82":"bar"]) of type string[string] to string[immutable(dch ar[2])] --- Using DMD 2.067/master at the time of posting. This used to compile, for better or worse. Changing the second entry's key to two code points, like "ああ", makes it compile. Not sure if this is now a DMD or druntime issue, or both. Although tangential, the error can be really hard to find in big literals.
Comment #1 by k.hara.pg — 2015-01-18T11:50:47Z
Comment #2 by github-bugzilla — 2015-01-19T09:43:06Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/579b9c961b84721684a661cd4bc467270b0b3349 fix Issue 13999 - Associative array literal with static array keys must now have matching key lengths Re-enable implicit length extension, eg. "abc" to char[5] https://github.com/D-Programming-Language/dmd/commit/356d52fc81d86735390bc7856c98d39c50a2b8d2 Merge pull request #4307 from 9rnsr/fix13999 [REG2.067a] Issue 13999 - Associative array literal with static array keys must now have matching key lengths