Saltarelle / SaltarelleCompiler

C# to JavaScript compiler – Now http://bridge.net
http://saltarelle-compiler.com
Other
297 stars 74 forks source link

Compiler internal error with async lambda #333

Open n9 opened 10 years ago

n9 commented 10 years ago

Let's have the following simplified code:

    public class A
    {
        static void C<T>(TaskCompletionSource<T> taskSource, Func<Task<T>> source)
        {
        }

        public void B()
        {
            TaskCompletionSource<object> ts = null;
            Task a = null;
            C(ts, async () =>
            {
                await a;
                return null;
            });
        }
    }

I will output this error:

INTERNAL ERROR: ResolveResult [CSharpInvocationResolveResult [SpecializedMethod A.C[System.Object](taskSource:System.Threading.Tasks.TaskCompletionSource`1[[System.Object]], source:System.Func`1[[System.Threading.Tasks.Task`1[[System.Object]]]]):System.Void]] is an error.. Please report this as an issue on https://github.com/erik-kallen/SaltarelleCompiler/
n9 commented 10 years ago

Workaround is to replace return null; with return (object)null;.

erik-kallen commented 10 years ago

Noted, but I don't think it will be fixed until the Roslyn version