I wanted to try out the new typed functions and I’m getting lots of errors. 
Here’s what I tried:

1. I converted a bunch of function. declarations in Core:
diff --git 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/object/defineGetter.as
 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/object/defineGetter.as
index 6fb9ce411a..50adfadbbe 100644
--- 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/object/defineGetter.as
+++ 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/object/defineGetter.as
@@ -28,7 +28,7 @@ package org.apache.royale.utils.object
         *  @royalesuppressexport
         */
     COMPILE::JS
-    public function 
defineGetter(obj:Object,prop:String,getterFunction:Function):void
+    public function defineGetter(obj:Object,prop:String,getterFunction:() => 
*):void
     {
             Object.defineProperty(obj, prop, {"get": getterFunction});
         }


diff --git 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/async/IAsyncTask.as
 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/async/IAsyncTask.as
index 9f3565ff14..c6b7402a6d 100644
--- 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/async/IAsyncTask.as
+++ 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/async/IAsyncTask.as
@@ -20,8 +20,8 @@ package org.apache.royale.utils.async
 {
        public interface IAsyncTask
        {
-               function done(callback:Function):IAsyncTask;
-               function exec(callback:Function):IAsyncTask;
+               function done(callback:(task:IAsyncTask) => void):IAsyncTask;
+               function exec(callback:(task:IAsyncTask) => void):IAsyncTask;
                function run(data:Object=null):void;
 
                function complete():void;


diff --git 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/async/AsyncTask.as
 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/async/AsyncTask.as
index 541b3827be..47a71323de 100644
--- 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/async/AsyncTask.as
+++ 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/async/AsyncTask.as
@@ -136,7 +136,7 @@ package org.apache.royale.utils.async
      *  @playerversion AIR 2.6
      *  @productversion Royale 0.9.6
      */
-    public function done(callback:Function):IAsyncTask{
+    public function done(callback:(task:IAsyncTask) => void):IAsyncTask{
       if(_status == "complete" || _status == "failed"){
         callback(this);
         return this;
@@ -158,7 +158,7 @@ package org.apache.royale.utils.async
      *  @playerversion AIR 2.6
      *  @productversion Royale 0.9.13
      */
-    public function exec(callback:Function):IAsyncTask
+    public function exec(callback:(task:IAsyncTask) => void):IAsyncTask
     {
       done(callback);
       run();
@@ -200,7 +200,7 @@ package org.apache.royale.utils.async
      * Keep references to event listeners for automatic cleanup
      */
     COMPILE::JS
-    override public function addEventListener(type:String, handler:Function, 
useCapture:Boolean = false, scope:Object = null):void
+    override public function addEventListener(type:String, handler:(ev:Event) 
=> void, useCapture:Boolean = false, scope:Object = null):void
     {
       super.addEventListener(type,handler,useCapture,scope);
       if(!listeners)
@@ -214,7 +214,7 @@ package org.apache.royale.utils.async
       });
     }
     COMPILE::SWF
-    override public function addEventListener(type:String, listener:Function, 
useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = 
false):void
+    override public function addEventListener(type:String, listener:(ev:Event) 
=> void, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean 
= false):void
     {
       if(!listeners)
       {
2. I compiled Core
3. I opened my project
4. I got a bunch of:
Unexpected exception 'java.lang.NullPointerException' with message 
'${exceptionMessage}' at 
org.apache.royale.compiler.internal.tree.as.FunctionTypeExpressionNode.parseSignature:195
        
org.apache.royale.compiler.internal.tree.as.FunctionTypeExpressionNode.createTypeNodeFromParameterDefinition:246
        
org.apache.royale.compiler.internal.tree.as.FunctionTypeExpressionNode.createFromFunctionDefinition:157
        
org.apache.royale.compiler.internal.semantics.MethodBodySemanticChecker.checkFormalsVsActuals:1180
        
org.apache.royale.compiler.internal.semantics.MethodBodySemanticChecker.checkFunctionCall:1474
        
org.apache.royale.compiler.internal.as.codegen.ABCGeneratingReducer.reduce_functionAsMemberExpr:3890
        
org.apache.royale.compiler.internal.as.codegen.CmcEmitter.action_349:5971
        
org.apache.royale.compiler.internal.as.codegen.CmcEmitter.dispatchAction:9331
        
org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduceAntecedent:40375
        
org.apache.royale.compiler.internal.as.codegen.CmcEmitter.dispatchAction:7568
        
org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduceAntecedent:40375
        
org.apache.royale.compiler.internal.as.codegen.CmcEmitter.dispatchAction:10191
        
org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduceAntecedent:40375
        org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduce:40352
        
org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduceSubgoals:40403
        
org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduceAntecedent:40374
        org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduce:40352
        
org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduceSubgoals:40394
        
org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduceAntecedent:40374
        org.apache.royale.compiler.internal.as.codegen.CmcEmitter.reduce:40352
        org.apache.royale.compiler.internal.as.codegen.CmcEmitter.burm:40654
        
org.apache.royale.compiler.internal.as.codegen.ABCGenerator.generateInstructions:235
        
org.apache.royale.compiler.internal.as.codegen.ABCGenerator.generateMethodBodyForFunction:416
        
org.apache.royale.compiler.internal.as.codegen.ABCGenerator.generateMethodBodyForFunction:370
        
org.apache.royale.compiler.internal.as.codegen.ABCGenerator.generateFunction:272
        
org.apache.royale.compiler.internal.as.codegen.ClassDirectiveProcessor.declareFunction:891
        
org.apache.royale.compiler.internal.as.codegen.DirectiveProcessor.processNode:218
        
org.apache.royale.compiler.internal.as.codegen.DirectiveProcessor.traverse:192
        
org.apache.royale.compiler.internal.as.codegen.GlobalDirectiveProcessor.declareClass:462
        
org.apache.royale.compiler.internal.as.codegen.DirectiveProcessor.processNode:210
        
org.apache.royale.compiler.internal.as.codegen.DirectiveProcessor.traverse:192
        
org.apache.royale.compiler.internal.as.codegen.GlobalDirectiveProcessor.declarePackage:488
        
org.apache.royale.compiler.internal.as.codegen.DirectiveProcessor.processNode:227
        
org.apache.royale.compiler.internal.as.codegen.DirectiveProcessor.traverse:192
        org.apache.royale.compiler.internal.as.codegen.ABCGenerator.generate:126
        
org.apache.royale.compiler.internal.units.ASCompilationUnit.handleABCBytesRequest:412
        
org.apache.royale.compiler.internal.units.CompilationUnitBase.processABCBytesRequest:876
        
org.apache.royale.compiler.internal.units.CompilationUnitBase$4$1.call:313
        
org.apache.royale.compiler.internal.units.CompilationUnitBase$4$1.call:309
        
org.apache.royale.compiler.internal.units.requests.RequestMaker$1.call:228
        
org.apache.royale.compiler.internal.units.requests.RequestMaker$1.call:222
        java.util.concurrent.FutureTask.run:264
        java.util.concurrent.ThreadPoolExecutor.runWorker:1128
        java.util.concurrent.ThreadPoolExecutor$Worker.run:628
        java.lang.Thread.run:829

Reply via email to