Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-9264] Unexpected compiler error message when block destructing tuple arguments has errors in body. #51741

Open
swift-ci opened this issue Nov 15, 2018 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-9264
Radar None
Original Reporter voxar (JIRA User)
Type Bug
Environment

Xcode 10.1 (10B61)

Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)

Target: x86_64-apple-darwin18.0.0

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, TypeChecker
Assignee None
Priority Medium

md5: ba1f82350217714b539634b4f35fc769

Issue Description:

The following sample fails to compile as expected but generates the wrong error message.

"123".enumerated().forEach { (a, b) in 
  print(a+b)
}

Generates error on "(a, b)"

error: closure tuple parameter '(offset: Int, element: Character)' does not support destructuring

Expected error on `a+b`

error: binary operator '+' cannot be applied to operands of type 'String' and 'Int'

@belkadan
Copy link
Contributor

cc @xedin, @rudkx. Looks like our one-level destructuring doesn't kick in consistently.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants