Bug in XML and Macros on svn 3863

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug in XML and Macros on svn 3863

Nemea Lion
Hi

I just found a bug in the XML Class for revision 3863, when parsing a xml string with Xml.parse() inside a macro call,
you get an xml with a bunch of null attributes with null value for each attribute in a node.

Here is the simplest case to reproduce

#if macro
import haxe.macro.Expr;
import haxe.macro.Context;
#end

class Bug{
        public static var myXmlString:String = '<myType object="something" constructor="blabla" id="1"/>';
        public static var myXmlObject:Xml = Xml.parse(myXmlString);

        public static function main(){
                trace("xml:" + myXmlObject);
        }

        @:macro public static function test():Expr{
                trace("xml:" + myXmlObject);

                return {pos:Context.currentPos(),expr:EBlock([])};
        }
}

When run with:

haxe -x Bug:
Bug.hx:11: xml:<myType id="1" object="something" constructor="blabla"/>

haxe --macro Bug.test()
Bug.hx:18: xml:<myType null="null" null="null" null="null"/>

You see, each attribute and its value were replaced with null="null"

Last I was using rev. 3817 and both cases trace the correct xml,
however, the traces have the attributes in different order, (not important)

Both versions were compiled with cygwin on windows 7.

I realized the bug because I construct a lot of classes with xml files, and this completely broke my code.

Thanks!

Carlos Delgado

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Bug in XML and Macros on svn 3863

Nicolas Cannasse
Le 27/07/2011 21:07, Nemea Lion a écrit :
> Hi
>
> I just found a bug in the XML Class for revision 3863, when parsing a
> xml string with Xml.parse() inside a macro call,
> you get an xml with a bunch of null attributes with null value for each
> attribute in a node.
>
> Here is the simplest case to reproduce

I can't reproduce with r3864, make sure you update both your haxe binary
and std library as well.

Nicolas

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Bug in XML and Macros on svn 3863

Nemea Lion
Mmm, just got and compiled r3864 and still got the same result.
Double checked that both the binary and the std are the correct ones.
What else can I check?.

Carlos

2011/7/27 Nicolas Cannasse <[hidden email]>
Le 27/07/2011 21:07, Nemea Lion a écrit :

Hi

I just found a bug in the XML Class for revision 3863, when parsing a
xml string with Xml.parse() inside a macro call,
you get an xml with a bunch of null attributes with null value for each
attribute in a node.

Here is the simplest case to reproduce

I can't reproduce with r3864, make sure you update both your haxe binary and std library as well.

Nicolas

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Bug in XML and Macros on svn 3863

Nicolas Cannasse
Le 27/07/2011 21:27, Nemea Lion a écrit :
> Mmm, just got and compiled r3864 and still got the same result.
> Double checked that both the binary and the std are the correct ones.
> What else can I check?.

My bad, I just run with -x

It's now fixed in r3865, thanks for reporting.

Nicolas

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Bug in XML and Macros on svn 3863

Nemea Lion
Indeed, it's fixed in the test case, but now I'm getting

File "typeload.ml", line 138, characters 13-19: Assertion failed

when compiling my (full) code, don't know how to narrow down the
error with just this information, this didn't happen with 3864 and 63,
just the null="null" error.


Carlos Delgado

2011/7/27 Nicolas Cannasse <[hidden email]>
Le 27/07/2011 21:27, Nemea Lion a écrit :

Mmm, just got and compiled r3864 and still got the same result.
Double checked that both the binary and the std are the correct ones.
What else can I check?.

My bad, I just run with -x

It's now fixed in r3865, thanks for reporting.


Nicolas

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Bug in XML and Macros on svn 3863

Nemea Lion
Mmm, just checked, and indeed, this was the error that made me try the newer revisions,
as it happened in 3817.

2011/7/27 Nemea Lion <[hidden email]>
Indeed, it's fixed in the test case, but now I'm getting

File "typeload.ml", line 138, characters 13-19: Assertion failed

when compiling my (full) code, don't know how to narrow down the
error with just this information, this didn't happen with 3864 and 63,
just the null="null" error.


Carlos Delgado

2011/7/27 Nicolas Cannasse <[hidden email]>
Le 27/07/2011 21:27, Nemea Lion a écrit :

Mmm, just got and compiled r3864 and still got the same result.
Double checked that both the binary and the std are the correct ones.
What else can I check?.

My bad, I just run with -x

It's now fixed in r3865, thanks for reporting.


Nicolas

--
haXe - an open source web programming language
http://haxe.org



--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Bug in XML and Macros on svn 3863

Nemea Lion
Never mind, I was missusing TypeParam.

Carlos Delgado

2011/7/27 Nemea Lion <[hidden email]>
Mmm, just checked, and indeed, this was the error that made me try the newer revisions,
as it happened in 3817.


2011/7/27 Nemea Lion <[hidden email]>
Indeed, it's fixed in the test case, but now I'm getting

File "typeload.ml", line 138, characters 13-19: Assertion failed

when compiling my (full) code, don't know how to narrow down the
error with just this information, this didn't happen with 3864 and 63,
just the null="null" error.


Carlos Delgado

2011/7/27 Nicolas Cannasse <[hidden email]>
Le 27/07/2011 21:27, Nemea Lion a écrit :

Mmm, just got and compiled r3864 and still got the same result.
Double checked that both the binary and the std are the correct ones.
What else can I check?.

My bad, I just run with -x

It's now fixed in r3865, thanks for reporting.


Nicolas

--
haXe - an open source web programming language
http://haxe.org




--
haXe - an open source web programming language
http://haxe.org