File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -3038,21 +3038,14 @@ namespace {
3038
3038
Type visitCoerceExpr (CoerceExpr *expr) {
3039
3039
// Validate the resulting type.
3040
3040
auto *const repr = expr->getCastTypeRepr ();
3041
- const auto type = resolveTypeReferenceInExpression (
3042
- repr, TypeResolverContext::ExplicitCastExpr, [](auto unboundTy) {
3043
- // FIXME: We ought to pass an OpenUnboundGenericType object rather
3044
- // than calling CS.openUnboundGenericType after resolving, but
3045
- // sometimes the type expression is resolved eagerly in
3046
- // PreCheckExpression::simplifyTypeConstructionWithLiteralArg,
3047
- // letting unbound generics escape.
3048
- return unboundTy;
3049
- });
3050
- if (!type)
3041
+ const auto toType = resolveTypeReferenceInExpression (
3042
+ repr, TypeResolverContext::ExplicitCastExpr,
3043
+ // Introduce type variables for unbound generics.
3044
+ OpenUnboundGenericType (CS, CS.getConstraintLocator (expr)));
3045
+ if (!toType)
3051
3046
return nullptr ;
3052
3047
3053
- // Open the type we're casting to.
3054
- const auto toType =
3055
- CS.openUnboundGenericTypes (type, CS.getConstraintLocator (expr));
3048
+ // Cache the type we're casting to.
3056
3049
if (repr) CS.setType (repr, toType);
3057
3050
3058
3051
auto fromType = CS.getType (expr->getSubExpr ());
You can’t perform that action at this time.
0 commit comments