This commit is contained in:
parent
9ea935f0d8
commit
7d9786564d
|
|
@ -8976,11 +8976,12 @@ namespace PascalABCCompiler.NETGenerator
|
|||
}
|
||||
else
|
||||
{
|
||||
is_dot_expr = true;
|
||||
TypeInfo ti = helper.GetTypeReference(real_parameters[0].type);
|
||||
|
||||
real_parameters[0].visit(this);
|
||||
is_dot_expr = tmp;
|
||||
LocalBuilder tmp_lb = il.DeclareLocal(ti.tp);
|
||||
il.Emit(OpCodes.Stloc, tmp_lb);
|
||||
il.Emit(OpCodes.Ldloca, tmp_lb);
|
||||
|
||||
MethodInfo mi = null;
|
||||
if (real_parameters[0].type is IGenericTypeInstance)
|
||||
|
|
@ -9007,10 +9008,11 @@ namespace PascalABCCompiler.NETGenerator
|
|||
}
|
||||
else
|
||||
{
|
||||
is_dot_expr = true;
|
||||
TypeInfo ti = helper.GetTypeReference(real_parameters[1].type);
|
||||
real_parameters[1].visit(this);
|
||||
is_dot_expr = tmp;
|
||||
LocalBuilder tmp_lb = il.DeclareLocal(ti.tp);
|
||||
il.Emit(OpCodes.Stloc, tmp_lb);
|
||||
il.Emit(OpCodes.Ldloca, tmp_lb);
|
||||
MethodInfo mi = null;
|
||||
if (real_parameters[1].type is IGenericTypeInstance)
|
||||
mi = TypeBuilder.GetMethod(ti.tp, typeof(Nullable<>).GetMethod("get_HasValue"));
|
||||
|
|
|
|||
17
TestSuite/nullable12.pas
Normal file
17
TestSuite/nullable12.pas
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
begin
|
||||
var o := new class(field := default(byte?));
|
||||
o := nil;
|
||||
var a := o?.field = nil;
|
||||
assert(a);
|
||||
a := nil = o?.field;
|
||||
assert(a);
|
||||
a := o?.field <> nil;
|
||||
assert(not a);
|
||||
a := nil <> o?.field;
|
||||
assert(not a);
|
||||
var b: byte?;
|
||||
a := o?.field = b;
|
||||
assert(a);
|
||||
a := o?.field <> b;
|
||||
assert(not a);
|
||||
end.
|
||||
Loading…
Reference in a new issue