Skip to content

Commit 919121a

Browse files
committed
Make IUO unwraps in thunks use the IUO message
@jckarter pointed out that force unwraps emitted in thunks are always for IUOs and should use the implicit unwrap message.
1 parent b6e3503 commit 919121a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/SILGen/SILGenPoly.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,11 @@ ManagedValue Transform::transform(ManagedValue v,
398398
// optional or Any, force it.
399399
if (inputIsOptional && !outputIsOptional &&
400400
!outputSubstType->isExistentialType()) {
401-
// isImplicitUnwrap is hardcoded false because this method is never
402-
// used to generate code from a ForceValueExpr.
401+
// isImplicitUnwrap is hardcoded true because the looseness in types of
402+
// @objc witnesses/overrides that we're handling here only allows IUOs,
403+
// not explicit Optionals.
403404
v = SGF.emitCheckedGetOptionalValueFrom(Loc, v,
404-
/*isImplicitUnwrap*/ false,
405+
/*isImplicitUnwrap*/ true,
405406
SGF.getTypeLowering(v.getType()),
406407
SGFContext());
407408

0 commit comments

Comments
 (0)