You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 24, 2022. It is now read-only.
Incorrect FieldType resolution for closed generic. Test case:
using System;
public static class Program
{
public static class TmpClss<T>
{
public static T CallSite;
};
public static void Main(string[] args)
{
if (TmpClss<Action>.CallSite == null)
{
TmpClss<Action>.CallSite = () => Console.WriteLine("!");
}
var action = TmpClss<Action>.CallSite;
RunMe();
action();
}
public static void RunMe()
{
TmpClss<Action>.CallSite = () => Console.WriteLine("!!");
}
}
Translation:
function Program_Main (args) {
if ($T02().CallSite === null) {
$T02().CallSite = $T03().New(null, null, new JSIL.MethodPointerInfo($thisType, "$lMain$gb__0", $S00(), true, false));
}
var action = JSIL.CloneParameter(T, $T02().CallSite);
$thisType.RunMe();
action();
};
We have problem with next line: JSIL.CloneParameter(T, $T02().CallSite). Here field type is know at compile time - it is Action, so there should not be JSConditionalStructCopyExpression at all.
Root cause of this problem:
When we create MemberIdentifier for FieldReference, owner type for field is closed generic type. Unfortunately, FieldReference still treat its type as GenericParameter "T", instead of using resolved type from owner type.
Incorrect FieldType resolution for closed generic. Test case:
Translation:
We have problem with next line:
JSIL.CloneParameter(T, $T02().CallSite). Here field type is know at compile time - it isAction, so there should not beJSConditionalStructCopyExpressionat all.Root cause of this problem:
When we create
MemberIdentifierforFieldReference, owner type for field is closed generic type. Unfortunately, FieldReference still treat its type as GenericParameter "T", instead of using resolved type from owner type.