sq / JSIL

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

Negation of nullable bool translation error #997

Open iskiselev opened 8 years ago

iskiselev commented 8 years ago

JSIL was unable to translate negation of nullable bool. Here is test calse:

using System;

public static class Program
{
    public static void Main()
    {
        bool? value1 = !GetNullBool();
        Console.WriteLine(value1 == null ? "null" : "not null");
        Console.WriteLine(value1 == true ? "true" : "false");
    }

    public static bool? GetNullBool()
    {
        return true;
    }
}

Translation result:

var value = JSIL.UntranslatableInstruction("nullableof:valuetype [mscorlib]System.Nullable`1<bool>(logicnot:bool(valueof:bool(call:valuetype [mscorlib]System.Nullable`1<bool>(Program::GetNullBool))))");