Skip to content

Commit efc3e5f

Browse files
committed
Sema: Allow for same-type coercion between existential metatypes
1 parent 6f1e3ed commit efc3e5f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/Sema/CSApply.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6453,6 +6453,12 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
64536453
}
64546454
}
64556455

6456+
// Allows for same-type coercion with existential metatypes.
6457+
if (auto toMeta = toType->getAs<AnyMetatypeType>()) {
6458+
if (fromMeta->getInstanceType()->isEqual(toMeta->getInstanceType()))
6459+
return expr;
6460+
}
6461+
64566462
break;
64576463
}
64586464

0 commit comments

Comments
 (0)