提交 9346619f 编写于 作者: T Tomas Matousek

Rename BitArray to BitVector to avoid conflict with System.Collections.BitArray

上级 8bbe2203
......@@ -77,7 +77,7 @@ internal partial class DataFlowPass : AbstractFlowPass<DataFlowPass.LocalState>
/// Tracks variables for which we have already reported a definite assignment error. This
/// allows us to report at most one such error per variable.
/// </summary>
private BitArray _alreadyReported;
private BitVector _alreadyReported;
/// <summary>
/// Reflects the enclosing method or lambda at the current location (in the bound tree).
......@@ -174,7 +174,7 @@ protected override ImmutableArray<PendingBranch> Scan(ref bool badRegion)
this.Diagnostics.Clear();
ImmutableArray<ParameterSymbol> methodParameters = MethodParameters;
ParameterSymbol methodThisParameter = MethodThisParameter;
_alreadyReported = BitArray.Empty; // no variables yet reported unassigned
_alreadyReported = BitVector.Empty; // no variables yet reported unassigned
this.State = ReachableState(); // entry point is reachable
this.regionPlace = RegionPlace.Before;
EnterParameters(methodParameters); // with parameters assigned
......@@ -1171,12 +1171,12 @@ private void SetSlotUnassigned(int slot)
protected override LocalState ReachableState()
{
return new LocalState(BitArray.Empty);
return new LocalState(BitVector.Empty);
}
protected override LocalState AllBitsSet()
{
var result = new LocalState(BitArray.AllSet(nextVariableSlot));
var result = new LocalState(BitVector.AllSet(nextVariableSlot));
result.Assigned[0] = false;
return result;
}
......@@ -1878,7 +1878,7 @@ protected override string Dump(LocalState state)
return builder.ToString();
}
protected void AppendBitNames(BitArray a, StringBuilder builder)
protected void AppendBitNames(BitVector a, StringBuilder builder)
{
bool any = false;
foreach (int bit in a.TrueBits())
......@@ -1948,9 +1948,9 @@ protected override bool IntersectWith(ref LocalState self, ref LocalState other)
internal struct LocalState : AbstractLocalState
{
internal BitArray Assigned;
internal BitVector Assigned;
internal LocalState(BitArray assigned)
internal LocalState(BitVector assigned)
{
this.Assigned = assigned;
Debug.Assert(!assigned.IsNull);
......
......@@ -726,10 +726,10 @@ internal FieldSymbol DefineCallSiteStorageSymbol(NamedTypeSymbol containerDefini
}
}
BitArray byRefs;
BitVector byRefs;
if (hasByRefs)
{
byRefs = BitArray.Create(1 + (loweredReceiver != null ? 1 : 0) + loweredArguments.Length + (loweredRight != null ? 1 : 0));
byRefs = BitVector.Create(1 + (loweredReceiver != null ? 1 : 0) + loweredArguments.Length + (loweredRight != null ? 1 : 0));
int j = 1;
if (loweredReceiver != null)
......@@ -750,7 +750,7 @@ internal FieldSymbol DefineCallSiteStorageSymbol(NamedTypeSymbol containerDefini
}
else
{
byRefs = default(BitArray);
byRefs = default(BitVector);
}
int parameterCount = delegateSignature.Length - (returnsVoid ? 0 : 1);
......
......@@ -35,11 +35,11 @@ internal sealed partial class AnonymousTypeManager
private struct SynthesizedDelegateKey : IEquatable<SynthesizedDelegateKey>
{
private readonly BitArray _byRefs;
private readonly BitVector _byRefs;
private readonly ushort _parameterCount;
private readonly byte _returnsVoid;
public SynthesizedDelegateKey(int parameterCount, BitArray byRefs, bool returnsVoid)
public SynthesizedDelegateKey(int parameterCount, BitVector byRefs, bool returnsVoid)
{
_parameterCount = (ushort)parameterCount;
_returnsVoid = (byte)(returnsVoid ? 1 : 0);
......@@ -182,7 +182,7 @@ private void CheckSourceLocationSeen(AnonymousTypePublicSymbol anonymous)
}
}
internal SynthesizedDelegateSymbol SynthesizeDelegate(int parameterCount, BitArray byRefParameters, bool returnsVoid)
internal SynthesizedDelegateSymbol SynthesizeDelegate(int parameterCount, BitVector byRefParameters, bool returnsVoid)
{
// parameterCount doesn't include return type
Debug.Assert(byRefParameters.IsNull || parameterCount == byRefParameters.Capacity);
......
......@@ -484,7 +484,7 @@ private static bool InterfacesAreDistinct(NamedTypeSymbol type, ConsList<Symbol>
CSharpSyntaxNode syntaxNode,
Compilation currentCompilation,
DiagnosticBag diagnostics,
BitArray skipParameters = default(BitArray))
BitVector skipParameters = default(BitVector))
{
if (!RequiresChecking(method))
{
......@@ -564,7 +564,7 @@ private static bool InterfacesAreDistinct(NamedTypeSymbol type, ConsList<Symbol>
Compilation currentCompilation,
ArrayBuilder<TypeParameterDiagnosticInfo> diagnosticsBuilder,
ref ArrayBuilder<TypeParameterDiagnosticInfo> useSiteDiagnosticsBuilder,
BitArray skipParameters = default(BitArray))
BitVector skipParameters = default(BitVector))
{
return CheckConstraints(
method,
......@@ -600,7 +600,7 @@ private static bool InterfacesAreDistinct(NamedTypeSymbol type, ConsList<Symbol>
Compilation currentCompilation,
ArrayBuilder<TypeParameterDiagnosticInfo> diagnosticsBuilder,
ref ArrayBuilder<TypeParameterDiagnosticInfo> useSiteDiagnosticsBuilder,
BitArray skipParameters = default(BitArray))
BitVector skipParameters = default(BitVector))
{
Debug.Assert(typeParameters.Length == typeArguments.Length);
Debug.Assert(typeParameters.Length > 0);
......
......@@ -22,7 +22,7 @@ internal sealed class SynthesizedDelegateSymbol : SynthesizedContainer
TypeSymbol intPtrType,
TypeSymbol voidReturnTypeOpt,
int parameterCount,
BitArray byRefParameters)
BitVector byRefParameters)
: base(name, parameterCount, returnsVoid: (object)voidReturnTypeOpt != null)
{
_containingSymbol = containingSymbol;
......@@ -102,7 +102,7 @@ private sealed class InvokeMethod : SynthesizedInstanceMethodSymbol
private readonly TypeSymbol _containingType;
private readonly TypeSymbol _returnType;
internal InvokeMethod(SynthesizedDelegateSymbol containingType, BitArray byRefParameters, TypeSymbol voidReturnTypeOpt)
internal InvokeMethod(SynthesizedDelegateSymbol containingType, BitVector byRefParameters, TypeSymbol voidReturnTypeOpt)
{
var typeParams = containingType.TypeParameters;
......
......@@ -22,9 +22,9 @@ public void UpperBitsUnset()
{
for (int b = -1; b < 2; b++) // number of bits more or less than that number of words
{
int n = BitArray.BitsPerWord * a + b;
int n = BitVector.BitsPerWord * a + b;
if (n < 0) continue;
BitArray arr = BitArray.AllSet(n);
BitVector arr = BitVector.AllSet(n);
if (n > 0) Assert.True(arr[n - 1]);
Assert.False(arr[n]);
}
......@@ -50,7 +50,7 @@ public void CheckRandomData()
private void CheckRandomDataCore(Random r1, Random r2, int capacity)
{
BitArray d = BitArray.Create(capacity);
BitVector d = BitVector.Create(capacity);
Assert.Equal(capacity, d.Capacity);
for (int i1 = 0; i1 < capacity; i1++)
d[i1] = r1.NextBool();
......@@ -74,7 +74,7 @@ public void CheckIntersection()
private void CheckIntersectionCore(int capacity, Random r)
{
BitArray b1 = BitArray.Empty, b2 = BitArray.Empty;
BitVector b1 = BitVector.Empty, b2 = BitVector.Empty;
b1.EnsureCapacity(capacity);
b2.EnsureCapacity(capacity);
bool[] a1 = new bool[capacity], a2 = new bool[capacity];
......@@ -112,7 +112,7 @@ public void CheckUnion()
private void CheckUnionCore(int capacity, Random r)
{
BitArray b1 = BitArray.Empty, b2 = BitArray.Empty;
BitVector b1 = BitVector.Empty, b2 = BitVector.Empty;
b1.EnsureCapacity(capacity);
b2.EnsureCapacity(capacity);
bool[] a1 = new bool[capacity], a2 = new bool[capacity];
......@@ -151,7 +151,7 @@ public void CheckTrueBits()
private void CheckTrueBitsCore(int capacity, Random r1, Random r2)
{
BitArray b = BitArray.Create(capacity);
BitVector b = BitVector.Create(capacity);
for (int i = 0; i < capacity; i++)
{
b[i] = r1.NextBool();
......
......@@ -93,7 +93,7 @@
<Compile Include="CodeGen\Win32Res.cs" />
<Compile Include="Collections\ArrayBuilderExtensions.cs" />
<Compile Include="Collections\ArrayElement.cs" />
<Compile Include="Collections\BitArray.cs" />
<Compile Include="Collections\BitVector.cs" />
<Compile Include="Collections\Boxes.cs" />
<Compile Include="Collections\ByteSequenceComparer.cs" />
<Compile Include="Collections\CachingDictionary.cs" />
......
......@@ -3,19 +3,18 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
using Word = System.UInt32;
namespace Microsoft.CodeAnalysis
{
internal struct BitArray : IEquatable<BitArray>
internal struct BitVector : IEquatable<BitVector>
{
// Cannot expose the following two field publicly because this structure is mutable
// and might become not null/empty, unless we restrict access to it.
private static Word[] s_emptyArray = SpecializedCollections.EmptyArray<Word>();
private static readonly BitArray s_nullValue = new BitArray(0, null, 0);
private static readonly BitArray s_emptyValue = new BitArray(0, s_emptyArray, 0);
private static readonly BitVector s_nullValue = new BitVector(0, null, 0);
private static readonly BitVector s_emptyValue = new BitVector(0, s_emptyArray, 0);
private const int Log2BitsPerWord = 5;
internal const int BitsPerWord = 1 << Log2BitsPerWord;
......@@ -25,7 +24,7 @@ internal struct BitArray : IEquatable<BitArray>
private Word[] _bits;
private int _capacity;
private BitArray(Word bits0, Word[] bits, int capacity)
private BitVector(Word bits0, Word[] bits, int capacity)
{
int requiredWords = WordsForCapacity(capacity);
Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length);
......@@ -35,7 +34,7 @@ private BitArray(Word bits0, Word[] bits, int capacity)
Check();
}
public bool Equals(BitArray other)
public bool Equals(BitVector other)
{
// Bit arrays only equal if their underlying sets are of the same size.
return _capacity == other._capacity
......@@ -45,7 +44,7 @@ public bool Equals(BitArray other)
public override bool Equals(object obj)
{
return obj is BitArray && Equals((BitArray)obj);
return obj is BitVector && Equals((BitVector)obj);
}
public override int GetHashCode()
......@@ -146,11 +145,11 @@ public IEnumerable<int> TrueBits()
/// <summary>
/// Create BitArray with at least the specified number of bits.
/// </summary>
public static BitArray Create(int capacity)
public static BitVector Create(int capacity)
{
int requiredWords = WordsForCapacity(capacity);
Word[] bits = (requiredWords == 0) ? s_emptyArray : new Word[requiredWords];
return new BitArray(0, bits, capacity);
return new BitVector(0, bits, capacity);
}
/// <summary>
......@@ -158,7 +157,7 @@ public static BitArray Create(int capacity)
/// </summary>
/// <param name="capacity"></param>
/// <returns></returns>
public static BitArray AllSet(int capacity)
public static BitVector AllSet(int capacity)
{
int requiredWords = WordsForCapacity(capacity);
Word[] bits = (requiredWords == 0) ? s_emptyArray : new Word[requiredWords];
......@@ -185,16 +184,16 @@ public static BitArray AllSet(int capacity)
bits[lastWord] = ~ZeroWord;
}
return new BitArray(bits0, bits, capacity);
return new BitVector(bits0, bits, capacity);
}
/// <summary>
/// Maky a copy of a bit array.
/// </summary>
/// <returns></returns>
public BitArray Clone()
public BitVector Clone()
{
return new BitArray(_bits0, (_bits == null) ? null : (_bits.Length == 0) ? s_emptyArray : (Word[])_bits.Clone(), _capacity);
return new BitVector(_bits0, (_bits == null) ? null : (_bits.Length == 0) ? s_emptyArray : (Word[])_bits.Clone(), _capacity);
}
/// <summary>
......@@ -208,7 +207,7 @@ public bool IsNull
}
}
public static BitArray Null
public static BitVector Null
{
get
{
......@@ -216,7 +215,7 @@ public static BitArray Null
}
}
public static BitArray Empty
public static BitVector Empty
{
get
{
......@@ -229,7 +228,7 @@ public static BitArray Empty
/// For the purposes of the intersection, any bits beyond the current length will be treated as zeroes.
/// Return true if any changes were made to the bits of this bit vector.
/// </summary>
public bool IntersectWith(BitArray other)
public bool IntersectWith(BitVector other)
{
bool anyChanged = false;
int otherLength = other._bits.Length;
......@@ -279,7 +278,7 @@ public bool IntersectWith(BitArray other)
/// Modify this bit vector by '|'ing each element with the other bit vector.
/// </summary>
/// <param name="other"></param>
public void UnionWith(BitArray other)
public void UnionWith(BitVector other)
{
int l = other._bits.Length;
if (l > _bits.Length)
......
......@@ -45,9 +45,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Next
End Sub
Private Shared ReadOnly Property UnreachableBitsSet As BitArray
Private Shared ReadOnly Property UnreachableBitsSet As BitVector
Get
Return BitArray.AllSet(1)
Return BitVector.AllSet(1)
End Get
End Property
......@@ -55,7 +55,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
''' Intersect bit arrays taking into account 'all bits set' flag
''' </summary>
''' <remarks>receiver will be changed as a result</remarks>
Private Shared Function IntersectBitArrays(ByRef receiver As BitArray, other As BitArray) As Boolean
Private Shared Function IntersectBitArrays(ByRef receiver As BitVector, other As BitVector) As Boolean
' NOTE: a state with 'unreachable' slot set to 'assigned' means 'all bits are set'
If other(SlotKind.Unreachable) Then
' OTHER state has 'all bits set', thus, RECEIVER does not need to be changed
......@@ -76,7 +76,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
''' Union bit arrays taking into account 'all bits set' flag
''' </summary>
''' <remarks>receiver will be changed as a result</remarks>
Private Shared Sub UnionBitArrays(ByRef receiver As BitArray, other As BitArray)
Private Shared Sub UnionBitArrays(ByRef receiver As BitVector, other As BitVector)
' NOTE: a state with 'unreachable' slot set to 'assigned' means 'all bits are set'
If receiver(SlotKind.Unreachable) Then
' RECEIVER state has 'all bits set', thus, it does not need to be changed
......@@ -105,9 +105,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Friend Structure LocalState
Implements AbstractLocalState
Friend Assigned As BitArray
Friend Assigned As BitVector
Friend Sub New(assigned As BitArray)
Friend Sub New(assigned As BitVector)
Debug.Assert(Not assigned.IsNull)
Me.Assigned = assigned
End Sub
......
......@@ -75,7 +75,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
''' Tracks variables for which we have already reported a definite assignment error. This
''' allows us to report at most one such error per variable.
''' </summary>
Private alreadyReported As BitArray
Private alreadyReported As BitVector
''' <summary>
''' Did we see [On Error] or [Resume] statement? Used to suppress some diagnostics.
......@@ -106,7 +106,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
MakeSlot(parameter)
Next
Me.alreadyReported = BitArray.Empty ' no variables yet reported unassigned
Me.alreadyReported = BitVector.Empty ' no variables yet reported unassigned
Me.EnterParameters(MethodParameters) ' with parameters assigned
Dim methodMeParameter = Me.MeParameter ' and with 'Me' assigned as well
If methodMeParameter IsNot Nothing Then
......@@ -199,7 +199,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Sub
Protected Overrides Sub Free()
Me.alreadyReported = BitArray.Null
Me.alreadyReported = BitVector.Null
MyBase.Free()
End Sub
......@@ -211,7 +211,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return builder.ToString()
End Function
Protected Sub AppendBitNames(a As BitArray, builder As StringBuilder)
Protected Sub AppendBitNames(a As BitVector, builder As StringBuilder)
Dim any As Boolean = False
For Each bit In a.TrueBits
If any Then
......@@ -1442,7 +1442,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
#End Region
Protected Overrides Function ReachableState() As LocalState
Return New LocalState(BitArray.Empty)
Return New LocalState(BitVector.Empty)
End Function
Private Sub EnterParameters(parameters As ImmutableArray(Of ParameterSymbol))
......@@ -1486,7 +1486,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Function
Protected Overrides Function AllBitsSet() As LocalState
Dim result = New LocalState(BitArray.AllSet(nextVariableSlot))
Dim result = New LocalState(BitVector.AllSet(nextVariableSlot))
result.Unassign(SlotKind.Unreachable)
Return result
End Function
......
......@@ -851,7 +851,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
BindLambdaForErrorRecoveryInferCommonType(commonReturnType, target.ReturnType)
Next
Dim isByRef = BitArray.Empty
Dim isByRef = BitVector.Empty
For i As Integer = 0 To commonParameterTypes.Length - 1
If source.Parameters(i).Type IsNot Nothing Then
......
......@@ -133,9 +133,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Friend Class TargetSignature
Public ReadOnly ParameterTypes As ImmutableArray(Of TypeSymbol)
Public ReadOnly ReturnType As TypeSymbol
Private ReadOnly m_isByRef As BitArray
Private ReadOnly m_isByRef As BitVector
Public Sub New(parameterTypes As ImmutableArray(Of TypeSymbol), isByRef As BitArray, returnType As TypeSymbol)
Public Sub New(parameterTypes As ImmutableArray(Of TypeSymbol), isByRef As BitVector, returnType As TypeSymbol)
Debug.Assert(Not parameterTypes.IsDefault)
Debug.Assert(Not isByRef.IsNull)
Debug.Assert(returnType IsNot Nothing)
......@@ -148,7 +148,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Debug.Assert(Not params.IsDefault)
Debug.Assert(returnType IsNot Nothing)
Dim isByRef = BitArray.Empty
Dim isByRef = BitVector.Empty
If params.Length = 0 Then
Me.ParameterTypes = ImmutableArray(Of TypeSymbol).Empty
......@@ -174,7 +174,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Me.New(method.Parameters, method.ReturnType)
End Sub
Public ReadOnly Property IsByRef As BitArray
Public ReadOnly Property IsByRef As BitVector
Get
Return m_isByRef
End Get
......
......@@ -1954,7 +1954,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Dim conversionKinds = ArrayBuilder(Of KeyValuePair(Of ConversionKind, ConversionKind)).GetInstance()
conversionKinds.ZeroInit(opSet.Count)
Dim applicable = BitArray.Create(opSet.Count)
Dim applicable = BitVector.Create(opSet.Count)
Dim bestMatch As MethodSymbol = Nothing
If DetermineMostSpecificWideningConversion(source, destination, opSet, conversionKinds, applicable, bestMatch, suppressViabilityChecks:=False, useSiteDiagnostics:=useSiteDiagnostics) Then
......@@ -2026,7 +2026,7 @@ Done:
destination As TypeSymbol,
opSet As ArrayBuilder(Of MethodSymbol),
conversionKinds As ArrayBuilder(Of KeyValuePair(Of ConversionKind, ConversionKind)),
<[In]()> ByRef applicable As BitArray,
<[In]()> ByRef applicable As BitVector,
<Out()> ByRef bestMatch As MethodSymbol,
suppressViabilityChecks As Boolean,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
......@@ -2248,7 +2248,7 @@ Done:
Private Shared Function ChooseMostSpecificConversionOperator(
opSet As ArrayBuilder(Of MethodSymbol),
applicable As BitArray,
applicable As BitVector,
mostSpecificSourceType As TypeSymbol,
mostSpecificTargetType As TypeSymbol,
<Out()> ByRef bestMatchIsAmbiguous As Boolean
......@@ -2360,7 +2360,7 @@ Done:
destination As TypeSymbol,
opSet As ArrayBuilder(Of MethodSymbol),
conversionKinds As ArrayBuilder(Of KeyValuePair(Of ConversionKind, ConversionKind)),
<[In]()> ByRef applicable As BitArray,
<[In]()> ByRef applicable As BitVector,
<Out()> ByRef bestMatch As MethodSymbol,
suppressViabilityChecks As Boolean,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
......@@ -2785,11 +2785,11 @@ Next_i:
Dim result As Integer = 0
Dim definition As MethodSymbol = method.OriginalDefinition
If DetectReferencesToGenericParameters(definition.Parameters(0).Type, TypeParameterKind.Type, BitArray.Null) <> TypeParameterKind.None Then
If DetectReferencesToGenericParameters(definition.Parameters(0).Type, TypeParameterKind.Type, BitVector.Null) <> TypeParameterKind.None Then
result += 1
End If
If DetectReferencesToGenericParameters(definition.ReturnType, TypeParameterKind.Type, BitArray.Null) <> TypeParameterKind.None Then
If DetectReferencesToGenericParameters(definition.ReturnType, TypeParameterKind.Type, BitVector.Null) <> TypeParameterKind.None Then
result += 1
End If
......
......@@ -69,9 +69,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
''' Extension method type parameters that were fixed during currying, if any.
''' If none were fixed, BitArray.Null should be returned.
''' </summary>
Overridable ReadOnly Property FixedTypeParameters As BitArray
Overridable ReadOnly Property FixedTypeParameters As BitVector
Get
Return BitArray.Null
Return BitVector.Null
End Get
End Property
......@@ -230,16 +230,16 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Public NotInheritable Class ExtensionMethodCandidate
Inherits MethodCandidate
Private m_FixedTypeParameters As BitArray
Private m_FixedTypeParameters As BitVector
Public Sub New(method As MethodSymbol)
Me.New(method, GetFixedTypeParameters(method))
End Sub
' TODO: Consider building this bitmap lazily, on demand.
Private Shared Function GetFixedTypeParameters(method As MethodSymbol) As BitArray
Private Shared Function GetFixedTypeParameters(method As MethodSymbol) As BitVector
If method.FixedTypeParameters.Length > 0 Then
Dim fixedTypeParameters = BitArray.Create(method.ReducedFrom.Arity)
Dim fixedTypeParameters = BitVector.Create(method.ReducedFrom.Arity)
For Each fixed As KeyValuePair(Of TypeParameterSymbol, TypeSymbol) In method.FixedTypeParameters
fixedTypeParameters(fixed.Key.Ordinal) = True
......@@ -251,7 +251,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return Nothing
End Function
Private Sub New(method As MethodSymbol, fixedTypeParameters As BitArray)
Private Sub New(method As MethodSymbol, fixedTypeParameters As BitVector)
MyBase.New(method)
Debug.Assert(method.ReducedFrom IsNot Nothing)
......@@ -270,7 +270,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
Public Overrides ReadOnly Property FixedTypeParameters As BitArray
Public Overrides ReadOnly Property FixedTypeParameters As BitVector
Get
Return m_FixedTypeParameters
End Get
......@@ -699,7 +699,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
Public NotInferredTypeArguments As BitArray
Public NotInferredTypeArguments As BitVector
Public TypeArgumentInferenceDiagnosticsOpt As DiagnosticBag
......@@ -4597,12 +4597,12 @@ ContinueCandidatesLoop:
' Only interested in method type parameters.
Dim leftRefersToATypeParameter = DetectReferencesToGenericParameters(left.Candidate.ReceiverTypeDefinition,
TypeParameterKind.Method,
BitArray.Null)
BitVector.Null)
' Only interested in method type parameters.
Dim rightRefersToATypeParameter = DetectReferencesToGenericParameters(right.Candidate.ReceiverTypeDefinition,
TypeParameterKind.Method,
BitArray.Null)
BitVector.Null)
If (leftRefersToATypeParameter And TypeParameterKind.Method) <> 0 Then
If (rightRefersToATypeParameter And TypeParameterKind.Method) = 0 Then
......@@ -4628,7 +4628,7 @@ ContinueCandidatesLoop:
Private Shared Function DetectReferencesToGenericParameters(
symbol As NamedTypeSymbol,
track As TypeParameterKind,
methodTypeParametersToTreatAsTypeTypeParameters As BitArray
methodTypeParametersToTreatAsTypeTypeParameters As BitVector
) As TypeParameterKind
Dim result As TypeParameterKind = TypeParameterKind.None
......@@ -4661,7 +4661,7 @@ ContinueCandidatesLoop:
Private Shared Function DetectReferencesToGenericParameters(
symbol As TypeParameterSymbol,
track As TypeParameterKind,
methodTypeParametersToTreatAsTypeTypeParameters As BitArray
methodTypeParametersToTreatAsTypeTypeParameters As BitVector
) As TypeParameterKind
If symbol.ContainingSymbol.Kind = SymbolKind.NamedType Then
......@@ -4686,7 +4686,7 @@ ContinueCandidatesLoop:
Private Shared Function DetectReferencesToGenericParameters(
this As TypeSymbol,
track As TypeParameterKind,
methodTypeParametersToTreatAsTypeTypeParameters As BitArray
methodTypeParametersToTreatAsTypeTypeParameters As BitVector
) As TypeParameterKind
Select Case this.Kind
......@@ -4858,7 +4858,7 @@ ContinueCandidatesLoop:
Dim allFailedInferenceIsDueToObject As Boolean = False
Dim someInferenceFailed As Boolean = False
Dim inferenceErrorReasons As InferenceErrorReasons = InferenceErrorReasons.Other
Dim inferredTypeByAssumption As BitArray = Nothing
Dim inferredTypeByAssumption As BitVector = Nothing
Dim typeArgumentsLocation As ImmutableArray(Of SyntaxNodeOrToken) = Nothing
If TypeArgumentInference.Infer(DirectCast(candidate.Candidate.UnderlyingSymbol, MethodSymbol),
......@@ -4920,7 +4920,7 @@ ContinueCandidatesLoop:
candidate.SetInferenceErrorReasons(inferenceErrorReasons)
candidate.NotInferredTypeArguments = BitArray.Create(typeArguments.Length)
candidate.NotInferredTypeArguments = BitVector.Create(typeArguments.Length)
For i As Integer = 0 To typeArguments.Length - 1 Step 1
If typeArguments(i) Is Nothing Then
......
......@@ -29,12 +29,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
ByRef allFailedInferenceIsDueToObject As Boolean,
ByRef someInferenceFailed As Boolean,
ByRef inferenceErrorReasons As InferenceErrorReasons,
<Out> ByRef inferredTypeByAssumption As BitArray,
<Out> ByRef inferredTypeByAssumption As BitVector,
<Out> ByRef typeArgumentsLocation As ImmutableArray(Of SyntaxNodeOrToken),
<[In](), Out()> ByRef asyncLambdaSubToFunctionMismatch As HashSet(Of BoundExpression),
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo),
ByRef diagnostic As DiagnosticBag,
Optional inferTheseTypeParameters As BitArray = Nothing
Optional inferTheseTypeParameters As BitVector = Nothing
) As Boolean
Debug.Assert(candidate Is candidate.ConstructedFrom)
......@@ -711,12 +711,12 @@ HandleAsAGeneralExpression:
ByRef allFailedInferenceIsDueToObject As Boolean,
ByRef someInferenceFailed As Boolean,
ByRef inferenceErrorReasons As InferenceErrorReasons,
<Out> ByRef inferredTypeByAssumption As BitArray,
<Out> ByRef inferredTypeByAssumption As BitVector,
<Out> ByRef typeArgumentsLocation As ImmutableArray(Of SyntaxNodeOrToken),
<[In](), Out()> ByRef asyncLambdaSubToFunctionMismatch As HashSet(Of BoundExpression),
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo),
ByRef diagnostic As DiagnosticBag,
inferTheseTypeParameters As BitArray
inferTheseTypeParameters As BitVector
) As Boolean
Dim graph As New InferenceGraph(diagnostic, candidate, arguments, parameterToArgumentMap, paramArrayItems,
delegateReturnType, delegateReturnTypeReferenceBoundNode, asyncLambdaSubToFunctionMismatch,
......@@ -896,7 +896,7 @@ HandleAsAGeneralExpression:
If typeParameterNode.InferredTypeByAssumption Then
If inferredTypeByAssumption.IsNull Then
inferredTypeByAssumption = BitArray.Create(arity)
inferredTypeByAssumption = BitVector.Create(arity)
End If
inferredTypeByAssumption(i) = True
End If
......@@ -1051,7 +1051,7 @@ HandleAsAGeneralExpression:
node As ArgumentNode,
isOutgoingEdge As Boolean
)
AddTypeToGraph(node.ParameterType, node, isOutgoingEdge, BitArray.Create(m_TypeParameterNodes.Length))
AddTypeToGraph(node.ParameterType, node, isOutgoingEdge, BitVector.Create(m_TypeParameterNodes.Length))
End Sub
Private Function FindTypeParameterNode(typeParameter As TypeParameterSymbol) As TypeParameterNode
......@@ -1070,7 +1070,7 @@ HandleAsAGeneralExpression:
parameterType As TypeSymbol,
argNode As ArgumentNode,
isOutgoingEdge As Boolean,
ByRef haveSeenTypeParameters As BitArray
ByRef haveSeenTypeParameters As BitVector
)
Select Case parameterType.Kind
Case SymbolKind.TypeParameter
......@@ -1124,7 +1124,7 @@ HandleAsAGeneralExpression:
Debug.Assert(argNode.Expression.Kind = BoundKind.AddressOfOperator)
If parameterType.IsTypeParameter() Then
AddTypeToGraph(parameterType, argNode, isOutgoingEdge:=True, haveSeenTypeParameters:=BitArray.Create(m_TypeParameterNodes.Length))
AddTypeToGraph(parameterType, argNode, isOutgoingEdge:=True, haveSeenTypeParameters:=BitVector.Create(m_TypeParameterNodes.Length))
ElseIf parameterType.IsDelegateType() Then
Dim delegateType As NamedTypeSymbol = DirectCast(parameterType, NamedTypeSymbol)
......@@ -1132,7 +1132,7 @@ HandleAsAGeneralExpression:
If invoke IsNot Nothing AndAlso invoke.GetUseSiteErrorInfo() Is Nothing AndAlso delegateType.IsGenericType Then
Dim haveSeenTypeParameters = BitArray.Create(m_TypeParameterNodes.Length)
Dim haveSeenTypeParameters = BitVector.Create(m_TypeParameterNodes.Length)
AddTypeToGraph(invoke.ReturnType, argNode, isOutgoingEdge:=True, haveSeenTypeParameters:=haveSeenTypeParameters) ' outgoing (name->type) edge
haveSeenTypeParameters.Clear()
......@@ -1158,7 +1158,7 @@ HandleAsAGeneralExpression:
)
If parameterType.IsTypeParameter() Then
' Lambda is bound to a generic typeParam, just infer anonymous delegate
AddTypeToGraph(parameterType, argNode, isOutgoingEdge:=True, haveSeenTypeParameters:=BitArray.Create(m_TypeParameterNodes.Length))
AddTypeToGraph(parameterType, argNode, isOutgoingEdge:=True, haveSeenTypeParameters:=BitVector.Create(m_TypeParameterNodes.Length))
ElseIf parameterType.IsDelegateType() Then
Dim delegateType As NamedTypeSymbol = DirectCast(parameterType, NamedTypeSymbol)
......@@ -1180,7 +1180,7 @@ HandleAsAGeneralExpression:
Throw ExceptionUtilities.UnexpectedValue(argNode.Expression.Kind)
End Select
Dim haveSeenTypeParameters = BitArray.Create(m_TypeParameterNodes.Length)
Dim haveSeenTypeParameters = BitVector.Create(m_TypeParameterNodes.Length)
For i As Integer = 0 To Math.Min(delegateParemeters.Length, lambdaParameters.Length) - 1 Step 1
If lambdaParameters(i).Type IsNot Nothing Then
......
......@@ -71,7 +71,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Dim someInferenceFailed As Boolean = False
Dim inferenceErrorReasons As InferenceErrorReasons = InferenceErrorReasons.Other
Dim fixTheseTypeParameters = BitArray.Create(possiblyExtensionMethod.Arity)
Dim fixTheseTypeParameters = BitVector.Create(possiblyExtensionMethod.Arity)
For Each typeParameter As TypeParameterSymbol In hashSetOfTypeParametersToFix
fixTheseTypeParameters(typeParameter.Ordinal) = True
......
......@@ -314,7 +314,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Dim currentParent As TypeSubstitution = Nothing
Dim currentContainer As Symbol = Nothing
#If DEBUG Then
Dim haveSubstitutionForOrdinal = BitArray.Create(params.Length)
Dim haveSubstitutionForOrdinal = BitVector.Create(params.Length)
#End If
Dim pairs = ArrayBuilder(Of KeyValuePair(Of TypeParameterSymbol, TypeSymbol)).GetInstance()
......@@ -630,7 +630,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Dim pairsHaveChanged As Boolean = False
Dim oldPairs = oldConstructSubstitution.Pairs
Dim haveSubstitutionForOrdinal As BitArray = Nothing
Dim haveSubstitutionForOrdinal As BitVector = Nothing
Dim targetGenericDefinition As Symbol = oldConstructSubstitution.TargetGenericDefinition
If oldPairs.Length > 0 Then
......@@ -642,7 +642,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
arity = DirectCast(targetGenericDefinition, NamedTypeSymbol).Arity
End If
haveSubstitutionForOrdinal = BitArray.Create(arity)
haveSubstitutionForOrdinal = BitVector.Create(arity)
End If
For i = 0 To oldPairs.Length - 1 Step 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册