Details
Description
Two issues:
nullable types in Boo don't support implicit casting
nullable types HasValue occasionally flips out.
booish output below:
>>> testVar = Nullable[of long]()
>>> testVar = 3 #int
--------------^
ERROR: Cannot convert 'int' to 'System.Nullable`1[[System.Int64, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.
>>> testVar = 3L #long
3
>>> testVar = {'1' : DBNull.Value }['1'] #assign null value
>>> testVar.HasValue
System.InvalidCastException: Specified cast is not valid.
at Input25Module.Main(String[] argv)
>>> testVar = 4L
4
>>> testVar.HasValue
true
>>>
Issue Links
| This issue relates to: | ||||
| BOO-805 | Can't use == on nullable types |
|
|
|
| This issue is related to: | ||||
| BOO-820 | Honor generic parameter constraints when constructing generic types |
|
|
|
| This issue is superceded by: | ||||
| BOO-985 | Allow arithmetic operations with nullables |
|
|
|
| This issue is depended upon by: | ||||
| BOO-822 | Interpretator incorrectly adds two nullable decimals |
|
|
|
Third issue is that the compiler does not generate an error when declaring "x as Nullable of string" or other non-valuetype.