Skip to content

Commit

Permalink
Tests: Regression: Swift 2.1 ➜ 2.2: Type inference fails for `Color.W…
Browse files Browse the repository at this point in the history
…rap` when operator-concatenating parameter array without annotation.

Annotating the entire array as `[(Color.Wrap, String)]` provides explicit type information for the operator-concatenation of the parameter array.
  • Loading branch information
jdhealy committed Mar 28, 2016
1 parent 48569b9 commit 8781dab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Tests/PrettyColorsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,13 @@ class PrettyColorsTests: XCTestCase {
let formatted·number = NSString(format: "%02d", number) as String

for (appended·wrap, suffix) in [
(wrap, "normal") as (Color.Wrap, String),
(wrap, "normal"),
// TODO: Investigate why `as (Color.Wrap, String)` before above comma
// doesn't provide enough type info for the remaining lines in the array.
(wrap + [ StyleParameter.Bold ], "bold"),
(wrap + [ StyleParameter.Italic ], "italic"),
(wrap + [ StyleParameter.Underlined ], "underlined")
] {
] /* type-inference fails without */ as [(Color.Wrap, String)] {
let styled·output = (appended·wrap + style·wrap).wrap("__|øat·•ªº^∆©|__")
print( "\(styled·output) \(formatted·number) + \(suffix)" )
}
Expand Down

0 comments on commit 8781dab

Please sign in to comment.