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-10161] compiler is unable to type-check this expression in reasonable time #52563

Open
an0 mannequin opened this issue Mar 24, 2019 · 2 comments
Open

[SR-10161] compiler is unable to type-check this expression in reasonable time #52563

an0 mannequin opened this issue Mar 24, 2019 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 5.0 type checker Area → compiler: Semantic analysis

Comments

@an0
Copy link
Mannequin

an0 mannequin commented Mar 24, 2019

Previous ID SR-10161
Radar None
Original Reporter @an0
Type Bug
Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, 5.0Regression, TypeChecker
Assignee None
Priority Medium

md5: b4414020ec7c32c7070fbbbb2ababd19

Issue Description:

This is a regression in Swift 5. It compiles fine with Swift 4.2.1.

let a = 0
let b = 0
let c = 0
// error: the compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
[(-b + c) / (2 * a), (-b - c) / (2 * a)]
@belkadan
Copy link
Contributor

cc @xedin

@NevinBR
Copy link
Contributor

NevinBR commented May 25, 2020

Would it be feasible to introduce a rule to prefer same-type operators?

Something along the lines of:

“For all operators in an expression which have at least one candidate with lhs and rhs the same type, first try to find a valid solution using only those same-type candidates. If a solution is found, then stop and do not try mixed-type operators.”

@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 regression swift 5.0 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants