Skip to content
Permalink
Browse files

Fix more nullability warnings that only show up on the command line f…

…or some reason
  • Loading branch information...
jskeet committed May 25, 2019
1 parent 24c42a7 commit 051de51c15624e5360c7bd30f4477aceec167001
@@ -66,7 +66,7 @@ internal static class Cultures
}
});

private static string[] LowerCaseFrench(Func<DateTimeFormatInfo, string[]> propertySelector) =>
private static string?[] LowerCaseFrench(Func<DateTimeFormatInfo, string[]> propertySelector) =>
propertySelector(new CultureInfo("fr-FR").DateTimeFormat).Select(x => x?.ToLowerInvariant()).ToArray();

internal static readonly CultureInfo DotTimeSeparator = CultureInfo.ReadOnly(new CultureInfo("fi-FI") {
@@ -84,7 +84,8 @@ internal sealed class NodaFormatInfo
/// <param name="cultureInfo">The culture info to use.</param>
[VisibleForTesting]
internal NodaFormatInfo(CultureInfo cultureInfo)
: this(cultureInfo, cultureInfo?.DateTimeFormat)
// If cultureInfo is null, this will throw before we get to the DateTimeFormatInfo being null.
: this(cultureInfo, cultureInfo?.DateTimeFormat!)
{
}

@@ -399,14 +399,17 @@ public static BclDateTimeZone ForSystemDefault()
}
BclDateTimeZone currentSystemDefault = systemDefault;

// Cached copy is out of date - wrap a new one
// Cached copy is out of date - wrap a new one.
// If currentSystemDefault is null, we always enter this block (as local isn't null).
if (currentSystemDefault?.OriginalZone != local)
{
currentSystemDefault = FromTimeZoneInfo(local);
systemDefault = currentSystemDefault;
}
// Always return our local variable; the variable may have changed again.
return currentSystemDefault;
// Always return our local variable; the field may have changed again.
// The ! is because the compiler doesn't recognize the logic around
// "always fetch if we currentSystemDefault is null".
return currentSystemDefault!;
}
}
}

0 comments on commit 051de51

Please sign in to comment.
You can’t perform that action at this time.