ResolveResult ResolveNullCoalescingOperator(ResolveResult lhs, ResolveResult rhs)
{
if (NullableType.IsNullable(lhs.Type)) {
IType a0 = NullableType.GetUnderlyingType(lhs.Type);
if (TryConvert(ref rhs, a0)) {
return BinaryOperatorResolveResult(a0, lhs, BinaryOperatorType.NullCoalescing, rhs);
}
}
if (TryConvert(ref rhs, lhs.Type)) {
return BinaryOperatorResolveResult(lhs.Type, lhs, BinaryOperatorType.NullCoalescing, rhs);
}
if (TryConvert(ref lhs, rhs.Type)) {
return BinaryOperatorResolveResult(rhs.Type, lhs, BinaryOperatorType.NullCoalescing, rhs);
} else {
return new ErrorResolveResult(lhs.Type);
}
}
#endregion