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-13091] Failed to produce diagnostic for expression #55537

Closed
swift-ci opened this issue Jun 26, 2020 · 3 comments
Closed

[SR-13091] Failed to produce diagnostic for expression #55537

swift-ci opened this issue Jun 26, 2020 · 3 comments
Assignees
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 failed to produce diagnostic Bug → internal error: Failed to produce diagnostic for expression type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-13091
Radar None
Original Reporter paiv (JIRA User)
Type Bug
Status Closed
Resolution Cannot Reproduce
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQol, TypeChecker
Assignee @typesanitizer
Priority Medium

md5: 10499b9c959c56a44a159bed5736dab5

Issue Description:

some.swift

let res = (0..<2).map { x in
    (0..<2).map { y in x + x + y }}
    .reduce(0, +)
print("\(res)")
$ swift -version
Apple Swift version 5.3 (swiftlang-1200.0.16.9 clang-1200.0.22.5)
Target: x86_64-apple-darwin19.5.0

$ time swift some.swift
some.swift:3:6: error: failed to produce diagnostic for expression; please file a bug report
    .reduce(0, +)
     ^

real    0m8.982s
user    0m8.624s
sys 0m0.241s

In previous versions this was reported as type-checker timeout:

$ swift -version
Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
Target: x86_64-apple-darwin19.5.0

$ time swift some.swift
some.swift:3:6: error: the compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
    .reduce(0, +)
~~~~~^~~~~~~~~~~~

real    0m16.161s
user    0m15.096s
sys 0m0.664s
@typesanitizer
Copy link

Looks like this has been fixed on master, but is an issue in Xcode 12 beta 1. Can you try reproducing with a recent snapshot toolchain?
https://swift.org/download/#snapshots

You can change the toolchain in Xcode by going to the menu bar > Xcode > Toolchains > Select the snapshot toolchain.

@swift-ci
Copy link
Collaborator Author

Comment by Pavel Ivashkov (JIRA)

Yes, fixed in this snapshot, and correctly reports compilation error:

$ TOOLCHAINS=swift swift -version
Apple Swift version 5.3-dev (LLVM 7f0ab86d402ab93, Swift 5273bc9e8b1e86d)
Target: x86_64-apple-darwin19.5.0

$ TOOLCHAINS=swift time swift some.swift
some.swift:2:13: error: cannot convert value of type '[Int]' to closure result type 'Int'
    (0..<2).map { y in x + x + y }}
    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
       24.60 real        23.76 user         0.52 sys

@typesanitizer
Copy link

Fixed on master.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal added diagnostics QoI Bug: Diagnostics Quality of Implementation and removed DiagnosticsQol labels Apr 26, 2022
@AnthonyLatsis AnthonyLatsis added the failed to produce diagnostic Bug → internal error: Failed to produce diagnostic for expression label Dec 22, 2022
This issue was closed.
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 failed to produce diagnostic Bug → internal error: Failed to produce diagnostic for expression type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants