-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels
Description
Description
When applying a body macro to a function, compilation fails if the function contains a closure with a capture list.
Removing either the macro or the capture resolves the issue.
Reproduction
class Demo {
@NoOpBodyMacro // this macro does nothing but return the body as-is, so it's fundamentally a no-op
func demo() {
let closure = { [weak self] in // 🛑 error: Type of expression is ambiguous without a type annotation
// no-op
}
}
}
Build BodyMacroErrorDemo_2025-03-17T00-48-24.txt
Expected behavior
The code above compiles.
Environment
swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.109.103 clang-1700.0.13.2)
Target: arm64-apple-macosx15.0
Xcode 16.3.0 beta 2
Additional information
No response
swift-student, nickm01, MrAdamBoyd, amishra-turo, c24objcio and 1 more
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels