Skip to content

[typeless extension receivers] Tests for tuple-literal receivers#83405

Draft
CyrusNajmabadi wants to merge 290 commits intodotnet:features/extension-members-on-typeless-receiversfrom
CyrusNajmabadi:extension-members-on-typeless-receivers/TupleExpression/Tests
Draft

[typeless extension receivers] Tests for tuple-literal receivers#83405
CyrusNajmabadi wants to merge 290 commits intodotnet:features/extension-members-on-typeless-receiversfrom
CyrusNajmabadi:extension-members-on-typeless-receivers/TupleExpression/Tests

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi commented Apr 25, 2026

Championed issue: TBD
Speclet: TBD
Test plan: TBD

Summary

  • Four test files covering the four shape combinations on a tuple-literal receiver.
  • Tests fully-typed tuples and tuples with typeless elements.

Stacked:

  1. [typeless extension receivers] Initial binder support #83348
  2. [typeless extension receivers] Modern (C#14) extension support #83352
  3. [typeless extension receivers] Tests for collection-expression receivers #83397
  4. [typeless extension receivers] Allow lambda receivers #83355
  5. [typeless extension receivers] Tests for lambda receivers #83398
  6. [typeless extension receivers] Allow method-group receivers #83360
  7. [typeless extension receivers] Tests for method-group receivers #83399
  8. [typeless extension receivers] Allow target-typed new() receivers #83365
  9. [typeless extension receivers] Tests for new() / new(args) receivers #83400
  10. [typeless extension receivers] Allow null-literal receivers #83370
  11. [typeless extension receivers] Tests for null-literal receivers #83401
  12. [typeless extension receivers] Allow default-literal receivers #83375
  13. [typeless extension receivers] Tests for default-literal receivers #83402
  14. [typeless extension receivers] Allow conditional-expression receivers #83380
  15. [typeless extension receivers] Tests for conditional-expression receivers #83403
  16. [typeless extension receivers] Allow switch-expression receivers #83385
  17. [typeless extension receivers] Tests for switch-expression receivers #83404
  18. [typeless extension receivers] Allow tuple-literal receivers #83390
  19. [typeless extension receivers] Tests for tuple-literal receivers #83405 (this PR)
  20. [typeless extension receivers] Pin tests excluding throw expressions #83406
  21. [typeless extension receivers] Fix Debug.Assert in dynamic-arg extension diagnostic #83414
  22. [typeless extension receivers] Allow extension indexers #83415
  23. [typeless extension receivers] Tests for extension indexers #83416

Cyrus Najmabadi added 18 commits April 26, 2026 00:44
Two tests: extension(int?) OrZero on (b?null:int) with execution, no-candidate negative.

Co-authored-by: Isaac
Two tests covering modern extension properties on conditional expressions.

Co-authored-by: Isaac
Closes the ConditionalExpression area (4 of 4 shape PRs).

Co-authored-by: Isaac
…receiver

Adds BoundKind.UnconvertedSwitchExpression to the inclusion list so that
switch expressions with no common arm type route through the typeless-
extension-receiver path.

All eight .NET Core CSharp test projects pass with zero failures.

Co-authored-by: Isaac
Two tests covering classic extension methods on switch expressions with no
common arm type. One executes, one negative.

Co-authored-by: Isaac
Two tests covering modern extension methods on switch expressions.

Co-authored-by: Isaac
Two tests covering modern extension properties on switch expressions.

Co-authored-by: Isaac
Closes the SwitchExpression area (4 of 4 shape PRs).

Co-authored-by: Isaac
Adds BoundKind.TupleLiteral to the inclusion list so tuple literals (with
or without typeless elements) route through the typeless-extension-receiver
path.

All eight .NET Core CSharp test projects pass with zero failures.

Co-authored-by: Isaac
Consolidates the four shape PRs for the CollectionExpression area into a
single Tests PR. The area covers extension members invoked on a typeless
collection-expression receiver. All four shape combinations:

  - ClassicExtensionMethod: 18 tests (target type variety, edge cases,
    generic inference, overload resolution, chained, argument forwarding).
  - ModernExtensionMethod: 2 execution tests.
  - ModernExtensionProperty: 8 tests (instance properties on various
    target types, chained access, spread elements).
  - ModernExtensionIndexer: 2 pin tests (instance indexers in extension(T)
    blocks are not allowed; element access via [] on a typeless receiver
    is out of scope per the proposal).

Note: Classic and ModernMethod test files originate earlier in this PR's
stack lineage. The Property and Indexer files are added in this commit.
The cumulative diff vs main shows all four area test files.

Co-authored-by: Isaac
Consolidates four shape PRs (formerly dotnet#83356, dotnet#83357, dotnet#83358, dotnet#83359) into
a single tests PR for the Lambda area. Covers extension members invoked on
a lambda receiver:

  - ClassicExtensionMethod: 9 tests including the Memoize headline.
  - ModernExtensionMethod: 4 tests on Func<int,int> / Action / Func<T,T>.
  - ModernExtensionProperty: 3 tests.
  - ModernExtensionIndexer: 2 pin tests.

Co-authored-by: Isaac
Consolidates four shape PRs (formerly dotnet#83361, dotnet#83362, dotnet#83363, dotnet#83364)
into a single tests PR for the MethodGroup area. Covers extension members
invoked on a method-group receiver - the proposal's Memoize headline:

  - ClassicExtensionMethod: 6 tests (static / instance / generic /
    Memoize / overloaded-with-no-natural-type / negative).
  - ModernExtensionMethod: 3 tests.
  - ModernExtensionProperty: 2 tests.
  - ModernExtensionIndexer: 2 pin tests.

Co-authored-by: Isaac
Consolidates four shape PRs (dotnet#83366, dotnet#83367, dotnet#83368, dotnet#83369) into a single
tests PR for the NewExpression area (target-typed new() / new(args)
receivers).

  - ClassicExtensionMethod: 4 tests.
  - ModernExtensionMethod: 3 tests.
  - ModernExtensionProperty: 3 tests.
  - ModernExtensionIndexer: 2 pin tests.

Co-authored-by: Isaac
Consolidates four shape PRs (dotnet#83371, dotnet#83372, dotnet#83373, dotnet#83374) into a single
tests PR for the NullLiteral area.

  - ClassicExtensionMethod: 5 tests.
  - ModernExtensionMethod: 3 tests.
  - ModernExtensionProperty: 2 tests.
  - ModernExtensionIndexer: 2 pin tests.

Co-authored-by: Isaac
Consolidates four shape PRs (dotnet#83376, dotnet#83377, dotnet#83378, dotnet#83379).

Co-authored-by: Isaac
Consolidates four shape PRs (dotnet#83391, dotnet#83392, dotnet#83393, dotnet#83394).

Co-authored-by: Isaac
Cyrus Najmabadi added 23 commits April 26, 2026 14:28
…n/Tests' into extension-members-on-typeless-receivers/TupleExpression/Support
…/Support' into extension-members-on-typeless-receivers/TupleExpression/Tests
When the speculative-binding redesign (in /product) made the typeless-
receiver helper only engage when an extension candidate is in scope,
these tests' "no extension found" assertions started reporting the
legacy ERR_BadUnaryOp from the UnboundLambda rejection in
BindMemberAccessWithBoundLeft instead of the new ERR_NoSuchMember.

Updated three tests across Classic / ModernMethod / ModernProperty.

Co-authored-by: Isaac
…nto extension-members-on-typeless-receivers/MethodGroup/Support
…port' into extension-members-on-typeless-receivers/MethodGroup/Tests
…llback

Three method-group "no extension found" tests now expect the legacy
ERR_BadSKunknown ('method is not valid in the given context') instead of
ERR_NoSuchMember, since the speculative-binding redesign falls back to
the legacy path when no extension candidate is in scope.

Co-authored-by: Isaac
…ts' into extension-members-on-typeless-receivers/NewExpression/Support
…upport' into extension-members-on-typeless-receivers/NewExpression/Tests
…fallback

Three new()-receiver "no extension found" tests now expect the legacy
ERR_ImplicitObjectCreationNoTargetType instead of ERR_NoSuchMember.

Co-authored-by: Isaac
…ests' into extension-members-on-typeless-receivers/NullLiteral/Support
…port' into extension-members-on-typeless-receivers/NullLiteral/Tests
…llback

Three null-receiver "no extension found" tests now expect the legacy
ERR_BadUnaryOp on '<null>' instead of ERR_NoSuchMember.

Co-authored-by: Isaac
…ts' into extension-members-on-typeless-receivers/DefaultLiteral/Support
…Support' into extension-members-on-typeless-receivers/DefaultLiteral/Tests
… fallback

Three default-receiver "no extension found" tests now expect the legacy
ERR_DefaultLiteralNoTargetType instead of ERR_NoSuchMember.

Co-authored-by: Isaac
…Tests' into extension-members-on-typeless-receivers/ConditionalExpression/Support
…ession/Support' into extension-members-on-typeless-receivers/ConditionalExpression/Tests
…binding fallback

Three conditional-receiver "no extension found" tests now expect the
legacy ERR_InvalidQM (no common conditional type) instead of
ERR_NoSuchMember.

Co-authored-by: Isaac
…ession/Tests' into extension-members-on-typeless-receivers/SwitchExpression/Support
…n/Support' into extension-members-on-typeless-receivers/SwitchExpression/Tests
…ng fallback

Three switch-receiver "no extension found" tests now expect the legacy
ERR_SwitchExpressionNoBestType instead of ERR_NoSuchMember.

Co-authored-by: Isaac
…n/Tests' into extension-members-on-typeless-receivers/TupleExpression/Support
…/Support' into extension-members-on-typeless-receivers/TupleExpression/Tests
@CyrusNajmabadi CyrusNajmabadi changed the title Add tests for extension members on typeless tuple-literal receivers [typeless extension receivers] Tests for tuple-literal receivers Apr 26, 2026
@CyrusNajmabadi CyrusNajmabadi changed the base branch from main to features/extension-members-on-typeless-receivers April 27, 2026 16:43
@jcouv
Copy link
Copy Markdown
Member

jcouv commented Apr 27, 2026

Test plan: #83428
(created by new-compiler-feature skill)

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. Feature - Extension members on typeless receivers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants