Skip to content

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

Merged
AlekseyTs merged 1 commit intodotnet:features/list-patternsfrom
AlekseyTs:ImplicitIndex_05
Nov 23, 2021
Merged

Unify representation of an implicit Index indexer over an array and non-array types.#57918
AlekseyTs merged 1 commit intodotnet:features/list-patternsfrom
AlekseyTs:ImplicitIndex_05

Conversation

@AlekseyTs
Copy link
Copy Markdown
Contributor

No description provided.

@AlekseyTs
Copy link
Copy Markdown
Contributor Author

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

case BoundArrayAccess arrayAccess:
return arrayAccess.Expression.Type;

case BoundImplicitIndexerAccess { IndexerOrSliceAccess: BoundArrayAccess arrayAccess }:
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

@dotnet/roslyn-compiler For the second review.

1 similar comment
@AlekseyTs
Copy link
Copy Markdown
Contributor Author

@dotnet/roslyn-compiler For the second review.

@AlekseyTs
Copy link
Copy Markdown
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