sq / JSIL

CIL to Javascript Compiler
http://jsil.org/
Other
1.73k stars 241 forks source link

Two "from x in y" linq clauses causes runtime exception #1017

Open phi1010 opened 8 years ago

phi1010 commented 8 years ago

A program using two from clauses will compile, but fail with an error message I don't understand (tested on http://jsil.org/try/). If I comment out the second from clause from a2 in Enumerable.Range(1, 20) it will run without any error.

using System;
using System.Collections.Generic;
using System.Linq;

namespace HelloWorld
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            long i = 0;
            var foo =
                from a1 in Enumerable.Range(1, 20)
                from a2 in Enumerable.Range(1, 20)
                select a1;
        }
    }
}
Unhandled exception: Error: No static method with signature 'System.Collections.Generic.IEnumerable`1[!!2] SelectMany$b3$55[!!0],58[!!0,55[!!1]],63[!!0,!!1,!!2]=55[!!2]<TSource, TCollection, TResult> (System.Collections.Generic.IEnumerable`1[!!0], System.Func`2[!!0, System.Collections.Generic.IEnumerable`1[!!1]], System.Func`3[!!0, !!1, !!2])' found in context '<System.Linq.Enumerable Public Interface>'
Error: No static method with signature 'System.Collections.Generic.IEnumerable`1[!!2] SelectMany$b3$55[!!0],58[!!0,55[!!1]],63[!!0,!!1,!!2]=55[!!2]<TSource, TCollection, TResult> (System.Collections.Generic.IEnumerable`1[!!0], System.Func`2[!!0, System.Collections.Generic.IEnumerable`1[!!1]], System.Func`3[!!0, !!1, !!2])' found in context '<System.Linq.Enumerable Public Interface>'
at Object.JSIL.RuntimeErrorFormat (http://jsil.org/try/Libraries/JSIL.Core.js:10450:9)
at JSIL.MethodSignature.$StaticMethodNotFound (http://jsil.org/try/Libraries/JSIL.Core.js:7828:8)
at MethodSignature_CallStatic$3$3$inlineCache1 (jsil://closure/MethodSignature.CallStatic$3$3$inlineCache1:10:10)
at Program_Main (eval at <anonymous> (http://jsil.org/try/output_frame.js:70:41), <anonymous>:62:22)
at window.runScript (http://jsil.org/try/output_frame.js:80:5)
at runTranslatedJS (http://jsil.org/try/index.js?v6:602:20)

I assume $b3$55 represents a specific overload of the method, but what does the [!!0],58[!!0,55[!!1]],63[!!0,!!1,!!2]=55[!!2] represent? This doesn't look similar to MSIL notation.