www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 611] New: IsExpression fails when inside implemented interface

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

           Summary: IsExpression fails when inside implemented interface
           Product: D
           Version: 0.175
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: daekharel gmail.com


interface Interface(T) {
    static assert(is(T : Interface));
}

class Implementor : Interface!(Implementor) {}

-----
The above code generates the following error when compiling:

err.d(2): static assert  (is(Implementor : Interface)) is false

The assertion is self-evidently true; Implementor subtypes
Interface!(Implementor), so is(Implementor : Interface!(Implementor)) should be
true. This error occurs only when the assertion is contained within the
interface itself; if it is placed within the Implementor class definition or
outside, it compiles.


-- 
Nov 27 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-11-27:
 http://d.puremagic.com/issues/show_bug.cgi?id=611
 interface Interface(T) {
     static assert(is(T : Interface));
 }

 class Implementor : Interface!(Implementor) {}

 -----
 The above code generates the following error when compiling:

 err.d(2): static assert  (is(Implementor : Interface)) is false

 The assertion is self-evidently true; Implementor subtypes
 Interface!(Implementor), so is(Implementor : Interface!(Implementor)) should be
 true. This error occurs only when the assertion is contained within the
 interface itself; if it is placed within the Implementor class definition or
 outside, it compiles.
Added to DStress as http://dstress.kuehne.cn/compile/i/is_15_A.d http://dstress.kuehne.cn/compile/i/is_15_B.d http://dstress.kuehne.cn/compile/i/is_15_C.d http://dstress.kuehne.cn/compile/i/is_15_D.d http://dstress.kuehne.cn/compile/i/is_15_E.d http://dstress.kuehne.cn/compile/i/is_15_F.d http://dstress.kuehne.cn/compile/i/is_15_G.d http://dstress.kuehne.cn/compile/i/is_15_H.d http://dstress.kuehne.cn/compile/i/is_15_I.d http://dstress.kuehne.cn/compile/i/is_15_J.d http://dstress.kuehne.cn/compile/i/is_15_K.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFbgaQLK5blCcjpWoRAnjwAJ9l2MR9pFoQe4bvErBlqzUDUjZFjwCfRaAm JyGq5tKEq59eSOKPe/4T15E= =8DPF -----END PGP SIGNATURE-----
Nov 29 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=611


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |bugzilla digitalmars.com


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


Tim Shea <tim.m.shea gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tim.m.shea gmail.com


--- Comment #2 from Tim Shea <tim.m.shea gmail.com> 2012-03-19 12:10:45 PDT ---
Please correct me if I'm wrong, but this does not seem incorrect to me. In
fact, if the static assert compiles and passes outside the interface, I would
think that would be an issue. After all:

interface MyInterface(T) {
  static assert(is(T : MyInterface));
}
MyInterface(int) a;

Should compile to :

interface MyInterface(Int) {
  static assert(is(int : MyInterface(int));
}

This seems self evidently false to me. An integer does not convert to a
MyInterface(int), nor should it. Regardless of where the static assert is, I
would think it should fail.

I guess if you have something like:

interface Cloneable(T) {
  T clone();
}

then it makes sense to say:

class CloneableObject : Cloneable(CloneableObject) {...}

but I don't think it follows that a Cloneable(CloneableObject) should be
convertible back to a plain CloneableObject.

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