Thread overview
[Issue 20488] AA.length in multiple modules causes opDispatch failure
Jan 08, 2020
Simen Kjaeraas
Jan 09, 2020
FeepingCreature
Jan 09, 2020
Dlang Bot
Jan 13, 2020
Dlang Bot
Feb 07, 2020
Dlang Bot
January 08, 2020
https://issues.dlang.org/show_bug.cgi?id=20488

Simen Kjaeraas <simen.kjaras@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras@gmail.com
            Summary|Strange opDispatch error    |AA.length in multiple
                   |with multiple module        |modules causes opDispatch
                   |compilation and the use of  |failure
                   |hashmaps                    |

--- Comment #1 from Simen Kjaeraas <simen.kjaras@gmail.com> ---
Further reduced:

foo.d:
///////////////////////////
struct Foo {
    bool[int] aa;
    void fun() {
        int i = aa.length;
    }
}
///////////////////////////

bar.d:
///////////////////////////
struct Bar {
    int[int] aa;
    void fun() {
        this.f(aa.length);
    }
    void opDispatch (string s, Args...) (Args args) {
    }
}
///////////////////////////

Compile with 'dmd foo bar', and you get
  bar.d(4): Error: no property f for type bar.Bar

If the two AA types are identical it compiles.

Adding 'int j = (int[int]).init.length;' to S1.fun() does make it compile, but
only if it's before the 'int i = ...' line (wat).

--
January 08, 2020
https://issues.dlang.org/show_bug.cgi?id=20488

moonlightsentinel@disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |moonlightsentinel@disroot.o
                   |                            |rg
           Severity|normal                      |regression

--- Comment #2 from moonlightsentinel@disroot.org ---
Digger blames https://github.com/dlang/dmd/pull/8584

--
January 09, 2020
https://issues.dlang.org/show_bug.cgi?id=20488

FeepingCreature <default_357-line@yahoo.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |default_357-line@yahoo.de

--- Comment #3 from FeepingCreature <default_357-line@yahoo.de> ---
Further reduction:

struct Bar {
    void opDispatch(string s, Args...) (Args args) {
    }
    void fun() {
        (bool[int]).init.length;
        this.f((int[int]).init.length);
    }
}

Looking into it.

--
January 09, 2020
https://issues.dlang.org/show_bug.cgi?id=20488

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@FeepingCreature created dlang/dmd pull request #10718 "Fix issue 20488: opDispatch: copy call expression before checking for semantically valid parameters" fixing this issue:

- opDispatch: copy call expression before checking for semantically valid
parameters.
  This may avoid accidentally resolving future occurrences to the wrong type,
not sure.
  Fixes issue 20488.

https://github.com/dlang/dmd/pull/10718

--
January 13, 2020
https://issues.dlang.org/show_bug.cgi?id=20488

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #10718 "Fix issue 20488: opDispatch: copy call expression before checking for semantically valid parameters" was merged into stable:

- 78e214e75b464a2703115890ba6d3c60384c668b by Mathis Beer:
  opDispatch: only validate parameters if we've already seen indication of a
semantic failure.
  This avoids double evaluation of parameter semantic in some situations.
  Fixes issue 20488.

https://github.com/dlang/dmd/pull/10718

--
February 07, 2020
https://issues.dlang.org/show_bug.cgi?id=20488

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #10753 "Merge remote-tracking branch 'upstream/stable' into merge_stable" was merged into master:

- 65237abf9323434f5072a3f8b95a0824655522a8 by Mathis Beer:
  opDispatch: only validate parameters if we've already seen indication of a
semantic failure.
  This avoids double evaluation of parameter semantic in some situations.
  Fixes issue 20488.

https://github.com/dlang/dmd/pull/10753

--