Merge pull request #7354 from DougGregor/sr-3842-3.1

[3.1] [SR-3842] Swift 3 compatibility: make '.map(String.init)' type-check
diff --git a/stdlib/public/core/StringInterpolation.swift.gyb b/stdlib/public/core/StringInterpolation.swift.gyb
index e54aeb8..b8062a1 100644
--- a/stdlib/public/core/StringInterpolation.swift.gyb
+++ b/stdlib/public/core/StringInterpolation.swift.gyb
@@ -68,35 +68,29 @@
     self = String(describing: expr)
   }
 
+% for Type in StreamableTypes:
   /// Creates a string containing the given value's textual representation.
   ///
   /// Do not call this initializer directly. It is used by the compiler when
   /// interpreting string interpolations.
   ///
   /// - SeeAlso: `ExpressibleByStringInterpolation`
-  public init<T: TextOutputStreamable> (stringInterpolationSegment expr: T) {
+  public init(stringInterpolationSegment expr: ${Type}) {
     self = _toStringReadOnlyStreamable(expr)
   }
+% end
 
+% for Type in PrintableTypes:
   /// Creates a string containing the given value's textual representation.
   ///
   /// Do not call this initializer directly. It is used by the compiler when
   /// interpreting string interpolations.
   ///
   /// - SeeAlso: `ExpressibleByStringInterpolation`
-  public init<T: CustomStringConvertible> (stringInterpolationSegment expr: T) {
+  public init(stringInterpolationSegment expr: ${Type}) {
     self = _toStringReadOnlyPrintable(expr)
   }
-
-  /// Creates a string containing the given value's textual representation.
-  ///
-  /// Do not call this initializer directly. It is used by the compiler when
-  /// interpreting string interpolations.
-  ///
-  /// - SeeAlso: `ExpressibleByStringInterpolation`
-  public init<T: TextOutputStreamable & CustomStringConvertible> (stringInterpolationSegment expr: T) {
-    self = _toStringReadOnlyStreamable(expr)
-  }
+% end
 }
 
 // ${'Local Variables'}:
diff --git a/test/Compatibility/sr3842_map_string_init.swift b/test/Compatibility/sr3842_map_string_init.swift
new file mode 100644
index 0000000..38e1252
--- /dev/null
+++ b/test/Compatibility/sr3842_map_string_init.swift
@@ -0,0 +1,6 @@
+// RUN: %target-typecheck-verify-swift -swift-version 3
+
+// SR-3842
+func test(years: [Int]) {
+  _ = years.map(String.init)
+}
diff --git a/test/api-digester/source-stability.swift.expected b/test/api-digester/source-stability.swift.expected
index 86e7300..afef4ce 100644
--- a/test/api-digester/source-stability.swift.expected
+++ b/test/api-digester/source-stability.swift.expected
@@ -12,7 +12,6 @@
 Protocol MutableIndexable has been removed (deprecated)
 Protocol RandomAccessIndexable has been removed (deprecated)
 Protocol RangeReplaceableIndexable has been removed (deprecated)
-Constructor String.init(stringInterpolationSegment:) has been removed
 Func Array.append(contentsOf:) has been removed
 Func ArraySlice.append(contentsOf:) has been removed
 Func ContiguousArray.append(contentsOf:) has been removed
@@ -35,7 +34,6 @@
 Constructor RangeReplaceableRandomAccessSlice.init(base:bounds:) has 2nd parameter type change from Range<Base.Index> to Range<RangeReplaceableRandomAccessSlice.Index>
 Constructor RangeReplaceableSlice.init(base:bounds:) has 2nd parameter type change from Range<Base.Index> to Range<RangeReplaceableSlice.Index>
 Constructor Slice.init(base:bounds:) has 2nd parameter type change from Range<Base.Index> to Range<Slice.Index>
-Constructor String.init(stringInterpolationSegment:) has 1st parameter type change from String to T
 Func AnyBidirectionalCollection.makeIterator() has return type change from AnyIterator<Element> to AnyBidirectionalCollection.Iterator
 Func AnyCollection.makeIterator() has return type change from AnyIterator<Element> to AnyCollection.Iterator
 Func AnyRandomAccessCollection.makeIterator() has return type change from AnyIterator<Element> to AnyRandomAccessCollection.Iterator
diff --git a/validation-test/Sema/interpolation_placeholders.swift b/validation-test/Sema/interpolation_placeholders.swift
deleted file mode 100644
index 519d3cb..0000000
--- a/validation-test/Sema/interpolation_placeholders.swift
+++ /dev/null
@@ -1,4 +0,0 @@
-// RUN: not %target-swift-frontend -typecheck %s
-
-let query = "<#...#>=\(<#...#>)&<#...#>=\(<#...#>)&<#...#>=\(<#...#>)&<#...#>=\(<#...#>)&<#...#>=\(<#...#>)&<#...#>=\(<#...#>)&<#...#>=\(<#...#>)&<#...#>=\(<#...#>)&<#...#>=\(<#...#>)&<#...#>=\(<#...#>)&<#...#>=\(<#...#>)&<#...#>=\(<#...#>)&<#...#>=\(<#...#>)&<#...#>=\(<#...#>)&<#...#>=\(<#...#>)&<#...#>=\(<#...#>)"
-