Skip to content

Commit d5cc914

Browse files
committed
Don't transform Return#from
Explanation given in the comment.
1 parent 3ac70b6 commit d5cc914

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/dotty/tools/dotc/transform/TreeTransform.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,11 @@ object TreeTransforms {
11411141
if (mutatedInfo eq null) tree
11421142
else {
11431143
val expr = transform(tree.expr, mutatedInfo, cur)
1144-
val from = transform(tree.from, mutatedInfo, cur)
1144+
val from = tree.from
1145+
// don't thansform the `from` part, as this is not a normal ident, but
1146+
// a pointer to the enclosing method. Transforming this as a normal ident
1147+
// can go wrong easily. If a transformation is needed, it should be
1148+
// the responsibility of the transformReturn method to handle this also.
11451149
goReturn(cpy.Return(tree)(expr, from), mutatedInfo.nx.nxTransReturn(cur))
11461150
}
11471151
case tree: Try =>

0 commit comments

Comments
 (0)