[dmd-internals] [D-Programming-Language/dmd] e9adb9: Add Expression.checkType to disthinguish two simil...

GitHub via dmd-internals dmd-internals at puremagic.com
Fri Feb 5 04:00:40 PST 2016


  Branch: refs/heads/master
  Home:   https://github.com/D-Programming-Language/dmd
  Commit: e9adb9eff0fe33a32a6e788b0a2bbf038fdb66a4
      https://github.com/D-Programming-Language/dmd/commit/e9adb9eff0fe33a32a6e788b0a2bbf038fdb66a4
  Author: k-hara <k.hara.pg at gmail.com>
  Date:   2016-02-05 (Fri, 05 Feb 2016)

  Changed paths:
    M src/expression.d
    M src/expression.h
    M src/mtype.d
    M src/statement.d
    M test/fail_compilation/diag11727.d
    M test/fail_compilation/fail15550.d
    M test/fail_compilation/fail240.d
    M test/fail_compilation/fail248.d
    M test/fail_compilation/fail325.d
    M test/fail_compilation/fail_casting2.d
    M test/fail_compilation/ice12907.d

  Log Message:
  -----------
  Add Expression.checkType to disthinguish two similar error checks

Many expressions takes non-void valid expressions. To check it,
`Expression.checkValue` exists (before it had been called `Expression.rvalue()`).

However, `ReturnStatement` and `CastExp` take an expression which can be void.
In both cases they will reject same invalid expressions, but the two are not same.

Name it `checkType`, then use it to make language behavior clearer.

Additional notes:
1. In `CastExp.semanic`, if `to` is specified, it's analyzed before the `e1`,
   in order to call `inferType(e1, to)` for explicit template lambda instantiations.
2. In `TypeTypeof.resolve`, we cannot easily use `checkType`, because
   historically templates are accepted as a typeof operand.


  Commit: a5ca389872cabea0fd53a38a179388e4d332382a
      https://github.com/D-Programming-Language/dmd/commit/a5ca389872cabea0fd53a38a179388e4d332382a
  Author: Martin Nowak <code at dawg.eu>
  Date:   2016-02-05 (Fri, 05 Feb 2016)

  Changed paths:
    M src/expression.d
    M src/expression.h
    M src/mtype.d
    M src/statement.d
    M test/fail_compilation/diag11727.d
    M test/fail_compilation/fail15550.d
    M test/fail_compilation/fail240.d
    M test/fail_compilation/fail248.d
    M test/fail_compilation/fail325.d
    M test/fail_compilation/fail_casting2.d
    M test/fail_compilation/ice12907.d

  Log Message:
  -----------
  Merge pull request #5400 from 9rnsr/refactor_checkType

Refactor: Add Expression.checkType to disthinguish two similar error checks


Compare: https://github.com/D-Programming-Language/dmd/compare/1ea699106e92...a5ca389872ca


More information about the dmd-internals mailing list