Closed danijepg closed 8 years ago
This is definitely odd. A quick perusal of the relevant code makes it appear that this should be defaulting to int-type, and the attribute in question takes Object as its argument, so it's not being coerced to a Long.
I'll trace through this and see what's causing it when I get home.
I found the problem. In EmitAssembly.GetValue
, case NodeType.IntegerLiteralExpression
, it will pull the value out of the IntegerLiteralExpression
as a long rather than an int. I don't have time to fix this now, but I can check a fix in this evening if no one else codes it up first.
Fixed.
Thank you
Compiling this code in Boo (note I'm ommitting the literal 'L' for long):
Generates the following IL:
.custom instance void [FileHelpers]FileHelpers.FieldNullValueAttribute::.ctor(object) = ( 01 00 0A 03 00 00 00 00 00 00 00 00 00 )
While in C# 4.5 (similar code) generates:
.custom instance void [FileHelpers]FileHelpers.FieldNullValueAttribute::.ctor(object) = ( 01 00 08 03 00 00 00 00 00 )
As result, while compiling with Boo the attribute ctor receives a long and the c# compiled one receives an Int. This behaviour is pretty weird. Why is the 0 being interpreted as a long value by the compiler?
Is this a compiler bug in Boo, a design choice, or am I skipping something?