diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs index e6e605a2d05148bc036c1165baf0c8c948e239ab..fae2381523d51d184a6da998f67db243b602afcb 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs @@ -1,15 +1,15 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using Microsoft.CodeAnalysis.Collections; -using Microsoft.CodeAnalysis.CSharp.Symbols; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.RuntimeMembers; -using Roslyn.Utilities; using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Linq; +using Microsoft.CodeAnalysis.Collections; +using Microsoft.CodeAnalysis.CSharp.Symbols; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.RuntimeMembers; +using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp { @@ -755,13 +755,14 @@ private Symbol UnwrapAlias(Symbol symbol, out AliasSymbol alias, DiagnosticBag d if ((object)type != null) { // pass args in a value tuple to avoid allocating a closure - var args = ValueTuple.Create(this, diagnostics, syntax); + var args = (this, diagnostics, syntax); type.VisitType((typePart, argTuple, isNested) => { argTuple.Item1.ReportDiagnosticsIfObsolete(argTuple.Item2, typePart, argTuple.Item3, hasBaseReceiver: false); return false; }, args); } + return result; } @@ -2098,4 +2099,4 @@ internal static void CheckFeatureAvailability(Location location, MessageID featu } } } -} +} \ No newline at end of file diff --git a/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs b/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs index df8df3a1017b392f15ee152cabb6b937750e29d4..db78e4d955fa88fd95d8857ddec0510acaead19b 100644 --- a/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs +++ b/src/Compilers/CSharp/Portable/CodeGen/Optimizer.cs @@ -388,7 +388,7 @@ internal enum ExprContext internal sealed class StackOptimizerPass1 : BoundTreeRewriter { private readonly bool _debugFriendly; - private readonly ArrayBuilder> _evalStack; + private readonly ArrayBuilder<(BoundExpression, ExprContext)> _evalStack; private int _counter; private ExprContext _context; @@ -535,7 +535,7 @@ protected override BoundExpression VisitExpressionWithoutStackGuard(BoundExpress private void PushEvalStack(BoundExpression result, ExprContext context) { Debug.Assert(result != null || context == ExprContext.None); - _evalStack.Add(ValueTuple.Create(result, context)); + _evalStack.Add((result, context)); } private int StackDepth() diff --git a/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs b/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs index 447ec04b6a31d584dee4cf1b4a7baa4049e23af7..061f4cc549d0e97e1f1edae10cecf17280b19319 100644 --- a/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs +++ b/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs @@ -849,13 +849,8 @@ public override ImmutableArray DirectiveReferences } } - internal override IDictionary, MetadataReference> ReferenceDirectiveMap - { - get - { - return GetBoundReferenceManager().ReferenceDirectiveMap; - } - } + internal override IDictionary<(string path, string content), MetadataReference> ReferenceDirectiveMap + => GetBoundReferenceManager().ReferenceDirectiveMap; // for testing purposes internal IEnumerable ExternAliases @@ -916,7 +911,7 @@ internal override IEnumerable ReferenceDirectives public MetadataReference GetDirectiveReference(ReferenceDirectiveTriviaSyntax directive) { MetadataReference reference; - return ReferenceDirectiveMap.TryGetValue(ValueTuple.Create(directive.SyntaxTree.FilePath, directive.File.ValueText), out reference) ? reference : null; + return ReferenceDirectiveMap.TryGetValue((directive.SyntaxTree.FilePath, directive.File.ValueText), out reference) ? reference : null; } /// diff --git a/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs b/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs index 96608622ed5377ce314bd5f77edec4ab2b553472..9e56b4e890ac92e96854d30bc6fbcadd1c32b75f 100644 --- a/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs +++ b/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs @@ -555,7 +555,7 @@ private void ReportExportedTypeNameCollisions(ImmutableArray e if (wellKnownAttributeData?.ForwardedTypes?.Count > 0) { // (type, index of the parent exported type in builder, or -1 if the type is a top-level type) - var stack = ArrayBuilder>.GetInstance(); + var stack = ArrayBuilder<(NamedTypeSymbol type, int parentIndex)>.GetInstance(); foreach (NamedTypeSymbol forwardedType in wellKnownAttributeData.ForwardedTypes) { @@ -569,13 +569,11 @@ private void ReportExportedTypeNameCollisions(ImmutableArray e // Return all nested types. // Note the order: depth first, children in reverse order (to match dev10, not a requirement). Debug.Assert(stack.Count == 0); - stack.Push(ValueTuple.Create(originalDefinition, -1)); + stack.Push((originalDefinition, -1)); while (stack.Count > 0) { - var entry = stack.Pop(); - NamedTypeSymbol type = entry.Item1; - int parentIndex = entry.Item2; + var (type, parentIndex) = stack.Pop(); // In general, we don't want private types to appear in the ExportedTypes table. // BREAK: dev11 emits these types. The problem was discovered in dev10, but failed @@ -595,7 +593,7 @@ private void ReportExportedTypeNameCollisions(ImmutableArray e ImmutableArray nested = type.GetTypeMembers(); // Ordered. for (int i = nested.Length - 1; i >= 0; i--) { - stack.Push(ValueTuple.Create(nested[i], index)); + stack.Push((nested[i], index)); } } } diff --git a/src/Compilers/CSharp/Portable/Symbols/ReferenceManager.cs b/src/Compilers/CSharp/Portable/Symbols/ReferenceManager.cs index b0d9604bbb015ef5a12d5019e3ec2a20c0ef7a89..ce720321c6732fe27c3c3b065f1c87019df71ca5 100644 --- a/src/Compilers/CSharp/Portable/Symbols/ReferenceManager.cs +++ b/src/Compilers/CSharp/Portable/Symbols/ReferenceManager.cs @@ -345,7 +345,7 @@ private bool CreateAndSetSourceAssemblyFullBind(CSharpCompilation compilation) try { - IDictionary, MetadataReference> boundReferenceDirectiveMap; + IDictionary<(string, string), MetadataReference> boundReferenceDirectiveMap; ImmutableArray boundReferenceDirectives; ImmutableArray referencedAssemblies; ImmutableArray modules; // To make sure the modules are not collected ahead of time. diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs index 27efd725e9dcb4aa34e634215f1864a9127d8a68..e3bdf4b0e883d6c7cf3d4bbec404fcee691c0c7e 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs @@ -1047,7 +1047,7 @@ public override ImmutableArray GetTypeMembers(string name, int private Dictionary> MakeTypeMembers(DiagnosticBag diagnostics) { var symbols = ArrayBuilder.GetInstance(); - var conflictDict = new Dictionary, SourceNamedTypeSymbol>(); + var conflictDict = new Dictionary<(string, int), SourceNamedTypeSymbol>(); try { foreach (var childDeclaration in declaration.Children) @@ -1055,7 +1055,7 @@ public override ImmutableArray GetTypeMembers(string name, int var t = new SourceNamedTypeSymbol(this, childDeclaration, diagnostics); this.CheckMemberNameDistinctFromType(t, diagnostics); - var key = new ValueTuple(t.Name, t.Arity); + var key = (t.Name, t.Arity); SourceNamedTypeSymbol other; if (conflictDict.TryGetValue(key, out other)) { diff --git a/src/Compilers/Core/Portable/CodeAnalysis.csproj b/src/Compilers/Core/Portable/CodeAnalysis.csproj index 5c1ba9acf22f308b712e54d36b845b7efa2bdef2..c15f475fee9c67f5c41609b371705ff9dbe034a7 100644 --- a/src/Compilers/Core/Portable/CodeAnalysis.csproj +++ b/src/Compilers/Core/Portable/CodeAnalysis.csproj @@ -418,9 +418,6 @@ - - - diff --git a/src/Compilers/Core/Portable/CodeGen/ArrayMembers.cs b/src/Compilers/Core/Portable/CodeGen/ArrayMembers.cs index f7f0f8b683e174c83025b73b5b4cb873fde8d17f..b1b5395cee8e5b8e0ac331d3e808bb9b0ff9a742 100644 --- a/src/Compilers/Core/Portable/CodeGen/ArrayMembers.cs +++ b/src/Compilers/Core/Portable/CodeGen/ArrayMembers.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Roslyn.Utilities; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; @@ -93,15 +94,15 @@ public ArrayMethod GetArrayAddress(Cci.IArrayTypeReference arrayType) /// /// Maps {array type, method kind} tuples to implementing pseudo-methods. /// - private readonly ConcurrentDictionary, ArrayMethod> _dict = - new ConcurrentDictionary, ArrayMethod>(); + private readonly ConcurrentDictionary<(byte methodKind, Cci.IArrayTypeReference arrayType), ArrayMethod> _dict = + new ConcurrentDictionary<(byte, Cci.IArrayTypeReference), ArrayMethod>(); /// /// lazily fetches or creates a new array method. /// private ArrayMethod GetArrayMethod(Cci.IArrayTypeReference arrayType, ArrayMethodKind id) { - var key = ValueTuple.Create((byte)id, arrayType); + var key = ((byte)id, arrayType); ArrayMethod result; var dict = _dict; diff --git a/src/Compilers/Core/Portable/Compilation/Compilation.cs b/src/Compilers/Core/Portable/Compilation/Compilation.cs index 3b35702e3ac550d0f06eac6958b59d70b433fed0..1a8748bb290fe477bd51b2bc39c75bcf5ce249fa 100644 --- a/src/Compilers/Core/Portable/Compilation/Compilation.cs +++ b/src/Compilers/Core/Portable/Compilation/Compilation.cs @@ -501,7 +501,7 @@ internal CommonReferenceManager GetBoundReferenceManager() /// /// Maps values of #r references to resolved metadata references. /// - internal abstract IDictionary, MetadataReference> ReferenceDirectiveMap { get; } + internal abstract IDictionary<(string path, string content), MetadataReference> ReferenceDirectiveMap { get; } /// /// All metadata references -- references passed to the compilation diff --git a/src/Compilers/Core/Portable/Emit/DebugDocumentsBuilder.cs b/src/Compilers/Core/Portable/Emit/DebugDocumentsBuilder.cs index bc77cc458c9e0f07b6dcda130e81baed352fa6b8..96d42c1181cde937456d0cf16502f179f73b42a3 100644 --- a/src/Compilers/Core/Portable/Emit/DebugDocumentsBuilder.cs +++ b/src/Compilers/Core/Portable/Emit/DebugDocumentsBuilder.cs @@ -17,7 +17,7 @@ internal sealed class DebugDocumentsBuilder // NOTE: We are not considering how filesystem or debuggers do the comparisons, but how native implementations did. // Deviating from that may result in unexpected warnings or different behavior (possibly without warnings). private readonly ConcurrentDictionary _debugDocuments; - private readonly ConcurrentCache, string> _normalizedPathsCache; + private readonly ConcurrentCache<(string, string), string> _normalizedPathsCache; private readonly SourceReferenceResolver _resolverOpt; private ImmutableArray _embeddedDocuments; @@ -30,7 +30,7 @@ public DebugDocumentsBuilder(SourceReferenceResolver resolverOpt, bool isDocumen StringComparer.Ordinal : StringComparer.OrdinalIgnoreCase); - _normalizedPathsCache = new ConcurrentCache, string>(16); + _normalizedPathsCache = new ConcurrentCache<(string, string), string>(16); _embeddedDocuments = ImmutableArray.Empty; } @@ -71,7 +71,7 @@ internal string NormalizeDebugDocumentPath(string path, string basePath) return path; } - var key = ValueTuple.Create(path, basePath); + var key = (path, basePath); string normalizedPath; if (!_normalizedPathsCache.TryGetValue(key, out normalizedPath)) { diff --git a/src/Compilers/Core/Portable/InternalUtilities/ValueTuple.cs b/src/Compilers/Core/Portable/InternalUtilities/ValueTuple.cs deleted file mode 100644 index 629c32105ba919e6cbc6d6a862a0c9af110a1b3a..0000000000000000000000000000000000000000 --- a/src/Compilers/Core/Portable/InternalUtilities/ValueTuple.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Roslyn.Utilities -{ - // tuple factory - internal static class ValueTuple - { - public static ValueTuple Create(T1 item1, T2 item2) - { - return new ValueTuple(item1, item2); - } - - public static ValueTuple Create(T1 item1, T2 item2, T3 item3) - { - return new ValueTuple(item1, item2, item3); - } - } -} diff --git a/src/Compilers/Core/Portable/InternalUtilities/ValueTuple`2.cs b/src/Compilers/Core/Portable/InternalUtilities/ValueTuple`2.cs deleted file mode 100644 index dc7782dc0da42b5604e9ffc943f968faed38cc9f..0000000000000000000000000000000000000000 --- a/src/Compilers/Core/Portable/InternalUtilities/ValueTuple`2.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; - -namespace Roslyn.Utilities -{ - // struct with two values - internal struct ValueTuple : IEquatable> - { - private static readonly EqualityComparer s_comparer1 = EqualityComparer.Default; - private static readonly EqualityComparer s_comparer2 = EqualityComparer.Default; - - public readonly T1 Item1; - public readonly T2 Item2; - - public ValueTuple(T1 item1, T2 item2) - { - this.Item1 = item1; - this.Item2 = item2; - } - - public bool Equals(ValueTuple other) - { - return s_comparer1.Equals(this.Item1, other.Item1) - && s_comparer2.Equals(this.Item2, other.Item2); - } - - public override bool Equals(object obj) - { - if (obj is ValueTuple) - { - var other = (ValueTuple)obj; - return this.Equals(other); - } - - return false; - } - - public override int GetHashCode() - { - return Hash.Combine(s_comparer1.GetHashCode(Item1), s_comparer2.GetHashCode(Item2)); - } - - public static bool operator ==(ValueTuple left, ValueTuple right) - { - return left.Equals(right); - } - - public static bool operator !=(ValueTuple left, ValueTuple right) - { - return !left.Equals(right); - } - } -} diff --git a/src/Compilers/Core/Portable/InternalUtilities/ValueTuple`3.cs b/src/Compilers/Core/Portable/InternalUtilities/ValueTuple`3.cs deleted file mode 100644 index 272e37e6139d869c6cb0837d8d9cd1306fa3be9e..0000000000000000000000000000000000000000 --- a/src/Compilers/Core/Portable/InternalUtilities/ValueTuple`3.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; - -namespace Roslyn.Utilities -{ - // struct with three values - internal struct ValueTuple : IEquatable> - { - private static readonly EqualityComparer s_comparer1 = EqualityComparer.Default; - private static readonly EqualityComparer s_comparer2 = EqualityComparer.Default; - private static readonly EqualityComparer s_comparer3 = EqualityComparer.Default; - - public readonly T1 Item1; - public readonly T2 Item2; - public readonly T3 Item3; - - public ValueTuple(T1 item1, T2 item2, T3 item3) - { - this.Item1 = item1; - this.Item2 = item2; - this.Item3 = item3; - } - - public bool Equals(ValueTuple other) - { - return s_comparer1.Equals(this.Item1, other.Item1) - && s_comparer2.Equals(this.Item2, other.Item2) - && s_comparer3.Equals(this.Item3, other.Item3); - } - - public override bool Equals(object obj) - { - if (obj is ValueTuple) - { - var other = (ValueTuple)obj; - return this.Equals(other); - } - - return false; - } - - public override int GetHashCode() - { - return Hash.Combine( - Hash.Combine( - s_comparer1.GetHashCode(Item1), - s_comparer2.GetHashCode(Item2)), - s_comparer3.GetHashCode(Item3)); - } - - public static bool operator ==(ValueTuple left, ValueTuple right) - { - return left.Equals(right); - } - - public static bool operator !=(ValueTuple left, ValueTuple right) - { - return !left.Equals(right); - } - } -} diff --git a/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.Binding.cs b/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.Binding.cs index f2de53f0a6ed012033a9282d12ca7e9165870446..ad838d803cdb5430dcb8eda01474ba844bfd3708 100644 --- a/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.Binding.cs +++ b/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.Binding.cs @@ -230,7 +230,7 @@ internal partial class CommonReferenceManager Dictionary lazyAliasMap = null; // metadata references and corresponding bindings of their references, used to calculate a fixed point: - var referenceBindingsToProcess = ArrayBuilder>>.GetInstance(); + var referenceBindingsToProcess = ArrayBuilder<(MetadataReference, ArraySegment)>.GetInstance(); // collect all missing identities, resolve the assemblies and bind their references against explicit definitions: GetInitialReferenceBindingsToProcess(explicitModules, explicitReferences, explicitReferenceMap, referenceBindings, totalReferencedAssemblyCount, referenceBindingsToProcess); @@ -296,7 +296,7 @@ internal partial class CommonReferenceManager var referenceBinding = data.BindAssemblyReferences(explicitAssemblies, IdentityComparer); referenceBindings.Add(referenceBinding); - referenceBindingsToProcess.Push(ValueTuple.Create((MetadataReference)resolvedReference, new ArraySegment(referenceBinding))); + referenceBindingsToProcess.Push((resolvedReference, new ArraySegment(referenceBinding))); } } @@ -361,7 +361,7 @@ internal partial class CommonReferenceManager ImmutableArray explicitReferenceMap, ArrayBuilder referenceBindings, int totalReferencedAssemblyCount, - [Out]ArrayBuilder>> result) + [Out]ArrayBuilder<(MetadataReference, ArraySegment)> result) { Debug.Assert(result.Count == 0); @@ -376,9 +376,9 @@ internal partial class CommonReferenceManager var moduleReference = explicitReferences[explicitModuleToReferenceMap[moduleIndex]]; var moduleBindingsCount = explicitModules[moduleIndex].ReferencedAssemblies.Length; - result.Add(ValueTuple.Create( - moduleReference, - new ArraySegment(bindingsOfAssemblyBeingBuilt, bindingIndex, moduleBindingsCount))); + result.Add( + (moduleReference, + new ArraySegment(bindingsOfAssemblyBeingBuilt, bindingIndex, moduleBindingsCount))); bindingIndex += moduleBindingsCount; } @@ -395,9 +395,9 @@ internal partial class CommonReferenceManager } // +1 for the assembly being built - result.Add(ValueTuple.Create( - explicitReferences[referenceIndex], - new ArraySegment(referenceBindings[explicitReferenceMapping.Index + 1]))); + result.Add( + (explicitReferences[referenceIndex], + new ArraySegment(referenceBindings[explicitReferenceMapping.Index + 1]))); } // we have a reference binding for each module and for each referenced assembly: diff --git a/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.Resolution.cs b/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.Resolution.cs index 7c839112c5efd99b0e8e2dfcd0912f81bb8d162e..fa4daa3a2941ed53e1da410d7225717e8dcc31a8 100644 --- a/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.Resolution.cs +++ b/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.Resolution.cs @@ -194,7 +194,7 @@ public ReferencedAssemblyIdentity(AssemblyIdentity identity, MetadataReference r TCompilation compilation, [Out] Dictionary> assemblyReferencesBySimpleName, out ImmutableArray references, - out IDictionary, MetadataReference> boundReferenceDirectiveMap, + out IDictionary<(string, string), MetadataReference> boundReferenceDirectiveMap, out ImmutableArray boundReferenceDirectives, out ImmutableArray assemblies, out ImmutableArray modules, @@ -746,7 +746,7 @@ private static void AddModule(PEModule module, int referenceIndex, ResolvedRefer TCompilation compilation, DiagnosticBag diagnostics, out ImmutableArray references, - out IDictionary, MetadataReference> boundReferenceDirectives, + out IDictionary<(string, string), MetadataReference> boundReferenceDirectives, out ImmutableArray referenceDirectiveLocations) { boundReferenceDirectives = null; @@ -765,7 +765,7 @@ private static void AddModule(PEModule module, int referenceIndex, ResolvedRefer } // we already successfully bound #r with the same value: - if (boundReferenceDirectives != null && boundReferenceDirectives.ContainsKey(ValueTuple.Create(referenceDirective.Location.SourceTree.FilePath, referenceDirective.File))) + if (boundReferenceDirectives != null && boundReferenceDirectives.ContainsKey((referenceDirective.Location.SourceTree.FilePath, referenceDirective.File))) { continue; } @@ -779,13 +779,13 @@ private static void AddModule(PEModule module, int referenceIndex, ResolvedRefer if (boundReferenceDirectives == null) { - boundReferenceDirectives = new Dictionary, MetadataReference>(); + boundReferenceDirectives = new Dictionary<(string, string), MetadataReference>(); referenceDirectiveLocationsBuilder = ArrayBuilder.GetInstance(); } referencesBuilder.Add(boundReference); referenceDirectiveLocationsBuilder.Add(referenceDirective.Location); - boundReferenceDirectives.Add(ValueTuple.Create(referenceDirective.Location.SourceTree.FilePath, referenceDirective.File), boundReference); + boundReferenceDirectives.Add((referenceDirective.Location.SourceTree.FilePath, referenceDirective.File), boundReference); } // add external reference at the end, so that they are processed first: @@ -801,7 +801,7 @@ private static void AddModule(PEModule module, int referenceIndex, ResolvedRefer if (boundReferenceDirectives == null) { // no directive references resolved successfully: - boundReferenceDirectives = SpecializedCollections.EmptyDictionary, MetadataReference>(); + boundReferenceDirectives = SpecializedCollections.EmptyDictionary<(string, string), MetadataReference>(); } references = referencesBuilder.ToImmutable(); diff --git a/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs b/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs index 8c011381faf161a345b6b7539285ef69d7877e6f..f57691e14c918fe513b8f9cdfc8c8fc3b889f774 100644 --- a/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs +++ b/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs @@ -36,7 +36,7 @@ internal abstract class CommonReferenceManager /// /// Enumerates all referenced assemblies and their aliases. /// - internal abstract IEnumerable>> GetReferencedAssemblyAliases(); + internal abstract IEnumerable<(IAssemblySymbol, ImmutableArray)> GetReferencedAssemblyAliases(); internal abstract MetadataReference GetMetadataReference(IAssemblySymbol assemblySymbol); internal abstract ImmutableArray ExplicitReferences { get; } @@ -100,7 +100,7 @@ internal partial class CommonReferenceManager : C /// Maps (containing syntax tree file name, reference string) of #r directive to a resolved metadata reference. /// If multiple #r's in the same tree use the same value as a reference the resolved metadata reference is the same as well. /// - private IDictionary, MetadataReference> _lazyReferenceDirectiveMap; + private IDictionary<(string, string), MetadataReference> _lazyReferenceDirectiveMap; /// /// Array of unique bound #r references. @@ -216,7 +216,7 @@ internal bool HasCircularReference } } - internal IDictionary, MetadataReference> ReferenceDirectiveMap + internal IDictionary<(string, string), MetadataReference> ReferenceDirectiveMap { get { @@ -373,7 +373,7 @@ internal bool IsBound internal void InitializeNoLock( Dictionary referencedAssembliesMap, Dictionary referencedModulesMap, - IDictionary, MetadataReference> boundReferenceDirectiveMap, + IDictionary<(string, string), MetadataReference> boundReferenceDirectiveMap, ImmutableArray directiveReferences, ImmutableArray explicitReferences, ImmutableArray implicitReferences, @@ -662,11 +662,11 @@ internal override MetadataReference GetMetadataReference(IAssemblySymbol assembl return null; } - internal override IEnumerable>> GetReferencedAssemblyAliases() + internal override IEnumerable<(IAssemblySymbol, ImmutableArray)> GetReferencedAssemblyAliases() { for (int i = 0; i < ReferencedAssemblies.Length; i++) { - yield return ValueTuple.Create((IAssemblySymbol)ReferencedAssemblies[i], AliasesOfReferencedAssemblies[i]); + yield return ((IAssemblySymbol)ReferencedAssemblies[i], AliasesOfReferencedAssemblies[i]); } } diff --git a/src/Compilers/Core/Portable/Syntax/GreenNode.cs b/src/Compilers/Core/Portable/Syntax/GreenNode.cs index c40d16ff083d202b8099e1fe2754a2527c961759..babab88373c6ad60899b699417cf3acf1281b262 100644 --- a/src/Compilers/Core/Portable/Syntax/GreenNode.cs +++ b/src/Compilers/Core/Portable/Syntax/GreenNode.cs @@ -646,15 +646,16 @@ public void WriteTo(System.IO.TextWriter writer) protected internal void WriteTo(TextWriter writer, bool leading, bool trailing) { // Use an actual Stack so we can write out deeply recursive structures without overflowing. - var stack = new Stack>(); - stack.Push(ValueTuple.Create(this, leading, trailing)); + var stack = new Stack<(GreenNode node, bool leading, bool trailing)>(); + stack.Push((this, leading, trailing)); // Separated out stack processing logic so that it does not unintentially refer to // "this", "leading" or "trailing. ProcessStack(writer, stack); } - private static void ProcessStack(TextWriter writer, Stack> stack) + private static void ProcessStack(TextWriter writer, + Stack<(GreenNode node, bool leading, bool trailing)> stack) { while (stack.Count > 0) { @@ -685,7 +686,7 @@ private static void ProcessStack(TextWriter writer, Stack parse SpansAndKindsAndIds = ImmutableArray.CreateRange(GetSpansRecursive(markedSource, 0, getSyntaxKind)); } - private static IEnumerable> GetSpansRecursive(string markedSource, int offset, Func getSyntaxKind) + private static IEnumerable<(TextSpan, int, int)> GetSpansRecursive(string markedSource, int offset, Func getSyntaxKind) { foreach (var match in s_markerPattern.Matches(markedSource).ToEnumerable()) { @@ -38,7 +38,7 @@ public SourceWithMarkedNodes(string markedSource, Func parse var parsedKind = string.IsNullOrEmpty(syntaxKindOpt) ? 0 : getSyntaxKind(syntaxKindOpt); int absoluteOffset = offset + markedSyntax.Index; - yield return ValueTuple.Create(new TextSpan(absoluteOffset, markedSyntax.Length), parsedKind, id); + yield return (new TextSpan(absoluteOffset, markedSyntax.Length), parsedKind, id); foreach (var nestedSpan in GetSpansRecursive(markedSyntax.Value, absoluteOffset, getSyntaxKind)) { diff --git a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/DebugLogMessage.cs b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/DebugLogMessage.cs index c09cf9cd74a38beae144ea5480e38627aa8980fd..fcdf865dd2d0505626b31fe5f2b58c6d6a8d97be 100644 --- a/src/VisualStudio/Core/Def/Implementation/EditAndContinue/DebugLogMessage.cs +++ b/src/VisualStudio/Core/Def/Implementation/EditAndContinue/DebugLogMessage.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Linq; using System.Threading; diff --git a/src/VisualStudio/Core/Def/Implementation/Library/FindResults/LibraryManager_FindReferences.cs b/src/VisualStudio/Core/Def/Implementation/Library/FindResults/LibraryManager_FindReferences.cs index eac8eb9db80da0b9e451bfd7bdce009cd99a24b1..b1fa0f56c08fbfa20e76887c67621c182539d400 100644 --- a/src/VisualStudio/Core/Def/Implementation/Library/FindResults/LibraryManager_FindReferences.cs +++ b/src/VisualStudio/Core/Def/Implementation/Library/FindResults/LibraryManager_FindReferences.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; diff --git a/src/Workspaces/CSharp/Portable/Formatting/Engine/AggregatedFormattingResult.cs b/src/Workspaces/CSharp/Portable/Formatting/Engine/AggregatedFormattingResult.cs index 78290850ba70e50d3ba30d7759677122dfe07a19..13e8d3a05cbd4267a3b6e6b2e0eada7994e68490 100644 --- a/src/Workspaces/CSharp/Portable/Formatting/Engine/AggregatedFormattingResult.cs +++ b/src/Workspaces/CSharp/Portable/Formatting/Engine/AggregatedFormattingResult.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Linq; using System.Threading; diff --git a/src/Workspaces/CSharp/Portable/Formatting/Engine/Trivia/TriviaDataFactory.cs b/src/Workspaces/CSharp/Portable/Formatting/Engine/Trivia/TriviaDataFactory.cs index 7c5da5e208dce8b8c22dd2db0d5e2010df3a9852..735080f817b725d17e08804ab2d93ee34f2fd5c1 100644 --- a/src/Workspaces/CSharp/Portable/Formatting/Engine/Trivia/TriviaDataFactory.cs +++ b/src/Workspaces/CSharp/Portable/Formatting/Engine/Trivia/TriviaDataFactory.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Diagnostics; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; diff --git a/src/Workspaces/CSharp/Portable/Formatting/Engine/Trivia/TriviaRewriter.cs b/src/Workspaces/CSharp/Portable/Formatting/Engine/Trivia/TriviaRewriter.cs index 2573a7dd6f6eee1be2b1f37c5e2939ce76bcc471..464eef01cc59c36936f20354e6c7a5f4386ecf8d 100644 --- a/src/Workspaces/CSharp/Portable/Formatting/Engine/Trivia/TriviaRewriter.cs +++ b/src/Workspaces/CSharp/Portable/Formatting/Engine/Trivia/TriviaRewriter.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Linq; using System.Threading; diff --git a/src/Workspaces/CSharp/Portable/Formatting/Rules/IndentBlockFormattingRule.cs b/src/Workspaces/CSharp/Portable/Formatting/Rules/IndentBlockFormattingRule.cs index f0b8fc17841f305af9cfc004401fd0b691b8655c..ad5d5a7540a1f5b00ed38cc4b57838cbfeeb2550 100644 --- a/src/Workspaces/CSharp/Portable/Formatting/Rules/IndentBlockFormattingRule.cs +++ b/src/Workspaces/CSharp/Portable/Formatting/Rules/IndentBlockFormattingRule.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Composition; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -204,7 +205,7 @@ private void AddBlockIndentationOperation(List list, Synta AddIndentBlockOperation(list, bracePair.Item1.GetNextToken(includeZeroWidth: true), bracePair.Item2.GetPreviousToken(includeZeroWidth: true)); } - private void AddAlignmentBlockOperationRelativeToFirstTokenOnBaseTokenLine(List list, Roslyn.Utilities.ValueTuple bracePair) + private void AddAlignmentBlockOperationRelativeToFirstTokenOnBaseTokenLine(List list, ValueTuple bracePair) { var option = IndentBlockOption.RelativeToFirstTokenOnBaseTokenLine; SetAlignmentBlockOperation(list, bracePair.Item1, bracePair.Item1.GetNextToken(includeZeroWidth: true), bracePair.Item2, option); diff --git a/src/Workspaces/CSharp/Portable/Formatting/Rules/WrappingFormattingRule.cs b/src/Workspaces/CSharp/Portable/Formatting/Rules/WrappingFormattingRule.cs index 3192dcce077505f025aecec312f830d5a974f97d..3f308fbcf43b619522663562b8ec3df96c86f7ba 100644 --- a/src/Workspaces/CSharp/Portable/Formatting/Rules/WrappingFormattingRule.cs +++ b/src/Workspaces/CSharp/Portable/Formatting/Rules/WrappingFormattingRule.cs @@ -74,7 +74,7 @@ public override void AddSuppressOperations(List list, SyntaxN private void AddSpecificNodesSuppressOperations(List list, SyntaxNode node) { var tokens = GetSpecificNodeSuppressionTokenRange(node); - if (tokens != default(ValueTuple)) + if (!tokens.Equals(default(ValueTuple))) { AddSuppressWrappingIfOnSingleLineOperation(list, tokens.Item1, tokens.Item2); } @@ -106,7 +106,7 @@ private void RemoveSuppressOperationForStatementMethodDeclaration(List)) + if (!tokens.Equals(default(ValueTuple))) { RemoveSuppressOperation(list, tokens.Item1, tokens.Item2); } diff --git a/src/Workspaces/Core/Portable/CodeGeneration/AbstractFlagsEnumGenerator.cs b/src/Workspaces/Core/Portable/CodeGeneration/AbstractFlagsEnumGenerator.cs index e46bc4b817448f2dbec3280f239523ecaac9d20b..3b6dc515d9676693e6c2ff9e12cd0b1305d9a229 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/AbstractFlagsEnumGenerator.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/AbstractFlagsEnumGenerator.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Linq; using Microsoft.CodeAnalysis; diff --git a/src/Workspaces/Core/Portable/Formatting/Engine/AbstractAggregatedFormattingResult.cs b/src/Workspaces/Core/Portable/Formatting/Engine/AbstractAggregatedFormattingResult.cs index 34e80fdea599d794e33918378de55b75dcd0372a..22281dadf90e081e330062f8ae678b1754c70d12 100644 --- a/src/Workspaces/Core/Portable/Formatting/Engine/AbstractAggregatedFormattingResult.cs +++ b/src/Workspaces/Core/Portable/Formatting/Engine/AbstractAggregatedFormattingResult.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Linq; using System.Threading; diff --git a/src/Workspaces/Core/Portable/Formatting/Engine/AbstractFormattingResult.cs b/src/Workspaces/Core/Portable/Formatting/Engine/AbstractFormattingResult.cs index 7bbd7d2e701a591a43c3ae182f4d241067deba2d..d0ba6d77f6369725f220655971606e73de3a0237 100644 --- a/src/Workspaces/Core/Portable/Formatting/Engine/AbstractFormattingResult.cs +++ b/src/Workspaces/Core/Portable/Formatting/Engine/AbstractFormattingResult.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Threading; using Microsoft.CodeAnalysis.Internal.Log; diff --git a/src/Workspaces/Core/Portable/SymbolKey/SymbolKey.BodyLevelSymbolKey.cs b/src/Workspaces/Core/Portable/SymbolKey/SymbolKey.BodyLevelSymbolKey.cs index 1b99fb554ed4225f55995c3cdd4898464c6f2b7b..69e98f06cdd811bed218a8b5f70a331f1877753c 100644 --- a/src/Workspaces/Core/Portable/SymbolKey/SymbolKey.BodyLevelSymbolKey.cs +++ b/src/Workspaces/Core/Portable/SymbolKey/SymbolKey.BodyLevelSymbolKey.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Linq; using System.Threading; diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.State.cs b/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.State.cs index 743be5ed4509e83fe52627e48f6ba582298c6566..bd843fa0cd7b9aa525338c1e3575aff05817e7bb 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.State.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.State.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis; diff --git a/src/Workspaces/Core/Portable/Workspaces.csproj b/src/Workspaces/Core/Portable/Workspaces.csproj index 935b1c632844c522bb7a73ed65fec3d5a938d230..86c637ecb2c0f0493dc2db52a0cc6aec5fa4c834 100644 --- a/src/Workspaces/Core/Portable/Workspaces.csproj +++ b/src/Workspaces/Core/Portable/Workspaces.csproj @@ -165,15 +165,6 @@ InternalUtilities\TextChangeRangeExtensions.cs - - InternalUtilities\ValueTuple.cs - - - InternalUtilities\ValueTuple`2.cs - - - InternalUtilities\ValueTuple`3.cs - InternalUtilities\WeakReferenceExtensions.cs diff --git a/src/Workspaces/Remote/Core/Services/AssetSource.cs b/src/Workspaces/Remote/Core/Services/AssetSource.cs index e5f8f677f7948d423a5f31d254cbaed0a7e10a48..8c61302c2c1e3c8ce4e3bca01122ab8812b29ea0 100644 --- a/src/Workspaces/Remote/Core/Services/AssetSource.cs +++ b/src/Workspaces/Remote/Core/Services/AssetSource.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; diff --git a/src/Workspaces/Remote/Core/Services/SolutionService.cs b/src/Workspaces/Remote/Core/Services/SolutionService.cs index f04f15c891bd49082a262de8081ad1d5025cdd22..c72417db6e889933497b1b2a3d31582c374c54db 100644 --- a/src/Workspaces/Remote/Core/Services/SolutionService.cs +++ b/src/Workspaces/Remote/Core/Services/SolutionService.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; diff --git a/src/Workspaces/Remote/ServiceHub/Services/SnapshotService.JsonRpcAssetSource.cs b/src/Workspaces/Remote/ServiceHub/Services/SnapshotService.JsonRpcAssetSource.cs index 06261ebd0e2b47427230189e1824c7d29e3965fa..31e8259f554f66ff1c8ad668942c12fa17826659 100644 --- a/src/Workspaces/Remote/ServiceHub/Services/SnapshotService.JsonRpcAssetSource.cs +++ b/src/Workspaces/Remote/ServiceHub/Services/SnapshotService.JsonRpcAssetSource.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.IO; using System.Linq;