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

Extensions: update proposal based on latest decision #9182

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 7 additions & 28 deletions meetings/working-groups/extensions/extensions-lookup.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,39 +153,20 @@ Options for methods:
1. maximum compatibility with classic extension methods
2. maximum alignment with instance methods

## Regular overload resolution

Gather candidates

Member type inference
Member applicability
Remove less specific applicable candidates
Remove static-instance mismatches
RemoveConstraintViolations
RemoveDelegateConversionsWithWrongReturnType
Remove less priority members (ORPA)
RemoveCallingConventionMismatches (for function pointer resolution)
RemoveMethodsNotDeclaredStatic (for function pointer resolution)
Remove worse members (better function member)

Note: as a result we don't prefer more specific classic extension methods

## Extension methods proposal

Gather candidates
- receiver type inference
- receiver applicability
Gather candidates (no applicability involved)
- if method group, then proceed to overload resolution below

Member type inference
Member applicability
Remove less specific applicable candidates (we can choose what to do about new extension methods)
Member type inference (including the type parameters on the extension declaration)
Member applicability (including the extension parameter)
Remove less specific applicable candidates (doesn't apply)
Remove static-instance mismatches (apply to new extension methods)
RemoveConstraintViolations (TBD)
Remove lower priority members (ORPA, apply to new extension methods)
RemoveCallingConventionMismatches (for function pointer resolution, TBD)
RemoveMethodsNotDeclaredStatic (for function pointer resolution, TBD)
Remove worse members (better function member) (I'm assuming we include the receiver parameter)
Remove worse members (better function member) (including the receiver parameter)

# Lookup for properties

Expand Down Expand Up @@ -346,10 +327,8 @@ public static class E2

## Extension properties proposal

Gather candidates
- receiver type inference
- receiver applicability
- if property, then prune candidates with the following rules:
Gather candidates (no applicability involved)
- if property candidates found, then prune candidates with the following rules:
Remove less specific applicable candidates (LDM expressed desire)
Remove static-instance mismatches (seems desirable, open issue above)
RemoveCallingConventionMismatches (for function pointer resolution, TBD)
Expand Down