Skip to content

Commit 1b8a1e5

Browse files
stevehansenclaude
andcommitted
fix: Replace net472-incompatible GetValueOrDefault and KeyValuePair deconstruct
GetValueOrDefault on Dictionary and KeyValuePair.Deconstruct are not available in net472/netstandard2.0. Replace with TryGetValue and explicit .Key/.Value access. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 812bde3 commit 1b8a1e5

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/SqlInliner/DerivedTableFlattener.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,10 @@ void CollectFromTableRef(TableReference tableRef)
766766
name = colRef.MultiPartIdentifier?.Identifiers.LastOrDefault()?.Value;
767767

768768
if (name != null)
769-
columnCounts[name] = columnCounts.GetValueOrDefault(name) + 1;
769+
{
770+
columnCounts.TryGetValue(name, out var existing);
771+
columnCounts[name] = existing + 1;
772+
}
770773
}
771774
break;
772775
case QualifiedJoin join:
@@ -784,10 +787,10 @@ void CollectFromTableRef(TableReference tableRef)
784787
CollectFromTableRef(tableRef);
785788

786789
var shared = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
787-
foreach (var (name, count) in columnCounts)
790+
foreach (var kvp in columnCounts)
788791
{
789-
if (count > 1)
790-
shared.Add(name);
792+
if (kvp.Value > 1)
793+
shared.Add(kvp.Key);
791794
}
792795

793796
return shared;

0 commit comments

Comments
 (0)