"branches have mismatching types" in recursive computed property when using single-expr implicit return; works fine with explicit return in each branch #79565
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
In the program below, the first computed property (using implicit returns) fails to compile, while the second one (using explicit returns) works fine.
since the two are semantically equivalent, the compiler should be able to compile both.
Reproduction
Expected behavior
the compiler should treat both equally: since it apparently is already able to understand that the explicit-return version will have the same return type in each branch (bc one branch returns a concrete type, and the other is recursive and will therefore eventually also return that type), it should do the same for the implicit-return version
Environment
swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: arm64-apple-macosx15.0
Additional information
No response
The text was updated successfully, but these errors were encountered: