Wiki

Ticket #170: multiarg-inferType-cast.patch

File multiarg-inferType-cast.patch, 1.9 KB (added by hopscc, 8 years ago)
  • Source/Statements.cobra

     
    15151515            else 
    15161516                return false 
    15171517        if all for e in _rvals get e inherits Literal or e inherits DotExpr or e inherits MemberExpr or _ 
    1518                 (e inherits IdentifierExpr and (e to IdentifierExpr).name not in tnames)  
     1518            e inherits AbstractToExpr or _ 
     1519            (e inherits IdentifierExpr and (e to IdentifierExpr).name not in tnames)  
    15191520            return true  
    15201521        return false 
    15211522         
  • Tests/320-misc-two/810-multi-assignment/300-multiAssign-comma-sep.cobra

     
    1313        ma.literals 
    1414        ma.variables 
    1515        ma.exprs 
     16        ma.cast 
    1617        ma.asExpected 
    1718        ma.swap 
    1819         
     
    8990    def geti(i as int) as int 
    9091        return i+2 
    9192 
     93    def cast    # post tkt170 fix 
     94        x = 'aoeu' to Object 
     95        y = 5 to Object 
     96        a, b = x to String, y to int 
     97        assert a.length == 4 
     98        assert b * 2 == 10 
     99     
     100        c, d = x to? String, y to? int 
     101        assert c.length == 4 
     102        assert d * 2 == 10 
     103         
    92104    def asExpected 
    93105        # test expression values are pinned outside assignment stream 
    94106        a,b = c=2,3 
  • Developer/IntermediateReleaseNotes.text

     
    4444 
    4545* Support covariance from arrays to arrays and streams.  ticket:162 
    4646 
     47* Fix for Multitarget assignment not inferring types of cast expressions. ticket:170 
    4748 
    4849================================================================================ 
    4950Library