dotnet/roslyn

Bad comment

Open

#15,589 创建于 2016年11月29日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)C# (20,414 star) (4,257 fork)batch import
Area-CompilersDocumentationhelp wanted

描述

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.

贡献者指南