alavrik / piqi

Piqi – universal schema language: JSON, XML, Protocol Buffers data validation and conversion
http://piqi.org
Apache License 2.0
246 stars 36 forks source link

failing in assert when using "id" #2

Closed williamleferrand closed 13 years ago

williamleferrand commented 13 years ago

Hi there

Here are two files :

Ad.piqi :

.alias [ .name id .type int64 ]

Protocol.piqi:

.import [ .module Ad ]

.variant [ .name op .option [ .name ping ] .option [ .name get-balance .type Ad/id ] ]

Compilation fails with assert = false in piqi_common

Replacing "id" by "idb" solves the issue, so there might be a collision somewhere.

Happy hacking, and congrats for piqi by the way :)

william

williamleferrand commented 13 years ago

Well, this is not the right example: take the following Protocol.piqi :

% Piqi description of ops on the datastore

.import [ .module Ad ]

.variant [ .name reply
.option [ .name page .type Ad/id ] ]

.variant [ .name voidvarianttosolvepiqibug .option [ .name bad .type int ] ]

Removing the second variant breaks compilation.

thanks!

william

alavrik commented 13 years ago

Hi William,

Thanks for reporting the bug! I've just fixed it in "dev" branch.

I couldn't reproduce the workaround you mentioned. All the code that you've posted triggers the bug. I'd assume you are using some old version of Piqi. I suggest that you upgrade to the latest version in "dev" branch. I'll be cutting a new release from it this weekend.

Let me know if you have any problems. I'll be happy to help.

Anton

williamleferrand commented 13 years ago

Hi Anton,

thanks for this quick fix! I have a suggestion but I'll fill a new ticket for this.