From 3307699ee72c81e2342a6fd2e41c2ac2dc759461 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Tue, 3 Oct 2023 17:11:51 -0400 Subject: [PATCH] refactor: Remove nullability constraint in GetValueOrDefault --- .../spark_core/Collections/Extensions/DictionaryExtensions.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/spark_core/Collections/Extensions/DictionaryExtensions.cs b/src/client/spark_core/Collections/Extensions/DictionaryExtensions.cs index 7598bdc20..67fdb2903 100644 --- a/src/client/spark_core/Collections/Extensions/DictionaryExtensions.cs +++ b/src/client/spark_core/Collections/Extensions/DictionaryExtensions.cs @@ -1,6 +1,7 @@ using bts.collections; using System.Collections.ObjectModel; +using System.Diagnostics.CodeAnalysis; using System.Linq; namespace System.Collections.Generic { @@ -122,7 +123,8 @@ namespace System.Collections.Generic { } #nullable enable - public static TValue? GetValueOrDefault(this Dictionary? dictionary, TKey key) where TKey : notnull { + [return: MaybeNull] + public static TValue GetValueOrDefault(this Dictionary? dictionary, TKey key) where TKey : notnull { if (dictionary is null) { throw new ArgumentNullException(nameof(dictionary)); }