greg-dove commented on issue #126: Bad implicit casting to Function
URL: https://github.com/apache/royale-compiler/issues/126#issuecomment-602435407
 
 
   Hi Yishay, I added that implicit casting for complex types , so feel obliged 
to fix it.
   
   But so far I could not repro. 
   Is there anything more specific you can share about the original scenario 
that would help me test it in a local repro?
   
   I tried this:
   
   ``` private var _func:Function;
           public function get labelFunction():Function{
               if (_func == null) {
                   _func = function(whatever:Object):String {return 'whatever'}
               }
               return _func;
           }
           
           [Test]
           public function test():void
           {
               var text:String = labelFunction({ }).toString();
               RoyaleUnitTestRunner.consoleOut(text);
               var selfRef:LanguageTesterTestImplicitCast = this;
               //try via member access
               text = selfRef.labelFunction({}).toString();
               RoyaleUnitTestRunner.consoleOut(text);
               assertTrue(true, 'not yet a test');
   
           }
   ```
   But the output from the above looks like: 
   
   ```/**
    * @export
    */
   flexUnitTests.language.LanguageTesterTestImplicitCast.prototype.test = 
function() {
     var /** @type {string} */ text = this.labelFunction({}).toString();
     testshim.RoyaleUnitTestRunner.consoleOut(text);
     var /** @type {flexUnitTests.language.LanguageTesterTestImplicitCast} */ 
selfRef = this;
     text = selfRef.labelFunction({}).toString();
     testshim.RoyaleUnitTestRunner.consoleOut(text);
     org.apache.royale.test.asserts.assertTrue(true, 'not yet a test');
   };
   ```
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to