Skip to content

Commit 100ad3d

Browse files
committed
[AST] Remove ImplicitlyUnwrappedFunctionConversionExpr
This was a hack needed to let CSApply re-write IUO-returning applies, and is no longer needed now that we can directly perform the unwrapping when needed.
1 parent 287fa8e commit 100ad3d

File tree

6 files changed

+0
-46
lines changed

6 files changed

+0
-46
lines changed

include/swift/AST/Expr.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3102,26 +3102,6 @@ class CovariantReturnConversionExpr : public ImplicitConversionExpr {
31023102
}
31033103
};
31043104

3105-
/// Perform a function conversion from a function returning an
3106-
/// Optional<T> to a function returning T.
3107-
///
3108-
/// This is generated during expression type checking in places where
3109-
/// we need to force the result type of a function being called. When
3110-
/// we go to rewrite the call, we remove this node and force the
3111-
/// result of the call to the underlying function. It should never
3112-
/// exist outside of this final stage of expression type checking.
3113-
class ImplicitlyUnwrappedFunctionConversionExpr
3114-
: public ImplicitConversionExpr {
3115-
public:
3116-
ImplicitlyUnwrappedFunctionConversionExpr(Expr *subExpr, Type type)
3117-
: ImplicitConversionExpr(ExprKind::ImplicitlyUnwrappedFunctionConversion,
3118-
subExpr, type) {}
3119-
3120-
static bool classof(const Expr *E) {
3121-
return E->getKind() == ExprKind::ImplicitlyUnwrappedFunctionConversion;
3122-
}
3123-
};
3124-
31253105
/// MetatypeConversionExpr - Convert a metatype to another metatype
31263106
/// using essentially a derived-to-base conversion.
31273107
class MetatypeConversionExpr : public ImplicitConversionExpr {

include/swift/AST/ExprNodes.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ ABSTRACT_EXPR(ImplicitConversion, Expr)
155155
EXPR(FunctionConversion, ImplicitConversionExpr)
156156
EXPR(CovariantFunctionConversion, ImplicitConversionExpr)
157157
EXPR(CovariantReturnConversion, ImplicitConversionExpr)
158-
EXPR(ImplicitlyUnwrappedFunctionConversion, ImplicitConversionExpr)
159158
EXPR(MetatypeConversion, ImplicitConversionExpr)
160159
EXPR(CollectionUpcastConversion, ImplicitConversionExpr)
161160
EXPR(Erasure, ImplicitConversionExpr)

lib/AST/ASTDumper.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,12 +2169,6 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
21692169
printRec(E->getSubExpr());
21702170
PrintWithColorRAII(OS, ParenthesisColor) << ')';
21712171
}
2172-
void visitImplicitlyUnwrappedFunctionConversionExpr(
2173-
ImplicitlyUnwrappedFunctionConversionExpr *E) {
2174-
printCommon(E, "implicitly_unwrapped_function_conversion_expr") << '\n';
2175-
printRec(E->getSubExpr());
2176-
PrintWithColorRAII(OS, ParenthesisColor) << ')';
2177-
}
21782172
void visitUnderlyingToOpaqueExpr(UnderlyingToOpaqueExpr *E){
21792173
printCommon(E, "underlying_to_opaque_expr") << '\n';
21802174
printRec(E->getSubExpr());

lib/AST/Expr.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ ConcreteDeclRef Expr::getReferencedDecl(bool stopAtParenExpr) const {
336336
PASS_THROUGH_REFERENCE(FunctionConversion, getSubExpr);
337337
PASS_THROUGH_REFERENCE(CovariantFunctionConversion, getSubExpr);
338338
PASS_THROUGH_REFERENCE(CovariantReturnConversion, getSubExpr);
339-
PASS_THROUGH_REFERENCE(ImplicitlyUnwrappedFunctionConversion, getSubExpr);
340339
PASS_THROUGH_REFERENCE(MetatypeConversion, getSubExpr);
341340
PASS_THROUGH_REFERENCE(CollectionUpcastConversion, getSubExpr);
342341
PASS_THROUGH_REFERENCE(Erasure, getSubExpr);
@@ -661,7 +660,6 @@ bool Expr::canAppendPostfixExpression(bool appendingPostfixOperator) const {
661660
case ExprKind::FunctionConversion:
662661
case ExprKind::CovariantFunctionConversion:
663662
case ExprKind::CovariantReturnConversion:
664-
case ExprKind::ImplicitlyUnwrappedFunctionConversion:
665663
case ExprKind::MetatypeConversion:
666664
case ExprKind::CollectionUpcastConversion:
667665
case ExprKind::Erasure:
@@ -828,7 +826,6 @@ bool Expr::isValidParentOfTypeExpr(Expr *typeExpr) const {
828826
case ExprKind::FunctionConversion:
829827
case ExprKind::CovariantFunctionConversion:
830828
case ExprKind::CovariantReturnConversion:
831-
case ExprKind::ImplicitlyUnwrappedFunctionConversion:
832829
case ExprKind::MetatypeConversion:
833830
case ExprKind::CollectionUpcastConversion:
834831
case ExprKind::Erasure:

lib/SILGen/SILGenApply.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,13 +1252,6 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
12521252
visitExpr(e);
12531253
}
12541254

1255-
void visitImplicitlyUnwrappedFunctionConversionExpr(
1256-
ImplicitlyUnwrappedFunctionConversionExpr *e) {
1257-
// These are generated for short term use in the type checker.
1258-
llvm_unreachable(
1259-
"We should not see ImplicitlyUnwrappedFunctionConversionExpr here");
1260-
}
1261-
12621255
void visitIdentityExpr(IdentityExpr *e) {
12631256
visit(e->getSubExpr());
12641257
}

lib/SILGen/SILGenExpr.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,6 @@ namespace {
452452
RValue visitCovariantReturnConversionExpr(
453453
CovariantReturnConversionExpr *E,
454454
SGFContext C);
455-
RValue visitImplicitlyUnwrappedFunctionConversionExpr(
456-
ImplicitlyUnwrappedFunctionConversionExpr *E, SGFContext C);
457455
RValue visitErasureExpr(ErasureExpr *E, SGFContext C);
458456
RValue visitAnyHashableErasureExpr(AnyHashableErasureExpr *E, SGFContext C);
459457
RValue visitForcedCheckedCastExpr(ForcedCheckedCastExpr *E,
@@ -1823,13 +1821,6 @@ RValue RValueEmitter::visitCovariantReturnConversionExpr(
18231821
return RValue(SGF, e, result);
18241822
}
18251823

1826-
RValue RValueEmitter::visitImplicitlyUnwrappedFunctionConversionExpr(
1827-
ImplicitlyUnwrappedFunctionConversionExpr *e, SGFContext C) {
1828-
// These are generated for short term use in the type checker.
1829-
llvm_unreachable(
1830-
"We should not see ImplicitlyUnwrappedFunctionConversionExpr here");
1831-
}
1832-
18331824
RValue RValueEmitter::visitErasureExpr(ErasureExpr *E, SGFContext C) {
18341825
if (auto result = tryEmitAsBridgingConversion(SGF, E, false, C)) {
18351826
return RValue(SGF, E, *result);

0 commit comments

Comments
 (0)