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-12029] Compiler spends unacceptably long time infering type in complex expression #54466

Open
swift-ci opened this issue Jan 14, 2020 · 0 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-12029
Radar None
Original Reporter dead_bug (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug, TypeChecker
Assignee @slavapestov
Priority Medium

md5: 8a549dc72239c541a177ec490f45c3fc

Issue Description:

import Foundation

let items = (1...10).map { _ in
 (weight: Int.random(in: 1...10), value: Int.random(in: 1...10))
}
let vals = Dictionary(grouping: items, by: {$0.weight})
 .mapValues{$0.map{$0.1}}
 .map{ item in
 (weight: item.key, value: item.value.filter{
 $0 >= item.key
 })
 }
 .filter{!$0.value.isEmpty}
 .sorted{$0.weight < $1.weight}
 .map{($0.weight, $0.value.sorted{$0 > $1})}

print(vals)

That is how error looks

error: the compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
    .map{($0.weight, $0.value.sorted{$0 > $1})}
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the compiler The Swift compiler in itself label Dec 13, 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 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants