dotnet/roslyn

Bad comment

Open

#15,589 opened on Nov 29, 2016

View on GitHub
 (0 comments) (0 reactions) (0 assignees)C# (20,414 stars) (4,257 forks)batch import
Area-CompilersDocumentationhelp wanted

Description

I found the following in the C# compiler.

// SPEC OMISSION: The C# 2.0 spec had a line in it that noted that the expressions "null == null"
// SPEC OMISSION: and "null != null" were to be automatically treated as the appropriate constant;
// SPEC OMISSION: overload resolution was to be skipped.  That's because a strict reading
// SPEC OMISSION: of the overload resolution spec shows that overload resolution would give an
// SPEC OMISSION: ambiguity error for this case; the expression is ambiguous between the int?,
// SPEC OMISSION: bool? and string versions of equality.  This line was accidentally edited
// SPEC OMISSION: out of the C# 3 specification; we should re-insert it. 

But the ECMA standard 13.11.1 covers this:

If both operands of an equality-expression are the null literal, then overload resolution is not performed and the expression evaluates to a constant value of true or false according to whether the operator is == or !=.

The comment should be corrected.

Contributor guide