www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9215] New: [2.061 beta] isDymanicArray/DynamicArrayTypeOf broken for classes/interfaces with AliasThis

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9215

           Summary: [2.061 beta] isDymanicArray/DynamicArrayTypeOf broken
                    for classes/interfaces with AliasThis
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: code klickverbot.at



PST ---
Using DMD 2.061 beta 1, this code

---
import std.traits : DynamicArrayTypeOf;

interface Foo {
    final int aliasThis()  property { return 0; }
    alias aliasThis this;
}

pragma(msg, DynamicArrayTypeOf!(Foo[]));
---

leads to a rather interesting error message (note the missing location
information):

---
Error: function test.Foo.aliasThis () is not callable using argument types ()
inout
test.d(8): Error: template instance std.traits.DynamicArrayTypeOf!(Foo[]) error
instantiating
test.d(8):        while evaluating pragma(msg, DynamicArrayTypeOf!(Foo[]))
---

The culprit lies in the implementation of DynamicArrayTypeOf, but I didn't have
a closer look at it yet to figure out whether it is a DMD or a Phobos bug.

This issue causes isDynamicArray to silently return false for Foo[] as defined
above.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 26 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9215


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
          Component|Phobos                      |DMD
         Resolution|                            |DUPLICATE
           Severity|regression                  |normal



This is a dup of bug 9177 (it's a dmd bug), and is not a regression.
It reproduces from 2.057.

*** This issue has been marked as a duplicate of issue 9177 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 26 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9215


David Nadlinger <code klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |



PST ---
Reopened, as the issue wih isDynamicArray _is_ a regression, and for example
breaks std.array.popFront for arrays of classes with alias this. If
DynamicArrayTypeOf is broken, then please try to find a way to implement
isDynamicArray without relying on it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 27 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9215


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid
           Severity|normal                      |regression




 Reopened, as the issue wih isDynamicArray _is_ a regression, and for example
 breaks std.array.popFront for arrays of classes with alias this. If
 DynamicArrayTypeOf is broken, then please try to find a way to implement
 isDynamicArray without relying on it.
OK. The regression of isDynamicArray has been introduced by this Phobos change. https://github.com/D-Programming-Language/phobos/commit/43fdbc83a1e710f30f8fc6cf464636f69487267b After that, isDynamicArray depends on DynamicArrayTypeOf, and now the bug 9177 affects to both templates. We would be able to revert the Phobos change to fix the regression, but I'd like to recommend fixing bug 9177 to remove root issue. https://github.com/D-Programming-Language/dmd/pull/1385 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 27 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9215


Kenji Hara <k.hara.pg gmail.com> changed:

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



OK, by fixing bug 9177:

https://github.com/D-Programming-Language/dmd/commit/9f2d9eafacd75c22ea7a705151ee2a8e20a1638c

These results were also fixed as expected.

pragma(msg, DynamicArrayTypeOf!(Foo[])); // prints "Foo[]"
pragma(msg, isDynamicArray!(Foo[]));     // prints "true"

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 27 2012