--- /dev/null
+// CS9030: The left-hand side of an assignment cannot contain a null propagating operator
+// Line: 15
+
+public class Test1
+{
+ public class Test2
+ {
+ public System.EventHandler<System.EventArgs> E;
+ }
+
+ public Test2 test2 = new Test2 ();
+
+ static void Main ()
+ {
+ new Test1 ()?.test2.E += null;
+ }
+}
public override Expression DoResolveLValue (ResolveContext ec, Expression right_side)
{
- if (ConditionalAccess)
+ if (HasConditionalAccess ())
Error_NullPropagatingLValue (ec);
if (spec is FixedFieldSpec) {
public override Expression DoResolveLValue (ResolveContext rc, Expression right_side)
{
- if (ConditionalAccess)
+ if (HasConditionalAccess ())
Error_NullPropagatingLValue (rc);
if (right_side == EmptyExpression.OutAccess) {
return null;
}
- if (ConditionalAccess)
+ if (HasConditionalAccess ())
Error_NullPropagatingLValue (ec);
op = CandidateToBaseOverride (ec, op);
public override Expression DoResolveLValue (ResolveContext ec, Expression right_side)
{
- if (ConditionalAccess)
+ if (HasConditionalAccess ())
Error_NullPropagatingLValue (ec);
return DoResolve (ec);