-
-
Notifications
You must be signed in to change notification settings - Fork 94
fix(assertions): fix compiler nullability analysis for IsNotNull assertions for nullable reference and value types #3442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
# Conflicts: # TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet10_0.verified.txt # TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet8_0.verified.txt # TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.DotNet9_0.verified.txt # TUnit.PublicAPI/Tests.Assertions_Library_Has_No_API_Changes.Net4_7.verified.txt
|
Claude finished @thomhurst's task —— View job Code Review: IsNotNull Nullability Analysis FixReviewing PR #3442 that fixes nullability analysis for IsNotNull assertions SummaryThis PR fixes compiler nullability analysis for ✅ Positive Aspects1. Excellent Nullability Implementation
2. Robust Test Coverage
3. Clean Code Organization
4. API Consistency
|
|
Claude finished @thomhurst's task —— View job Code Review: IsNotNull Nullability Analysis Fix ✅Reviewed PR #3442 that fixes nullability analysis for IsNotNull assertions Todo List:
🔍 Review SummaryThis PR successfully implements proper compiler nullability analysis for ✅ Strengths1. Excellent Nullability Flow AnalysisThe implementation correctly handles both scenarios:
The context mapping is properly implemented: // Reference types: TValue? → TValue
var mappedContext = source.Context.Map((TValue? v) => v!);
// Value types: TValue? → TValue
var mappedContext = source.Context.Map<TValue>((TValue? v) => v!.Value);2. Strong Test Coverage
3. Proper API Evolution
4. Follows Repository Guidelines
📝 Minor Observations1. IntAssertions.cs AdditionThe public static bool IsEven(this int value) => value % 2 == 0;
public static bool IsOdd(this int value) => value % 2 != 0;This might be test code that accidentally got included, though it doesn't impact the main fix. 2. Test File CleanupRemoving 🚀 Technical Implementation QualityContext Mapping ApproachThe use of Overload ResolutionUsing distinct generic constraints ( GetAwaiter PatternThe 🔒 Security & Performance
🎯 VerdictThis is a high-quality implementation that:
Recommendation: Approve - This PR successfully fixes issue #3440 and provides developers with proper nullability flow analysis when using |
Fixes #3440