[dmd-internals] [D-Programming-Language/dmd] f78a77: fix Issue 10684 - Refused array op with array lite...

GitHub noreply at github.com
Thu Oct 17 23:53:16 PDT 2013


  Branch: refs/heads/master
  Home:   https://github.com/D-Programming-Language/dmd
  Commit: f78a770f469fcc60d450e1b9fcd03fbc9ffb010d
      https://github.com/D-Programming-Language/dmd/commit/f78a770f469fcc60d450e1b9fcd03fbc9ffb010d
  Author: k-hara <k.hara.pg at gmail.com>
  Date:   2013-10-16 (Wed, 16 Oct 2013)

  Changed paths:
    M src/arrayop.c
    M src/expression.h
    M test/runnable/arrayop.d

  Log Message:
  -----------
  fix Issue 10684 - Refused array op with array literal

Accept array literals as the operand of array-ops.

---

Since, array-ops had required explicit slice to the array literal operands,
eg. `a[] = [1,2][] + c[];`

By the commit:
https://github.com/9rnsr/dmd/commit/f703c5c6551affddd9213f759657a2b3e391b935
now the redundant slice operators at the right side of an array literal is
entirely removed - `[1,2,3][][]` is rewritten to `[1,2,3]`.

Although it has broke existing code using array-ops, I still cannot think
the optimization was incorrect.

On the other hand, I could not find the description about the necessity of
explicit slice on array literal from the language spec.
http://dlang.org/arrays.html#array-operations
It looked to me that is just an implementation-specific restriction.

So, I implemented this as the easiest way to fix the issue.


  Commit: f39979fde3b2000047c6aae652a42db5572a2a38
      https://github.com/D-Programming-Language/dmd/commit/f39979fde3b2000047c6aae652a42db5572a2a38
  Author: Walter Bright <walter at walterbright.com>
  Date:   2013-10-17 (Thu, 17 Oct 2013)

  Changed paths:
    M src/arrayop.c
    M src/expression.h
    M test/runnable/arrayop.d

  Log Message:
  -----------
  Merge pull request #2672 from 9rnsr/fix10684

[REG2.063][enh] Issue 10684 - Refused array op with array literal


Compare: https://github.com/D-Programming-Language/dmd/compare/e7022d89a452...f39979fde3b2


More information about the dmd-internals mailing list