Wiki

Ticket #197: lambda-return.patch

File lambda-return.patch, 1.8 KB (added by hopscc, 15 years ago)
  • Source/Statements.cobra

     
    10831083                .throwError('Cannot return [expr.type.name] because "[curCodeMember.name]" is [suffix]') 
    10841084            expr.contextType = curCodeMember.resultType 
    10851085        else 
    1086             if curCodeMember.resultType is not .compiler.voidType 
     1086            if curCodeMember.resultType is not .compiler.voidType and  curCodeMember.resultType is not .compiler.passThroughType 
    10871087                .throwError('Return statement must return a [curCodeMember.resultType.name], or [curCodeMember.name] must have its return type removed.') 
    10881088        curCodeMember.hasReturnStmt = true 
    10891089        _backEndResultVarName = curCodeMember.backEndResultVarName 
  • Tests/320-misc-two/830-lambdas/300-lambdas-return.cobra

     
     1""" 
     2Ticket#197 spurious compile error on return in lambda/anon fn with no return 
     3""" 
     4sig Delg 
     5 
     6class DoX 
     7    def main is shared 
     8        i = 0 
     9        anon as Delg = do 
     10            if i > 7 
     11                return 
     12            assert i <=7 #print i  
     13         
     14        for i in 0: 10 
     15            anon() 
  • Developer/IntermediateReleaseNotes.text

     
    431431* Fixed: An uncaught exception can occur for some library calls. 
    432432 
    433433* Fixed: Cannot instantiate generic params under some circumstances. 
     434 
     435* Fixed: Spurious compiler error in void anon method with a return. Ticket#197