Commit Graph

2 Commits

Author SHA1 Message Date
Slava Pestov
8fd7a1db86 Sema: Fix CSGen for ForceTryExpr 2025-10-28 19:56:32 -04:00
Slava Pestov
f014a9aeec Sema: Don't coerce subexpression of 'try' to rvalue
The change in 8ab8b2e3e9, was too
broad. We want to coerce the subexpression of `try!` to an rvalue,
but not the subexpression of a `try`.

If the subexpression of a `try` becomes an rvalue even though the
type of the parent expression is an lvalue, we can end up with
infinite recursion in coerceToType(), as demonstrated by the
test case.

Fixes https://github.com/swiftlang/swift/issues/85034.
2025-10-28 19:21:35 -04:00