-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[Group 1] Enable nullable annotations for Microsoft.Extensions.FileSystemGlobbing
#57398
[Group 1] Enable nullable annotations for Microsoft.Extensions.FileSystemGlobbing
#57398
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Tagging subscribers to this area: @maryamariyan, @dotnet/area-extensions-filesystem Issue DetailsRelated to #43605 Questions:
|
Microsoft.Extensions.FileSystemGlobbing
src/libraries/Microsoft.Extensions.FileSystemGlobbing/src/FilePatternMatch.cs
Show resolved
Hide resolved
...aries/Microsoft.Extensions.FileSystemGlobbing/ref/Microsoft.Extensions.FileSystemGlobbing.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.FileSystemGlobbing/src/InMemoryDirectoryInfo.cs
Outdated
Show resolved
Hide resolved
...aries/Microsoft.Extensions.FileSystemGlobbing/ref/Microsoft.Extensions.FileSystemGlobbing.cs
Show resolved
Hide resolved
...aries/Microsoft.Extensions.FileSystemGlobbing/ref/Microsoft.Extensions.FileSystemGlobbing.cs
Show resolved
Hide resolved
@@ -176,7 +176,7 @@ public IPattern Build(string pattern) | |||
{ | |||
if (segment is RecursiveWildcardSegment) | |||
{ | |||
if (segmentsPatternStartsWith == null) | |||
if (segmentsPatternStartsWith == null || segmentsPatternEndsWith == null || segmentsPatternContains == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should be changing behavior here.
@@ -199,7 +199,7 @@ public IPattern Build(string pattern) | |||
scanPattern = endSegment + 1; | |||
} | |||
|
|||
if (segmentsPatternStartsWith == null) | |||
if (segmentsPatternStartsWith == null || segmentsPatternEndsWith == null || segmentsPatternContains == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should be changing behavior here. We will probably need to annotate RaggedPattern
to allow for null segmentsPatternEndsWith
and segmentsPatternContains
, if they can't be proven to not be null here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are initialized together, so only one of them is checked (if one is null - all of them are and vise versa). Compiler just doesn't know that.
I've added those checks just to let compiler know that other two lists are also not null.
Replaced additional checks with !
...aries/Microsoft.Extensions.FileSystemGlobbing/ref/Microsoft.Extensions.FileSystemGlobbing.cs
Outdated
Show resolved
Hide resolved
...aries/Microsoft.Extensions.FileSystemGlobbing/ref/Microsoft.Extensions.FileSystemGlobbing.cs
Show resolved
Hide resolved
...aries/Microsoft.Extensions.FileSystemGlobbing/ref/Microsoft.Extensions.FileSystemGlobbing.cs
Show resolved
Hide resolved
! need to be addressed
...aries/Microsoft.Extensions.FileSystemGlobbing/ref/Microsoft.Extensions.FileSystemGlobbing.cs
Show resolved
Hide resolved
...aries/Microsoft.Extensions.FileSystemGlobbing/ref/Microsoft.Extensions.FileSystemGlobbing.cs
Show resolved
Hide resolved
...aries/Microsoft.Extensions.FileSystemGlobbing/ref/Microsoft.Extensions.FileSystemGlobbing.cs
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.FileSystemGlobbing/src/Abstractions/FileInfoWrapper.cs
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.FileSystemGlobbing/src/InMemoryDirectoryInfo.cs
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.FileSystemGlobbing/src/InMemoryDirectoryInfo.cs
Outdated
Show resolved
Hide resolved
...Microsoft.Extensions.FileSystemGlobbing/src/Internal/PatternContexts/PatternContextRagged.cs
Outdated
Show resolved
Hide resolved
# Conflicts: # src/libraries/Microsoft.Extensions.FileSystemGlobbing/ref/Microsoft.Extensions.FileSystemGlobbing.csproj # src/libraries/Microsoft.Extensions.FileSystemGlobbing/src/Microsoft.Extensions.FileSystemGlobbing.csproj
src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/FilePatternMatchTests.cs
Outdated
Show resolved
Hide resolved
...s/Microsoft.Extensions.FileSystemGlobbing/src/Microsoft.Extensions.FileSystemGlobbing.csproj
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with 2 comments
@krwq @maxkoshevoi - is this PR ready to be merged? Or are there more changes needed? |
All good from my side |
@maxkoshevoi sorry for late re-review. The comment about hash is still valid, I've responded |
src/libraries/Microsoft.Extensions.FileSystemGlobbing/src/Internal/InMemoryFileInfo.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just had one last comment. After that is addressed I think we can merge this.
@eerhardt resolved the comment |
Test failure is unrelated. #60088 |
Related to #43605
Questions:
DirectoryInfoBase
differ in nullability forGetDirectory
andGetFile
. So marked both of them as nullable in interface. Issue is that interface documentation says that they shouldn't be null.Issue to fix nullability issues: #58211