From 86c7f1993ad99485222b5353ac72b6d3f8db9064 Mon Sep 17 00:00:00 2001 From: TomasMatousek Date: Fri, 9 Jan 2015 15:23:45 -0800 Subject: [PATCH] Remove unused code/API Public types CommonMemberResolutionKind, CommonMemberResolutionResult, CommonOverloadResolutionResult are not used nor returned by any Roslyn public API. Remove them. (changeset 1395377) --- .../MemberResolutionResult.cs | 27 --------- .../OverloadResolutionResult.cs | 10 ---- .../Core/Portable/CodeAnalysis.csproj | 6 +- .../Compilation/CommonMemberResolutionKind.cs | 33 ----------- .../CommonMemberResolutionResult.cs | 40 ------------- .../CommonOverloadResolutionResult.cs | 57 ------------------- .../Compilation/MethodResolutionResult.vb | 20 ------- .../Compilation/OverloadResolutionResult.vb | 8 --- 8 files changed, 2 insertions(+), 199 deletions(-) delete mode 100644 Src/Compilers/Core/Portable/Compilation/CommonMemberResolutionKind.cs delete mode 100644 Src/Compilers/Core/Portable/Compilation/CommonMemberResolutionResult.cs delete mode 100644 Src/Compilers/Core/Portable/Compilation/CommonOverloadResolutionResult.cs diff --git a/Src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/MemberResolutionResult.cs b/Src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/MemberResolutionResult.cs index c228fe4336a..bfc6d3441ec 100644 --- a/Src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/MemberResolutionResult.cs +++ b/Src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/MemberResolutionResult.cs @@ -98,33 +98,6 @@ internal MemberAnalysisResult Result get { return result; } } - internal CommonMemberResolutionResult ToCommon() - where TSymbol : ISymbol - { - return new CommonMemberResolutionResult( - (TSymbol)(ISymbol)this.Member, - ConvertKind(this.Resolution), - this.IsValid); - } - - private static CommonMemberResolutionKind ConvertKind(MemberResolutionKind kind) - { - switch (kind) - { - case MemberResolutionKind.ApplicableInExpandedForm: - case MemberResolutionKind.ApplicableInNormalForm: - return CommonMemberResolutionKind.Applicable; - case MemberResolutionKind.UseSiteError: - case MemberResolutionKind.UnsupportedMetadata: - return CommonMemberResolutionKind.UseSiteError; - case MemberResolutionKind.TypeInferenceFailed: - case MemberResolutionKind.TypeInferenceExtensionInstanceArgument: - return CommonMemberResolutionKind.TypeInferenceFailed; - default: - return CommonMemberResolutionKind.Worse; - } - } - public override bool Equals(object obj) { throw new NotSupportedException(); diff --git a/Src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolutionResult.cs b/Src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolutionResult.cs index 76df47ad92e..a2c29c6dcec 100644 --- a/Src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolutionResult.cs +++ b/Src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolutionResult.cs @@ -1237,15 +1237,5 @@ private static ObjectPool> CreatePool() } #endregion - - internal CommonOverloadResolutionResult ToCommon() - where TSymbol : ISymbol - { - return new CommonOverloadResolutionResult( - this.Succeeded, - this.Succeeded ? this.ValidResult.ToCommon() : default(CommonMemberResolutionResult?), - this.HasBestResult ? this.BestResult.ToCommon() : default(CommonMemberResolutionResult?), - this.Results.SelectAsArray(r => r.ToCommon())); - } } } diff --git a/Src/Compilers/Core/Portable/CodeAnalysis.csproj b/Src/Compilers/Core/Portable/CodeAnalysis.csproj index 577654ce91e..badcb8b102e 100644 --- a/Src/Compilers/Core/Portable/CodeAnalysis.csproj +++ b/Src/Compilers/Core/Portable/CodeAnalysis.csproj @@ -3,10 +3,10 @@ + Debug - ..\..\..\..\Binaries\$(Configuration)\ AnyCPU {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C} Library @@ -141,9 +141,6 @@ - - - @@ -662,6 +659,7 @@ + diff --git a/Src/Compilers/Core/Portable/Compilation/CommonMemberResolutionKind.cs b/Src/Compilers/Core/Portable/Compilation/CommonMemberResolutionKind.cs deleted file mode 100644 index cf6c1cb3ed9..00000000000 --- a/Src/Compilers/Core/Portable/Compilation/CommonMemberResolutionKind.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.Text; - -namespace Microsoft.CodeAnalysis -{ - /// - /// Indicates why the compiler accepted or rejected the member during overload resolution. - /// - public enum CommonMemberResolutionKind - { - /// - /// The candidate member was accepted. - /// - Applicable = 0, - - /// - /// The candidate member was rejected because it is not supported by the language or cannot - /// be used given the current set of assembly references. - /// - UseSiteError = 1, - - /// - /// The candidate member was rejected because type inference failed. - /// - TypeInferenceFailed = 2, - - /// - /// The candidate member was rejected because it was considered worse that another member. - /// - Worse = 3, - } -} \ No newline at end of file diff --git a/Src/Compilers/Core/Portable/Compilation/CommonMemberResolutionResult.cs b/Src/Compilers/Core/Portable/Compilation/CommonMemberResolutionResult.cs deleted file mode 100644 index e337d6ab25d..00000000000 --- a/Src/Compilers/Core/Portable/Compilation/CommonMemberResolutionResult.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Threading; -using Microsoft.CodeAnalysis.Text; - -namespace Microsoft.CodeAnalysis -{ - /// - /// Represents the results of overload resolution for a single member. - /// - public struct CommonMemberResolutionResult where TMember : ISymbol - { - /// - /// The member considered during overload resolution. - /// - public TMember Member { get; private set; } - - /// - /// Indicates why the compiler accepted or rejected the member during overload resolution. - /// - public CommonMemberResolutionKind Resolution { get; private set; } - - /// - /// Returns true if the compiler accepted this member as the sole correct result of overload resolution. - /// - public bool IsValid { get; private set; } - - internal CommonMemberResolutionResult( - TMember member, - CommonMemberResolutionKind resolution, - bool isValid) - : this() - { - this.Member = member; - this.Resolution = resolution; - this.IsValid = isValid; - } - } -} \ No newline at end of file diff --git a/Src/Compilers/Core/Portable/Compilation/CommonOverloadResolutionResult.cs b/Src/Compilers/Core/Portable/Compilation/CommonOverloadResolutionResult.cs deleted file mode 100644 index d6ef44d7915..00000000000 --- a/Src/Compilers/Core/Portable/Compilation/CommonOverloadResolutionResult.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Threading; -using Microsoft.CodeAnalysis.Text; - -namespace Microsoft.CodeAnalysis -{ - /// - /// Summarizes the results of an overload resolution analysis, as described in section 7.5 of - /// the language specification. Describes whether overload resolution succeeded, and which - /// method was selected if overload resolution succeeded, as well as detailed information about - /// each method that was considered. - /// - public struct CommonOverloadResolutionResult where TMember : ISymbol - { - // Create an overload resolution result from a single result. - internal CommonOverloadResolutionResult( - bool succeeded, - CommonMemberResolutionResult? validResult, - CommonMemberResolutionResult? bestResult, - ImmutableArray> results) - : this() - { - this.Succeeded = succeeded; - this.ValidResult = validResult; - this.BestResult = bestResult; - this.Results = results; - } - - /// - /// True if overload resolution successfully selected a single best method. - /// - public bool Succeeded { get; private set; } - - /// - /// If overload resolution successfully selected a single best method, returns information - /// about that method. Otherwise returns null. - /// - public CommonMemberResolutionResult? ValidResult { get; private set; } - - /// - /// If there was a method that overload resolution considered better than all others, - /// returns information about that method. A method may be returned even if that method was - /// not considered a successful overload resolution, as long as it was better that any other - /// potential method considered. - /// - public CommonMemberResolutionResult? BestResult { get; private set; } - - /// - /// Returns information about each method that was considered during overload resolution, - /// and what the results of overload resolution were for that method. - /// - public ImmutableArray> Results { get; private set; } - } -} \ No newline at end of file diff --git a/Src/Compilers/VisualBasic/Portable/Compilation/MethodResolutionResult.vb b/Src/Compilers/VisualBasic/Portable/Compilation/MethodResolutionResult.vb index e94804f0040..ef356de0aff 100644 --- a/Src/Compilers/VisualBasic/Portable/Compilation/MethodResolutionResult.vb +++ b/Src/Compilers/VisualBasic/Portable/Compilation/MethodResolutionResult.vb @@ -86,25 +86,5 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return m_Candidate.IsExpandedParamArrayForm End Get End Property - - Friend Function ToCommon(Of TSymbol As ISymbol)() As CommonMemberResolutionResult(Of TSymbol) - Return New CommonMemberResolutionResult(Of TSymbol)( - DirectCast(DirectCast(Me.Member, ISymbol), TSymbol), - ConvertResolution(Me.Resolution), - Me.IsValid) - End Function - - Private Shared Function ConvertResolution(resolution As MemberResolutionKind) As CommonMemberResolutionKind - Select Case resolution - Case MemberResolutionKind.Applicable - Return CommonMemberResolutionKind.Applicable - Case MemberResolutionKind.HasUseSiteError - Return CommonMemberResolutionKind.UseSiteError - Case MemberResolutionKind.TypeInferenceFailed - Return CommonMemberResolutionKind.TypeInferenceFailed - Case Else - Return CommonMemberResolutionKind.Worse - End Select - End Function End Structure End Namespace \ No newline at end of file diff --git a/Src/Compilers/VisualBasic/Portable/Compilation/OverloadResolutionResult.vb b/Src/Compilers/VisualBasic/Portable/Compilation/OverloadResolutionResult.vb index 791c1a0c5cc..b811cda8148 100644 --- a/Src/Compilers/VisualBasic/Portable/Compilation/OverloadResolutionResult.vb +++ b/Src/Compilers/VisualBasic/Portable/Compilation/OverloadResolutionResult.vb @@ -72,13 +72,5 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return m_Results End Get End Property - - Friend Function ToCommon(Of TSymbol As ISymbol)() As CommonOverloadResolutionResult(Of TSymbol) - Return New CommonOverloadResolutionResult(Of TSymbol)( - Me.Succeeded, - If(Me.ValidResult.HasValue, Me.ValidResult.Value.ToCommon(Of TSymbol)(), New CommonMemberResolutionResult(Of TSymbol) ?()), - If(Me.BestResult.HasValue, Me.BestResult.Value.ToCommon(Of TSymbol)(), New CommonMemberResolutionResult(Of TSymbol) ?()), - Me.Results.SelectAsArray(Function(r) r.ToCommon(Of TSymbol)())) - End Function End Class End Namespace \ No newline at end of file -- GitLab