Skip to content

[typeless extension receivers] Pin tests excluding throw expressions#83406

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

[typeless extension receivers] Pin tests excluding throw expressions#83406
CyrusNajmabadi wants to merge 302 commits intodotnet:features/extension-members-on-typeless-receiversfrom
CyrusNajmabadi:extension-members-on-typeless-receivers/ThrowExpression/Tests

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi commented Apr 25, 2026

Championed issue: TBD
Speclet: TBD
Test plan: TBD

Summary

  • Throw expressions are explicitly excluded from the proposal: a throw expression can never produce a value the extension would receive, so (throw ...).M() is always unreachable.
  • Two pin tests confirm that (throw ...).M() continues to report ERR_ThrowMisplaced for both classic and modern extension method shapes.
  • No support PR; throw is intentionally not in the inclusion list.

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
  20. [typeless extension receivers] Pin tests excluding throw expressions #83406 (this PR)
  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 7 commits April 26, 2026 01:14
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
Consolidates two shape PRs (dotnet#83395, dotnet#83396) into a single tests PR for the
ThrowExpression area. Throw expressions are explicitly excluded from the
proposal; both tests pin that '(throw ...).M()' continues to report
ERR_ThrowMisplaced. Per the agent's plan, throw is negative-only and only
gets the two method shapes (no property/indexer applicability).

Co-authored-by: Isaac
@dotnet-policy-service dotnet-policy-service Bot added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Apr 25, 2026
@CyrusNajmabadi CyrusNajmabadi changed the title Extension members on typeless receivers - ThrowExpression area tests (consolidated) Add pin tests confirming throw expressions are excluded as typeless extension receivers Apr 25, 2026
…sOnTypelessReceiver

Match the established convention in this file: call CheckFeatureAvailability
for diagnostics but continue binding regardless of return value, so the
SemanticModel and downstream features see the call as bound on every
language version.

Co-authored-by: Isaac
Cyrus Najmabadi added 22 commits April 26, 2026 14:46
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
…/Tests' into extension-members-on-typeless-receivers/ThrowExpression/Tests
@CyrusNajmabadi CyrusNajmabadi changed the title Add pin tests confirming throw expressions are excluded as typeless extension receivers [typeless extension receivers] Pin tests excluding throw expressions 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