@@ -763,7 +763,14 @@ A user-defined implicit conversion from an expression `E` to a type `T` is pro
763763 - 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 .
764764- 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 does not exist .
765765
766- - 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 .
766+ - Find the set of applicable user -defined and lifted conversion operators , `U `.
767+ - 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 ).
768+ - 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 `.
769+ - If `U1 ` is not empty , then `U ` is `U1 `. Otherwise ,
770+ - 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 ).
771+ - 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 `.
772+ - If `U2 ` is not empty , then `U ` is `U2 `.
773+ - If `U ` is empty , the conversion is undefined and a compile -time error occurs .
767774- Find the most -specific source type , `S ₓ`, of the operators in `U `:
768775 - If `S ` exists and any of the operators in `U ` convert from `S `, then `S ₓ` is `S `.
769776 - 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 .
@@ -789,8 +796,14 @@ A user-defined explicit conversion from an expression `E` to a type `T` is pro
789796 - If `E ` has a type , let `S ` be that type .
790797 - 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 .
791798 - 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 .
792- - 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 does not exist .
793- - 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 .
799+ - Find the set of applicable user - defined and lifted conversion operators , `U `.
800+ - 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 ).
801+ - 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 `.
802+ - If `U1 ` is not empty , then `U ` is `U1 `. Otherwise ,
803+ - 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 ).
804+ - 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 `.
805+ - If `U2 ` is not empty , then `U ` is `U2 `.
806+ - If `U ` is empty , the conversion is undefined and a compile -time error occurs .
794807- Find the most -specific source type , `S ₓ`, of the operators in `U `:
795808 - If `S ` exists and any of the operators in `U ` convert from `S `, then `S ₓ` is `S `.
796809 - 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