From 8781dab5f905a48d026b6d538f0b4814000153bd Mon Sep 17 00:00:00 2001 From: "J.D. Healy" Date: Mon, 28 Mar 2016 12:26:42 -0400 Subject: [PATCH] =?UTF-8?q?Tests:=20Regression:=20Swift=202.1=20=E2=9E=9C?= =?UTF-8?q?=202.2:=20Type=20inference=20fails=20for=20`Color.Wrap`=20when?= =?UTF-8?q?=20operator-concatenating=20parameter=20array=20without=20annot?= =?UTF-8?q?ation.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Annotating the entire array as `[(Color.Wrap, String)]` provides explicit type information for the operator-concatenation of the parameter array. --- Tests/PrettyColorsTests.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Tests/PrettyColorsTests.swift b/Tests/PrettyColorsTests.swift index c03d4a3d..80ce3bed 100644 --- a/Tests/PrettyColorsTests.swift +++ b/Tests/PrettyColorsTests.swift @@ -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)" ) }