提交 cea7157a 编写于 作者: N Neal Gafter

Sources missed in merge

上级 8ebda65c
...@@ -1244,7 +1244,7 @@ private static bool HasAnonymousFunctionConversion(BoundExpression source, TypeS ...@@ -1244,7 +1244,7 @@ private static bool HasAnonymousFunctionConversion(BoundExpression source, TypeS
return IsAnonymousFunctionCompatibleWithType((UnboundLambda)source, destination) == LambdaConversionResult.Success; return IsAnonymousFunctionCompatibleWithType((UnboundLambda)source, destination) == LambdaConversionResult.Success;
} }
internal Conversion ClassifyImplicitUserDefinedConversionForSwitchGoverningType(TypeSymbol sourceType, out TypeSymbol switchGoverningType, ref HashSet<DiagnosticInfo> useSiteDiagnostics) internal Conversion ClassifyImplicitUserDefinedConversionForV6SwitchGoverningType(TypeSymbol sourceType, out TypeSymbol switchGoverningType, ref HashSet<DiagnosticInfo> useSiteDiagnostics)
{ {
// SPEC: The governing type of a switch statement is established by the switch expression. // SPEC: The governing type of a switch statement is established by the switch expression.
// SPEC: 1) If the type of the switch expression is sbyte, byte, short, ushort, int, uint, // SPEC: 1) If the type of the switch expression is sbyte, byte, short, ushort, int, uint,
...@@ -1257,16 +1257,16 @@ internal Conversion ClassifyImplicitUserDefinedConversionForSwitchGoverningType( ...@@ -1257,16 +1257,16 @@ internal Conversion ClassifyImplicitUserDefinedConversionForSwitchGoverningType(
// NOTE: We should be called only if (1) is false for source type. // NOTE: We should be called only if (1) is false for source type.
Debug.Assert((object)sourceType != null); Debug.Assert((object)sourceType != null);
Debug.Assert(!sourceType.IsValidSwitchGoverningType()); Debug.Assert(!sourceType.IsValidV6SwitchGoverningType());
UserDefinedConversionResult result = AnalyzeImplicitUserDefinedConversionForSwitchGoverningType(sourceType, ref useSiteDiagnostics); UserDefinedConversionResult result = AnalyzeImplicitUserDefinedConversionForV6SwitchGoverningType(sourceType, ref useSiteDiagnostics);
if (result.Kind == UserDefinedConversionResultKind.Valid) if (result.Kind == UserDefinedConversionResultKind.Valid)
{ {
UserDefinedConversionAnalysis analysis = result.Results[result.Best]; UserDefinedConversionAnalysis analysis = result.Results[result.Best];
switchGoverningType = analysis.ToType; switchGoverningType = analysis.ToType;
Debug.Assert(switchGoverningType.IsValidSwitchGoverningType(isTargetTypeOfUserDefinedOp: true)); Debug.Assert(switchGoverningType.IsValidV6SwitchGoverningType(isTargetTypeOfUserDefinedOp: true));
} }
else else
{ {
......
...@@ -937,7 +937,8 @@ internal static class PatternConversionExtensions ...@@ -937,7 +937,8 @@ internal static class PatternConversionExtensions
} }
HashSet<DiagnosticInfo> useSiteDiagnostics = null; HashSet<DiagnosticInfo> useSiteDiagnostics = null;
var conversion = conversions.ClassifyConversion(expressionType, patternType, ref useSiteDiagnostics, builtinOnly: true); var conversion = conversions.ClassifyBuiltInConversion(expressionType, patternType, ref useSiteDiagnostics);
// This is for classification purposes only; we discard use-site diagnostics. Use-site diagnostics will // This is for classification purposes only; we discard use-site diagnostics. Use-site diagnostics will
// be given if a conversion is actually used. // be given if a conversion is actually used.
switch (conversion.Kind) switch (conversion.Kind)
......
...@@ -1407,10 +1407,8 @@ internal enum ErrorCode ...@@ -1407,10 +1407,8 @@ internal enum ErrorCode
ERR_RefReturnLocal = 8924, ERR_RefReturnLocal = 8924,
ERR_RefReturnLocal2 = 8925, ERR_RefReturnLocal2 = 8925,
ERR_RefReturnStructThis = 8926, ERR_RefReturnStructThis = 8926,
ERR_ImplicitlyTypedOutVariableUsedInTheSameArgumentList = 8927,
ERR_TypeInferenceFailedForImplicitlyTypedOutVariable = 8928,
// Available = 8929, // Available = 8927-8929,
ERR_MustBeRefAssignable = 8930, ERR_MustBeRefAssignable = 8930,
ERR_MustBeRefAssignableLocal = 8931, ERR_MustBeRefAssignableLocal = 8931,
...@@ -1423,6 +1421,11 @@ internal enum ErrorCode ...@@ -1423,6 +1421,11 @@ internal enum ErrorCode
ERR_BadIteratorLocalType = 8941, ERR_BadIteratorLocalType = 8941,
ERR_BadAsyncLocalType = 8942, ERR_BadAsyncLocalType = 8942,
ERR_RefReturningCallAndAwait = 8943, ERR_RefReturningCallAndAwait = 8943,
#endregion diagnostics for ref locals and ref returns introduced in C# 7
#region diagnostics for out var
ERR_ImplicitlyTypedOutVariableUsedInTheSameArgumentList = 8944,
ERR_TypeInferenceFailedForImplicitlyTypedOutVariable = 8945,
#endregion diagnostics for out var
} }
} }
...@@ -28,7 +28,7 @@ public void DiagnosticAnalyzerAllInOne() ...@@ -28,7 +28,7 @@ public void DiagnosticAnalyzerAllInOne()
var syntaxKindsMissing = new HashSet<SyntaxKind>(); var syntaxKindsMissing = new HashSet<SyntaxKind>();
// AllInOneCSharpCode has no deconstruction. // AllInOneCSharpCode has no deconstruction.
syntaxKindsPatterns.Add(SyntaxKind.VariableDeconstructionDeclarator); syntaxKindsMissing.Add(SyntaxKind.VariableDeconstructionDeclarator);
var analyzer = new CSharpTrackingDiagnosticAnalyzer(); var analyzer = new CSharpTrackingDiagnosticAnalyzer();
CreateCompilationWithMscorlib45(source).VerifyAnalyzerDiagnostics(new[] { analyzer }); CreateCompilationWithMscorlib45(source).VerifyAnalyzerDiagnostics(new[] { analyzer });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册