Skip to content

Commit fe5b1f1

Browse files
authored
Merge pull request #7901 from jckarter/no-bridging-constraints-without-bridging
Sema: Assert that bridging constraints aren't formed when ObjC interop is disabled.
2 parents 3456d04 + f662ed8 commit fe5b1f1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3351,9 +3351,10 @@ ConstraintSystem::simplifyBridgingConstraint(Type type1,
33513351
Type type2,
33523352
TypeMatchOptions flags,
33533353
ConstraintLocatorBuilder locator) {
3354-
// There's no bridging without ObjC interop.
3355-
if (!TC.Context.LangOpts.EnableObjCInterop)
3356-
return SolutionKind::Error;
3354+
// There's no bridging without ObjC interop, so we shouldn't have set up
3355+
// bridging constraints without it.
3356+
assert(TC.Context.LangOpts.EnableObjCInterop
3357+
&& "bridging constraint w/o ObjC interop?!");
33573358

33583359
TypeMatchOptions subflags = getDefaultDecompositionOptions(flags);
33593360

lib/Sema/Constraint.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,10 @@ Constraint *Constraint::create(ConstraintSystem &cs, ConstraintKind kind,
527527
kind != ConstraintKind::LiteralConformsTo &&
528528
kind != ConstraintKind::SelfObjectOfProtocol) ||
529529
second->is<ProtocolType>());
530+
531+
// Bridging constraints require bridging to be enabled.
532+
assert(kind != ConstraintKind::BridgingConversion
533+
|| cs.TC.Context.LangOpts.EnableObjCInterop);
530534

531535
// Create the constraint.
532536
unsigned size = totalSizeToAlloc<TypeVariableType*>(typeVars.size());

0 commit comments

Comments
 (0)