dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.92k stars 4.01k forks source link

Verify the result of nullability analysis on an event assignment #29969

Open jcouv opened 6 years ago

jcouv commented 6 years ago

        public override BoundNode VisitEventAssignmentOperator(BoundEventAssignmentOperator node)
        {
            VisitRvalue(node.ReceiverOpt);
            Debug.Assert(!IsConditionalState);
            var receiverOpt = node.ReceiverOpt;
            if (!node.Event.IsStatic)
            {
                CheckPossibleNullReceiver(receiverOpt);
            }
            VisitRvalue(node.Argument);
            SetResult(node); // PROTOTYPE(NullableReferenceTypes)
            return null;
        }
jaredpar commented 5 years ago

Related to #29839

jaredpar commented 5 years ago

Duplicate of #31018

jcouv commented 5 years ago

Re-opened this issue since it is used to track a former PROTOTYPE comment in the code.

jaredpar commented 5 years ago

Ah I missed the PROTOTYPE comment in the code

RikkiGibson commented 4 years ago

An event assignment with += or -= returns 'void'. What result should we record in that case? NotNull seems to be accurate. 'void' can never be 'null', after all, but is there something else we do when we know an expression returns 'void'?