Skip to content

Commit f75dd6c

Browse files
authored
Merge pull request #14391 from jckarter/too-complex-message
Reword the "expression too complex" error not to blame the user.
2 parents 871c9da + 69bacef commit f75dd6c

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ ERROR(cannot_pass_rvalue_mutating_getter,none,
143143
(Type))
144144

145145
ERROR(expression_too_complex,none,
146-
"expression was too complex to be solved in reasonable time; "
147-
"consider breaking up the expression into distinct sub-expressions", ())
146+
"the compiler is unable to type-check this expression in reasonable time; "
147+
"try breaking up the expression into distinct sub-expressions", ())
148148

149149
ERROR(value_type_comparison_with_nil_illegal_did_you_mean,none,
150150
"value of type %0 cannot be compared by reference; "

test/Misc/expression_too_complex.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-typecheck-verify-swift -solver-memory-threshold 16000 -propagate-constraints
22

3-
var z = 10 + 10 // expected-error{{expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions}}
3+
var z = 10 + 10 // expected-error{{reasonable time}}
44

55
// No errors should appear below as a result of the error above.
66
var x = [1, 2, 3, 4.5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 ,19]

test/Misc/expression_too_complex_2.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class MyViewCell: UITableViewCell {
99
required init?(coder aDecoder: NSCoder) { fatalError("no") }
1010
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
1111
super.init(style: .default, reuseIdentifier: reuseIdentifier)
12-
NSLayoutConstraint.activate([ // expected-error{{expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions}}
12+
NSLayoutConstraint.activate([ // expected-error{{reasonable time}}
1313
NSLayoutConstraint(item: View1, attribute: .top, relatedBy: .equal, toItem: label1, attribute: .top, multiplier: 1, constant: 1),
1414
NSLayoutConstraint(item: View1, attribute: .top, relatedBy: .equal, toItem: label2, attribute: .top, multiplier: 1, constant: 1),
1515
NSLayoutConstraint(item: View1, attribute: .top, relatedBy: .equal, toItem: label3, attribute: .top, multiplier: 1, constant: 1),

test/Misc/expression_too_complex_4.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
func test(_ i: Int, _ j: Int) -> Int {
44
return 1 + (((i >> 1) + (i >> 2) + (i >> 3) + (i >> 4) << 1) << 1) & 0x40
5-
// expected-error@-1 {{expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions}}
5+
// expected-error@-1 {{reasonable time}}
66
}

0 commit comments

Comments
 (0)