Skip to content

Commit 7168eac

Browse files
committed
Change "better conversion target" to not require an expression
This effectively moves the method group aspect up from 11.6.4.6 to 11.6.4.4. Notes: I've added "for conversion C1" to the "single best method from the method group" part as the single best method may be different for C1 and C2 - there's no single best method from a method group without a specific method group conversion being considered The rule doesn't refer to T2/C2, but I don't think it has to... because it's valid for both conversions to be better than the other. That's already the case in better conversion target, as types T1 and T2 could both have implicit conversions to each other. I think this means we could also remove "and E does not exactly match T2" in the first rule of 11.6.4.4, but I haven't gone that far in this PR. Fixes #549 Fixes #550
1 parent cabbf59 commit 7168eac

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

standard/expressions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,10 +1000,11 @@ In case the parameter type sequences `{P₁, P₂, ..., Pᵥ}` and `{Q₁, Q₂
10001000
10011001
#### 11.6.4.4 Better conversion from expression
10021002
1003-
Given an implicit conversion `C₁` that converts from an expression `E` to a type `T₁`, and an implicit conversion `C₂` that converts from an expression `E` to a type `T₂`, `C₁` is a better conversion than `C₂` if one of the following holds:
1003+
Given an implicit conversion `C₁` that converts from an expression `E` to a type `T₁`, and an implicit conversion `C₂` that converts from an expression `E` to a type `T₂`, `C₁` is a ***better conversion*** than `C₂` if one of the following holds:
10041004
10051005
- `E` exactly matches `T₁` and `E` does not exactly match `T₂` ([§11.6.4.5](expressions.md#11645-exactly-matching-expression))
10061006
- `E` exactly matches both or neither of `T₁` and `T₂`, and `T₁` is a better conversion target than `T₂` ([§11.6.4.6](expressions.md#11646-better-conversion-target))
1007+
- `E` is a method group ([§11.2](expressions.md#112-expression-classifications)), and `T₁` is compatible ([§19.4](delegates.md#194-delegate-compatibility)) with the single best method from the method group for conversion `C₁`
10071008
10081009
#### 11.6.4.5 Exactly matching expression
10091010
@@ -1018,7 +1019,7 @@ Given an expression `E` and a type `T`, `E` ***exactly matches*** `T` if one of
10181019
10191020
#### 11.6.4.6 Better conversion target
10201021
1021-
Given an expression `E` and two types `T₁` and `T₂`, `T₁` is a ***better conversion target*** than `T` for `E` if one of the following holds:
1022+
Given two types `T₁` and `T₂`, `T₁` is a ***better conversion target*** than `T₂` if one of the following holds:
10221023
10231024
- An implicit conversion from `T₁` to `T₂` exists
10241025
- `T₁` is `Task<S₁>`, `T₂` is `Task<S₂>`, and `S₁` is a better conversion target than `S₂`
@@ -1027,7 +1028,6 @@ Given an expression `E` and two types `T₁` and `T₂`, `T₁` is a ***better c
10271028
- `S₁` is `short` and `S₂` is `ushort`, `uint`, or `ulong`
10281029
- `S₁` is `int` and `S₂` is `uint`, or `ulong`
10291030
- `S₁` is `long` and `S₂` is `ulong`
1030-
- `E` is a method group conversion ([§10.8](conversions.md#108-method-group-conversions)) and `T₁` is compatible ([§19.4](delegates.md#194-delegate-compatibility)) with the single best method from the method group
10311031
10321032
#### 11.6.4.7 Overloading in generic classes
10331033

0 commit comments

Comments
 (0)