@@ -741,9 +741,14 @@ A user-defined implicit conversion from an expression `E` to a type `T` is pro
741741 - If `E ` has a type , let `S ` be that type .
742742 - If `S ` or `T ` are nullable value types , let `S ᵢ` and `T ᵢ` be their underlying types , otherwise let `S ᵢ` and `T ᵢ` be `S ` and `T `, respectively .
743743 - If `S ᵢ` or `T ᵢ` are type parameters , let `S ₀` and `T ₀` be their effective base classes , otherwise let `S ₀` and `T ₀` be `S ᵢ` and `T ᵢ`, respectively .
744- - Find the set of types , `D `, from which user - defined conversion operators will be considered . This set consists of `S ₀` (if `S ₀` exists and is a class or struct ), the base classes of `S ₀` (if `S ₀` exists and is a class ), and `T ₀` (if `T ₀` is a class or struct ). A type is added to the set `D ` only if an identity conversion to another type already included in the set doesn ’t exist .
745-
746- - Find the set of applicable user -defined and lifted conversion operators , `U `. This set consists of the user - defined and lifted implicit conversion operators declared by the classes or structs in `D ` that convert from a type encompassing `E ` to a type encompassed by `T `. If `U ` is empty , the conversion is undefined and a compile -time error occurs .
744+ - Find the set of applicable user - defined and lifted conversion operators , `U `.
745+ - Find the set of types , `D1 `, from which user - defined conversion operators will be considered . This set consists of `S0 ` (if `S0 ` is a class or struct ), the base classes of `S0 ` (if `S0 ` is a class ), and `T0 ` (if `T0 ` is a class or struct ).
746+ - Find the set of applicable user - defined and lifted conversion operators , `U1 `. This set consists of the user - defined and lifted implicit conversion operators declared by the classes or structs in `D1 ` that convert from a type encompassing `S ` to a type encompassed by `T `.
747+ - If `U1 ` is not empty , then `U ` is `U1 `. Otherwise ,
748+ - Find the set of types , `D2 `, from which user - defined conversion operators will be considered . This set consists of `S ᵢ` * effective interface set * and their base interfaces (if `S ᵢ` is a type parameter ), and `T ᵢ` * effective interface set * (if `T ᵢ` is a type parameter ).
749+ - Find the set of applicable user - defined and lifted conversion operators , `U2 `. This set consists of the user - defined and lifted implicit conversion operators declared by the interfaces in `D2 ` that convert from a type encompassing `S ` to a type encompassed by `T `.
750+ - If `U2 ` is not empty , then `U ` is `U2 `.
751+ - If `U ` is empty , the conversion is undefined and a compile -time error occurs .
747752- Find the most -specific source type , `S ₓ`, of the operators in `U `:
748753 - If `S ` exists and any of the operators in `U ` convert from `S `, then `S ₓ` is `S `.
749754 - Otherwise , `S ₓ` is the most -encompassed type in the combined set of source types of the operators in `U `. If exactly one most -encompassed type cannot be found , then the conversion is ambiguous and a compile -time error occurs .
@@ -769,8 +774,14 @@ A user-defined explicit conversion from an expression `E` to a type `T` is pro
769774 - If `E ` has a type , let `S ` be that type .
770775 - If `S ` or `T ` are nullable value types , let `S ᵢ` and `T ᵢ` be their underlying types , otherwise let `S ᵢ` and `T ᵢ` be `S ` and `T `, respectively .
771776 - If `S ᵢ` or `T ᵢ` are type parameters , let `S ₀` and `T ₀` be their effective base classes , otherwise let `S ₀` and `T ₀` be `S ᵢ` and `T ᵢ`, respectively .
772- - Find the set of types , `D `, from which user - defined conversion operators will be considered . This set consists of `S ₀` (if `S ₀` exists and is a class or struct ), the base classes of `S ₀` (if `S ₀` exists and is a class ), `T ₀` (if `T ₀` is a class or struct ), and the base classes of `T ₀` (if `T ₀` is a class ). A type is added to the set `D ` only if an identity conversion to another type already included in the set doesn ’t exist .
773- - Find the set of applicable user -defined and lifted conversion operators , `U `. This set consists of the user - defined and lifted implicit or explicit conversion operators declared by the classes or structs in `D ` that convert from a type encompassing `E ` or encompassed by `S ` (if it exists ) to a type encompassing or encompassed by `T `. If `U ` is empty , the conversion is undefined and a compile -time error occurs .
777+ - Find the set of applicable user - defined and lifted conversion operators , `U `.
778+ - Find the set of types , `D1 `, from which user - defined conversion operators will be considered . This set consists of `S0 ` (if `S0 ` is a class or struct ), the base classes of `S0 ` (if `S0 ` is a class ), `T0 ` (if `T0 ` is a class or struct ), and the base classes of `T0 ` (if `T0 ` is a class ).
779+ - Find the set of applicable user - defined and lifted conversion operators , `U1 `. This set consists of the user - defined and lifted implicit or explicit conversion operators declared by the classes or structs in `D1 ` that convert from a type encompassing or encompassed by `S ` to a type encompassing or encompassed by `T `.
780+ - If `U1 ` is not empty , then `U ` is `U1 `. Otherwise ,
781+ - Find the set of types , `D2 `, from which user - defined conversion operators will be considered . This set consists of `S ᵢ` * effective interface set * and their base interfaces (if `S ᵢ` is a type parameter ), and `T ᵢ` * effective interface set * and their base interfaces (if `T ᵢ` is a type parameter ).
782+ - Find the set of applicable user - defined and lifted conversion operators , `U2 `. This set consists of the user - defined and lifted implicit or explicit conversion operators declared by the interfaces in `D2 ` that convert from a type encompassing or encompassed by `S ` to a type encompassing or encompassed by `T `.
783+ - If `U2 ` is not empty , then `U ` is `U2 `.
784+ - If `U ` is empty , the conversion is undefined and a compile -time error occurs .
774785- Find the most -specific source type , `S ₓ`, of the operators in `U `:
775786 - If `S ` exists and any of the operators in `U ` convert from `S `, then `S ₓ` is `S `.
776787 - Otherwise , if any of the operators in `U ` convert from types that encompass `E `, then `S ₓ` is the most -encompassed type in the combined set of source types of those operators . If no most -encompassed type can be found , then the conversion is ambiguous and a compile -time error occurs .
0 commit comments