Skip to content

Commit 422dbe4

Browse files
committed
[ResultBuilder] AST transform: don't try type erasure of result expressions
Constraint generation is going to erase when appropriate and rewrite the target, no need to do that explicitly during result builder transform.
1 parent 8f4658f commit 422dbe4

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

lib/Sema/BuilderTransform.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -919,8 +919,6 @@ class ResultBuilderTransform
919919

920920
using UnsupportedElt = SkipUnhandledConstructInResultBuilder::UnhandledNode;
921921

922-
/// The constraint system this transform is associated with.
923-
ConstraintSystem &CS;
924922
/// The result type of this result builder body.
925923
Type ResultType;
926924

@@ -930,8 +928,7 @@ class ResultBuilderTransform
930928
public:
931929
ResultBuilderTransform(ConstraintSystem &cs, DeclContext *dc,
932930
Type builderType, Type resultTy)
933-
: BuilderTransformerBase(&cs, dc, builderType), CS(cs),
934-
ResultType(resultTy) {}
931+
: BuilderTransformerBase(&cs, dc, builderType), ResultType(resultTy) {}
935932

936933
UnsupportedElt getUnsupportedElement() const { return FirstUnsupported; }
937934

@@ -1180,10 +1177,6 @@ class ResultBuilderTransform
11801177
{buildBlockResult}, {Identifier()});
11811178
}
11821179

1183-
// Type erase return if the result type requires it.
1184-
buildBlockResult = CS.buildTypeErasedExpr(buildBlockResult, dc,
1185-
ResultType, CTP_ReturnStmt);
1186-
11871180
elements.push_back(new (ctx) ReturnStmt(resultLoc, buildBlockResult,
11881181
/*Implicit=*/true));
11891182
}

0 commit comments

Comments
 (0)