You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2020/03/23 07:45:15 UTC

[GitHub] [royale-compiler] greg-dove commented on issue #126: Bad implicit casting to Function

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:
users@infra.apache.org


With regards,
Apache Git Services