提交 8e3bd110 编写于 作者: N Neal Gafter

Update per code review comments.

上级 38701054
...@@ -82,7 +82,7 @@ property_subpattern ...@@ -82,7 +82,7 @@ property_subpattern
; ;
``` ```
> Note: There is technically an ambiguity between *type* in an `is-expression` and *constant_pattern*, either of which might be a valid parse of a qualified identifier. For compatibility we try to bind it as a type for compatibility with previous versions of the language; only if that fails do we resolve it as we do in other contexts, to the first thing found (which must be either a constant or a type). > Note: There is technically an ambiguity between *type* in an `is-expression` and *constant_pattern*, either of which might be a valid parse of a qualified identifier. We try to bind it as a type for compatibility with previous versions of the language; only if that fails do we resolve it as we do in other contexts, to the first thing found (which must be either a constant or a type). This ambiguity is only present on the right-hand-side of an `is` expression.
### Type Pattern ### Type Pattern
......
...@@ -6866,7 +6866,7 @@ internal class CSharpResources { ...@@ -6866,7 +6866,7 @@ internal class CSharpResources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to No &apos;operator is&apos; declaration in &apos;{0}&apos; was found with {1} out parameters. /// Looks up a localized string similar to No &apos;operator is&apos; declaration in &apos;{0}&apos; was found with {1} out parameter(s).
/// </summary> /// </summary>
internal static string ERR_OperatorIsParameterCount { internal static string ERR_OperatorIsParameterCount {
get { get {
......
...@@ -4861,7 +4861,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ ...@@ -4861,7 +4861,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<value>Ambiguous 'operator is' declarations found in type '{0}'.</value> <value>Ambiguous 'operator is' declarations found in type '{0}'.</value>
</data> </data>
<data name="ERR_OperatorIsParameterCount" xml:space="preserve"> <data name="ERR_OperatorIsParameterCount" xml:space="preserve">
<value>No 'operator is' declaration in '{0}' was found with {1} out parameters</value> <value>No 'operator is' declaration in '{0}' was found with {1} out parameter(s)</value>
</data> </data>
<data name="ERR_OperatorIsRequiresOut" xml:space="preserve"> <data name="ERR_OperatorIsRequiresOut" xml:space="preserve">
<value>All but the first parameter of user-defined 'operator is' require the 'out' modifier.</value> <value>All but the first parameter of user-defined 'operator is' require the 'out' modifier.</value>
......
...@@ -353,7 +353,8 @@ internal static bool IsQueryPairLambda(SyntaxNode syntax) ...@@ -353,7 +353,8 @@ internal static bool IsQueryPairLambda(SyntaxNode syntax)
} }
/// <summary> /// <summary>
/// Returns true if the specified node is a kind could represent a closure scope -- that is a scope of a captured variable. /// Returns true if the specified node is of a kind that could represent a closure scope -- that
/// is, a scope of a captured variable.
/// Doesn't check whether or not the node actually declares any captured variable. /// Doesn't check whether or not the node actually declares any captured variable.
/// </summary> /// </summary>
internal static bool IsClosureScope(SyntaxNode node) internal static bool IsClosureScope(SyntaxNode node)
......
...@@ -178,10 +178,10 @@ public void M1(object o) ...@@ -178,10 +178,10 @@ public void M1(object o)
"; ";
CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions) CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions)
.VerifyDiagnostics( .VerifyDiagnostics(
// (13,18): error CS8157: No 'operator is' declaration in 'ArrayList' was found with 1 out parameters // (13,18): error CS8157: No 'operator is' declaration in 'ArrayList' was found with 1 out parameter(s)
// case System.Collections.ArrayList(2): // case System.Collections.ArrayList(2):
Diagnostic(ErrorCode.ERR_OperatorIsParameterCount, "System.Collections.ArrayList(2)").WithArguments("System.Collections.ArrayList", "1").WithLocation(13, 18), Diagnostic(ErrorCode.ERR_OperatorIsParameterCount, "System.Collections.ArrayList(2)").WithArguments("System.Collections.ArrayList", "1").WithLocation(13, 18),
// (20,18): error CS8157: No 'operator is' declaration in 'ArrayList' was found with 1 out parameters // (20,18): error CS8157: No 'operator is' declaration in 'ArrayList' was found with 1 out parameter(s)
// case System.Collections.ArrayList(2): x // case System.Collections.ArrayList(2): x
Diagnostic(ErrorCode.ERR_OperatorIsParameterCount, "System.Collections.ArrayList(2)").WithArguments("System.Collections.ArrayList", "1").WithLocation(20, 18) Diagnostic(ErrorCode.ERR_OperatorIsParameterCount, "System.Collections.ArrayList(2)").WithArguments("System.Collections.ArrayList", "1").WithLocation(20, 18)
) )
......
...@@ -101,7 +101,7 @@ public static void Main() ...@@ -101,7 +101,7 @@ public static void Main()
// (12,17): error CS0103: The name 'i4' does not exist in the current context // (12,17): error CS0103: The name 'i4' does not exist in the current context
// let var i4 = 3; // let // let var i4 = 3; // let
Diagnostic(ErrorCode.ERR_NameNotInContext, "i4").WithArguments("i4").WithLocation(12, 17), Diagnostic(ErrorCode.ERR_NameNotInContext, "i4").WithArguments("i4").WithLocation(12, 17),
// (15,18): error CS8157: No 'operator is' declaration in 'Vec' was found with 1 out parameters // (15,18): error CS8157: No 'operator is' declaration in 'Vec' was found with 1 out parameter(s)
// if (q is Vec(3)) {} // recursive pattern // if (q is Vec(3)) {} // recursive pattern
Diagnostic(ErrorCode.ERR_OperatorIsParameterCount, "Vec(3)").WithArguments("Vec", "1").WithLocation(15, 18), Diagnostic(ErrorCode.ERR_OperatorIsParameterCount, "Vec(3)").WithArguments("Vec", "1").WithLocation(15, 18),
// (12,13): warning CS0168: The variable 'var' is declared but never used // (12,13): warning CS0168: The variable 'var' is declared but never used
...@@ -134,7 +134,7 @@ public static void Main() ...@@ -134,7 +134,7 @@ public static void Main()
// (12,17): error CS0103: The name 'i4' does not exist in the current context // (12,17): error CS0103: The name 'i4' does not exist in the current context
// let var i4 = 3; // let // let var i4 = 3; // let
Diagnostic(ErrorCode.ERR_NameNotInContext, "i4").WithArguments("i4").WithLocation(12, 17), Diagnostic(ErrorCode.ERR_NameNotInContext, "i4").WithArguments("i4").WithLocation(12, 17),
// (15,18): error CS8157: No 'operator is' declaration in 'Vec' was found with 1 out parameters // (15,18): error CS8157: No 'operator is' declaration in 'Vec' was found with 1 out parameter(s)
// if (q is Vec(3)) {} // recursive pattern // if (q is Vec(3)) {} // recursive pattern
Diagnostic(ErrorCode.ERR_OperatorIsParameterCount, "Vec(3)").WithArguments("Vec", "1").WithLocation(15, 18), Diagnostic(ErrorCode.ERR_OperatorIsParameterCount, "Vec(3)").WithArguments("Vec", "1").WithLocation(15, 18),
// (8,13): warning CS0219: The variable 'i2' is assigned but its value is never used // (8,13): warning CS0219: The variable 'i2' is assigned but its value is never used
...@@ -152,7 +152,7 @@ public static void Main() ...@@ -152,7 +152,7 @@ public static void Main()
var experimentalParseOptions = regularParseOptions var experimentalParseOptions = regularParseOptions
.WithPreprocessorSymbols(new[] { "__DEMO_EXPERIMENTAL__" }); .WithPreprocessorSymbols(new[] { "__DEMO_EXPERIMENTAL__" });
CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: experimentalParseOptions).VerifyDiagnostics( CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: experimentalParseOptions).VerifyDiagnostics(
// (15,18): error CS8157: No 'operator is' declaration in 'Vec' was found with 1 out parameters // (15,18): error CS8157: No 'operator is' declaration in 'Vec' was found with 1 out parameter(s)
// if (q is Vec(3)) {} // recursive pattern // if (q is Vec(3)) {} // recursive pattern
Diagnostic(ErrorCode.ERR_OperatorIsParameterCount, "Vec(3)").WithArguments("Vec", "1").WithLocation(15, 18), Diagnostic(ErrorCode.ERR_OperatorIsParameterCount, "Vec(3)").WithArguments("Vec", "1").WithLocation(15, 18),
// (8,13): warning CS0219: The variable 'i2' is assigned but its value is never used // (8,13): warning CS0219: The variable 'i2' is assigned but its value is never used
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册