Boo

Allow arithmetic operations with nullables

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 0.8.1
  • Fix Version/s: 0.8.2
  • Component/s: None
  • Labels:
    None
  • Testcase included:
    yes
  • Number of attachments :
    0

Description

na as int? = 30
nb as int? = 12
nn as int? #no value
no as int?
c = 42

assert c == na+nb
assert null == na+nn
try:
c = na+nn
except InvalidOperationException:
print "an nullable arithmetic with one operand without value cannot be cast to an non-nullable"

na *= 2
assert 60 == na

Issue Links

Activity

Hide
Cedric Vivier added a comment - - edited

partially fixed in rev. 2901

testcase is net2/generics/nullable-3.boo

arithmetic works when all nullables have value.
need to add some temp locals and HasValue tests to handle mixed null/value ops.
(will also optimize nullable==non-null-value tests)

Show
Cedric Vivier added a comment - - edited partially fixed in rev. 2901 testcase is net2/generics/nullable-3.boo arithmetic works when all nullables have value. need to add some temp locals and HasValue tests to handle mixed null/value ops. (will also optimize nullable==non-null-value tests)
Hide
Cedric Vivier added a comment -

fixed in rev. 2960

Show
Cedric Vivier added a comment - fixed in rev. 2960

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: