daokoder / dao-modules

Dao Standard Modules
http://daovm.net
12 stars 5 forks source link

Bug: type matching issue with ternary operator #79

Closed dumblob closed 9 years ago

dumblob commented 9 years ago

dao -e 'x = 5 == 5 ? (x=5,) : (x=9,)'

[[ERROR]] in file "command line codes":
  At line 0 : Invalid function definition --- " __main__() ";
  At line 1 : Invalid virtual machine instruction --- " MOVE:5,1,6 ";
In code snippet:
      8 :  MOVE_PP     :     4 ,     0 ,     5 ;     1;   ? (x=5,) : (x=9,)
>>    9 :  MOVE        :     5 ,     1 ,     6 ;     1;   x = 5 == 5 ? (x=5,) : (x...
     10 :  RETURN      :     5 ,     1 ,     0 ;     1;   )
  At line 1 : Invalid operation on the type --- " x = 5 == 5 ? (x=5,) : (x=9,) ";
  At line 1 : Types not matching --- " 'tuple<x:int>' for 'bool' ";
dumblob commented 9 years ago

Pardon, I'm moving this issue from dao-modules to dao: https://github.com/daokoder/dao/issues/507 .