Extension indexers: implicit indexers in list-patterns#82757
Extension indexers: implicit indexers in list-patterns#82757jcouv wants to merge 3 commits intodotnet:features/extensionsfrom
Conversation
86cee88 to
a58f80d
Compare
| AnalyzedArguments? actualExtensionLengthOrCountArguments = null; | ||
| foreach (var scope in new ExtensionScopes(this)) | ||
| { | ||
| foundApplicable = TryBindExtensionLengthOrCountInScope(node, receiverPlaceholder, scope.Binder, scope, |
There was a problem hiding this comment.
Should we use this instead of scope.Binder here? #Pending
| BindingDiagnosticBag diagnostics) | ||
| { | ||
| Debug.Assert(receiverPlaceholder.Type is not null); | ||
| if (receiverPlaceholder.Type.IsSZArray()) |
There was a problem hiding this comment.
Yes. There are three callers for TryBindNonExtensionLengthOrCount: 1. element access, 2. list-patterns, 3. spreads in collection expressions.
For indexer access, we cannot reach this because array access is treated separately (routed to BindArrayAccess).
But other scenarios can.
I'll add a targeted test (MissingMember_ArrayLength)
| if (receiverPlaceholder.Type.IsSZArray()) | ||
| { | ||
| bool foundApplicable = TryGetSpecialTypeMember(Compilation, SpecialMember.System_Array__Length, syntax, diagnostics, out PropertySymbol lengthProperty); | ||
| if (lengthProperty is not null) |
| { | ||
| var reinferenceResult = ReInferMethodAndVisitArguments( | ||
| e, | ||
| receiverOpt: new BoundExpressionWithNullability(e.Syntax, expression, NullableAnnotation.NotAnnotated, inputType), |
There was a problem hiding this comment.
new BoundExpressionWithNullability(e.Syntax, expression, NullableAnnotation.NotAnnotated, inputType)
I know that we do this in many places, but I am curious why do we create BoundExpressionWithNullability? Are we going to visit this node during ReInferMethodAndVisitArguments? Or is there something else special about this node?
Test plan #81505
Microsoft Reviewers: Open in CodeFlow