|
|
|
Test case and patch. However, I believe there may be a deeper issue here. The whole EmitAssembly.EmitLoadLiteralField method seems to suffer from a fundamental flaw: it effectively inlines the values of literal fields in any assembly you reference into your Boo IL, probably on the basis that literals cannot change at runtime. However, this is a versioning issue: if the values of these literals change in the assembly you link against, your inlined values are no longer correct and weirdness results (if my understanding is correct).
So, I think we can actually remove the method and replace its one call site with an instruction to emit a normal load field instruction (i.e. literalness of fields will not be branched on in EmitLoadField). By the way, I have opened a new issue (
Fixed in the repository. Thanks for the patch!!!
The test-case associated with this patch doesn' t seem to pass the unit tests?
Arron, the test case works for me. However, I notice that someone has added the CultureInfo paramater to the float display code: this may have solved the issue you were having?
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
>>> c as uint = 0xF0000000
-268435456
>>> c.GetType()
System.OverflowException: Value was either too large or too small for a UInt32.
at System.Convert.ToUInt32(Int32 value)
at System.Int32.System.IConvertible.ToUInt32(IFormatProvider provider)
at Boo.Lang.Runtime.RuntimeServices.UnboxUInt32(Object value) in f:\Programmi
ng\Current\Boo\src\Boo.Lang\Runtime\RuntimeServices.cs:line 1738
at Input23Module.Main(String[] argv)
>>> d as ulong = 0xF000000000000000l
-1152921504606846976
>>> d.GetType()
System.OverflowException: Value was either too large or too small for a UInt64.
at System.Convert.ToUInt64(Int64 value)
at System.Int64.System.IConvertible.ToUInt64(IFormatProvider provider)
at Boo.Lang.Runtime.RuntimeServices.UnboxUInt64(Object value) in f:\Programmi
ng\Current\Boo\src\Boo.Lang\Runtime\RuntimeServices.cs:line 1756
at Input25Module.Main(String[] argv)
Clearly since those are unsigned they should never report negative values! I will investigate this further tonight.