Skip to content
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

If Length and Count are both present, only the former is assumed to be non-negative #57268

Merged
merged 1 commit into from
Oct 22, 2021

Conversation

alrz
Copy link
Contributor

@alrz alrz commented Oct 20, 2021

Closes dotnet/csharplang#5137
Relates to test plan #51289

@alrz alrz requested a review from a team as a code owner October 20, 2021 18:39
@ghost ghost added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Oct 20, 2021
@@ -1458,7 +1458,8 @@ void addSubpatternsForTuple(ImmutableArray<TypeWithAnnotations> elementTypes)
{
isLengthOrCount = receiverType.IsSZArray()
? ReferenceEquals(memberSymbol, Compilation.GetSpecialTypeMember(SpecialMember.System_Array__Length))
: TryPerformPatternIndexerLookup(node, receiverType, argIsIndex: true, indexerAccess: out _, patternSymbol: out _, lengthProperty: out _, BindingDiagnosticBag.Discarded);
: TryPerformPatternIndexerLookup(node, receiverType, argIsIndex: true, indexerAccess: out _, patternSymbol: out _, out PropertySymbol? lengthProperty, BindingDiagnosticBag.Discarded) &&
memberSymbol.Equals(lengthProperty, TypeCompareKind.ConsiderEverything); // If Length and Count are both present, only the former is assumed to be non-negative.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Linking to #53891 (comment) if more investigation is needed.

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks (iteration 1)

@jcouv jcouv merged commit 3fc766e into dotnet:features/list-patterns Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Community The pull request was submitted by a contributor who is not a Microsoft employee. New Feature - List Patterns
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants