dotnet/roslyn

Bad comment

Open

#15.589 aperta il 29 nov 2016

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)C# (4257 fork)batch import
Area-CompilersDocumentationhelp wanted

Metriche repository

Star
 (20.414 star)
Metriche merge PR
 (Merge medio 6g 17h) (256 PR mergiate in 30 g)

Descrizione

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.

Guida contributor