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

Unify representation of an implicit Index indexer over an array and non-array types. #57918

Merged
merged 1 commit into from
Nov 23, 2021

Conversation

AlekseyTs
Copy link
Contributor

No description provided.

@AlekseyTs
Copy link
Contributor Author

@jcouv, @dotnet/roslyn-compiler Please review.

case BoundArrayAccess arrayAccess:
return arrayAccess.Expression.Type;

case BoundImplicitIndexerAccess { IndexerOrSliceAccess: BoundArrayAccess arrayAccess }:
Copy link
Member

@jcouv jcouv Nov 22, 2021

Choose a reason for hiding this comment

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

nit: Consider commenting: this case is array[int] and the one above is array[Index/Range] #Pending

if (makeOffsetInput.ConstantValue is null)
BoundExpression lengthAccess = RewriteLengthAccess(node, receiver);

// ensure we evaluate the input before accessing length, unless it is an array length
Copy link
Member

@jcouv jcouv Nov 22, 2021

Choose a reason for hiding this comment

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

why is array length different in terms of ordering? #Resolved

Copy link
Contributor Author

@AlekseyTs AlekseyTs Nov 22, 2021

Choose a reason for hiding this comment

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

why is array length different in terms of ordering?

Because it is an IL instruction, not a property access. I.e. not observable. There is no change in behavior here, we are doing what we used to do.

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 self-assigned this Nov 22, 2021
@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler For the second review.

1 similar comment
@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler For the second review.

@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler For the second review.

@chsienki chsienki self-assigned this Nov 23, 2021
@AlekseyTs AlekseyTs merged commit 7fea0aa into dotnet:features/list-patterns Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants