www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1133] New: Header generation omits parathesis

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

           Summary: Header generation omits parathesis
           Product: D
           Version: 1.011
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: benoit tionex.de


(1) does not compile

in the second example, all paranthesis for the static if are missing.
With (2) the problem starts.

========================================
= D code:
========================================
    public synchronized bool contains( dejavu.lang.JObject.JObject value ){
        return (( value in mData ) !is null );
    }
========================================
= Generated Header Code:
========================================
    bool containsKey(JObject key)
{
return key in mData !is null; //(1)
}

========================================
= D code:
========================================
T jarraycast(T, U )( U u ) {
    // elem -> []
    static if( isArrayArrayType!(T) ){
        static if( isArrayArrayType!(U) ){
            //pragma( msg, "[][]->[][] jarraycast!( " ~ demangleType!(
T.mangleof ) ~ ", " ~ demangleType!( U.mangleof ) ~ ")" );
            static assert( false );
        }
        else static if( isArrayType!(U) ){
            //pragma( msg, "[]->[][] jarraycast!( " ~ demangleType!( T.mangleof
) ~ ", " ~ demangleType!( U.mangleof ) ~ ")" );
            static assert( false );
        }
        else static if( is( U : JObject )){
            //pragma( msg, "obj->[][] jarraycast!( " ~ demangleType!(
T.mangleof ) ~ ", " ~ demangleType!( U.mangleof ) ~ ")" );
            static assert( false );
        }
        else {
            //pragma( msg, "err1: jarraycast!( " ~ demangleType!( T.mangleof )
~ ", " ~ demangleType!( U.mangleof ) ~ ")" );
            static assert( false );
        }
    }
    else static if( isArrayType!(T) ){
        static if( isArrayArrayType!(U) ){
            ////pragma( msg, "[][]->[] jarraycast!( " ~ demangleType!(
T.mangleof ) ~ ", " ~ demangleType!( U.mangleof ) ~ ")" );
            alias ElemType!(T) TE;
            alias ElemType!(U) UE;
            T res;
            res.length = u.length;
            for( int i = 0; i < u.length; i++ ){
                res[i] = jarraycast!(TE,UE)(u[i]);
            }
            return res;
        }
        else static if( isArrayType!(U) ){
            ////pragma( msg, "[]->[] jarraycast!( " ~ demangleType!( T.mangleof
) ~ ", " ~ demangleType!( U.mangleof ) ~ ")" );
            alias ElemType!(T) TE;
            return arraycast!(TE)(u);
        }
        else static if( is( U : JObject )){
            //pragma( msg, "obj->[] jarraycast!( " ~ demangleType!( T.mangleof
) ~ ", " ~ demangleType!( U.mangleof ) ~ ")" );
            JArrayT!(T) uarr = cast( JArrayT!(T) ) u;
            if( uarr is null ){
                return null;
            }
            else{
                return uarr.toArray();
            }
        }
        else {
            //pragma( msg, "err2: jarraycast!( " ~ demangleType!( T.mangleof )
~ ", " ~ demangleType!( U.mangleof ) ~ ")" );
            static assert( false );
        }
    }
    else static if( is( T : JObject )){
        static if( isArrayType!(U) ){
            //pragma( msg, "[]->obj jarraycast!( " ~ demangleType!( T.mangleof
) ~ ", " ~ demangleType!( U.mangleof ) ~ ")" );
            return JArrayT!(U).create( u );
        }
        else static if( is( U : JObject )){
            //pragma( msg, "obj->obj jarraycast!( " ~ demangleType!( T.mangleof
) ~ ", " ~ demangleType!( U.mangleof ) ~ ")" );
            static assert( false );
        }
        else {
            //pragma( msg, "err3: jarraycast!( " ~ demangleType!( T.mangleof )
~ ", " ~ demangleType!( U.mangleof ) ~ ")" );
            static assert( false );
        }
    }
    else {
        //pragma( msg, "err4: jarraycast!( " ~ demangleType!( T.mangleof ) ~ ",
" ~ demangleType!( U.mangleof ) ~ ")" );
        static assert( false );
    }
    //return null;
}

========================================
= Generated Header Code:
========================================
template jarraycast(T,U)
{
T jarraycast(U u)
{
static if(isArrayArrayType!(T))
static if(isArrayArrayType!(U))
static assert(false);
else
static if(isArrayType!(U))
static assert(false);
else
static if(is(U : JObject))
static assert(false);
else
static assert(false);



else
static if(isArrayType!(T))
static if(isArrayArrayType!(U)) //(2)
alias ElemType!(T) TE;
alias ElemType!(U) UE;
T res;
res.length = u.length;
{
for (int i = 0;
 i < u.length; i++)
{
{
res[i] = jarraycast!(TE,UE)(u[i]);
}
}
}
return res;
else
static if(isArrayType!(U))
alias ElemType!(T) TE;
return arraycast!(TE)(u);
else
static if(is(U : JObject))
JArrayT!(T) uarr = cast(JArrayT!(T))u;
if (uarr is null)
{
return null;
}
else
{
return uarr.toArray();
}
else
static assert(false);



else
static if(is(T : JObject))
static if(isArrayType!(U))
return JArrayT!(U).create(u);
else
static if(is(U : JObject))
static assert(false);
else
static assert(false);


else
static assert(false);



}
}

========================================


-- 
Apr 12 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1133






They are also omited after version:


.d

version(id) { x; y; } else { z; h; }

.di

version(id) x; y; else { z; h; }


-- 
May 24 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1133






-------
I can confirm that the static ifs are still losing the braces in DMD 1.015.


-- 
Jun 12 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1133


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
            Summary|Header generation omits     |Header generation omits
                   |parathesis                  |parentheses





What exactly is this header generation to which you refer?


-- 
Sep 29 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1133







 What exactly is this header generation to which you refer?
 
"dmd -H" --
Sep 29 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1133






Oh yes.  But it's puzzling me that, in the first example, the generated header
code seems to bear little relation to the original code.


-- 
Sep 29 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1133







 Oh yes.  But it's puzzling me that, in the first example, the generated header
 code seems to bear little relation to the original code.
 
yes, i probably hand edited the code to cut out unrelevant info. So the value was renamed to key. Nevertheless it shows that the necessary braces are missing. --
Sep 29 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1133






1.039 works correctly for first example. Second is not reproductible, next time
send full examples.



class A {
        Object[Object] mData;

    public synchronized bool contains( Object value ){
            return (( value in mData ) !is null );
    }
}


// D import file generated from 'd1.d'
class A
{
    Object[Object] mData;
    public
{
    synchronized
{
    bool contains(Object value)
{
return (value in mData) !is null;
}
}
}
}



// D import file generated from 'd1.d'
class A
{
    Object[Object] mData;
    public
{
    synchronized
{
    bool contains(Object value)
{
return (value in mData) !is null;
}
}
}
}


-- 
Mar 07 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1133


Don <clugdbug yahoo.com.au> changed:

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



This was fixed in 1.037, 1.038, or 1.039.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 28 2009