Skip to content

Commit 328d9f1

Browse files
committed
When hashing the entire string, case sensitivity of hash and equals should be the same
1 parent a94513c commit 328d9f1

File tree

5 files changed

+4
-64
lines changed

5 files changed

+4
-64
lines changed

src/libraries/System.Collections.Immutable/src/System.Collections.Immutable.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,10 @@ The System.Collections.Immutable library is built-in as part of the shared frame
6666
<Compile Include="System\Collections\Frozen\String\OrdinalStringFrozenSet_RightJustifiedCaseInsensitiveSubstring.cs" />
6767
<Compile Include="System\Collections\Frozen\String\OrdinalStringFrozenSet_RightJustifiedSubstring.cs" />
6868
<Compile Include="System\Collections\Frozen\String\OrdinalStringFrozenSet_RightJustifiedSingleChar.cs" />
69-
70-
<Compile Include="System\Collections\Frozen\String\OrdinalStringFrozenDictionary_FullCaseSensitiveHashCaseInsensitiveEquals.cs" />
7169
<Compile Include="System\Collections\Frozen\String\OrdinalStringFrozenDictionary_LeftJustifiedSingleCharCaseInsensitive.cs" />
7270
<Compile Include="System\Collections\Frozen\String\OrdinalStringFrozenDictionary_LeftJustifiedSubstringCaseInsensitive.cs" />
7371
<Compile Include="System\Collections\Frozen\String\OrdinalStringFrozenDictionary_RightJustifiedSingleCharCaseInsensitive.cs" />
7472
<Compile Include="System\Collections\Frozen\String\OrdinalStringFrozenDictionary_RightJustifiedSubstringCaseInsensitive.cs" />
75-
<Compile Include="System\Collections\Frozen\String\OrdinalStringFrozenSet_FullCaseSensitiveHashCaseInsensitiveEquals.cs" />
7673
<Compile Include="System\Collections\Frozen\String\OrdinalStringFrozenSet_LeftJustifiedSingleCharCaseInsensitive.cs" />
7774
<Compile Include="System\Collections\Frozen\String\OrdinalStringFrozenSet_LeftJustifiedSubstringCaseInsensitive.cs" />
7875
<Compile Include="System\Collections\Frozen\String\OrdinalStringFrozenSet_RightJustifiedSingleCharCaseInsensitive.cs" />

src/libraries/System.Collections.Immutable/src/System/Collections/Frozen/FrozenDictionary.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,8 @@ private static FrozenDictionary<TKey, TValue> CreateFromDictionary<TKey, TValue>
238238
}
239239
else
240240
{
241-
frozenDictionary = analysis.IgnoreCaseForEquals
242-
? new OrdinalStringFrozenDictionary_FullCaseSensitiveHashCaseInsensitiveEquals<TValue>(keys, values, stringComparer, analysis.MinimumLength, analysis.MaximumLengthDiff)
243-
: new OrdinalStringFrozenDictionary_Full<TValue>(keys, values, stringComparer, analysis.MinimumLength, analysis.MaximumLengthDiff);
241+
// if (IgnoreCaseForEquals) => Can only be true if there are no letters, thus case sensitive comparison still works here.
242+
frozenDictionary = new OrdinalStringFrozenDictionary_Full<TValue>(keys, values, stringComparer, analysis.MinimumLength, analysis.MaximumLengthDiff);
244243
}
245244
}
246245

src/libraries/System.Collections.Immutable/src/System/Collections/Frozen/FrozenSet.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,8 @@ private static FrozenSet<T> CreateFromSet<T>(HashSet<T> source)
186186
}
187187
else
188188
{
189-
frozenSet = analysis.IgnoreCaseForEquals
190-
? new OrdinalStringFrozenSet_FullCaseSensitiveHashCaseInsensitiveEquals(entries, stringComparer, analysis.MinimumLength, analysis.MaximumLengthDiff)
191-
: new OrdinalStringFrozenSet_Full(entries, stringComparer, analysis.MinimumLength, analysis.MaximumLengthDiff);
189+
// if (IgnoreCaseForEquals) => Can only be true if there are no letters, thus case sensitive comparison still works here.
190+
frozenSet = new OrdinalStringFrozenSet_Full(entries, stringComparer, analysis.MinimumLength, analysis.MaximumLengthDiff);
192191
}
193192
}
194193

src/libraries/System.Collections.Immutable/src/System/Collections/Frozen/String/OrdinalStringFrozenDictionary_FullCaseSensitiveHashCaseInsensitiveEquals.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/libraries/System.Collections.Immutable/src/System/Collections/Frozen/String/OrdinalStringFrozenSet_FullCaseSensitiveHashCaseInsensitiveEquals.cs

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)