From 3b47b16a473131446f655c0fe90e304f94e059fc Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Mon, 11 Sep 2017 09:56:41 -0700 Subject: [PATCH] [Stdlib] Eliminate the _UnicodeEncoding_ protocol. This protocol was only used to fake recursive protocol conformances; collapse it into _UnicodeEncoding. --- stdlib/public/core/UTFEncoding.swift | 2 +- stdlib/public/core/UnicodeEncoding.swift | 13 ++++--------- stdlib/public/core/UnicodeParser.swift | 2 +- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/stdlib/public/core/UTFEncoding.swift b/stdlib/public/core/UTFEncoding.swift index 1a257b75d10..bab890a6c04 100644 --- a/stdlib/public/core/UTFEncoding.swift +++ b/stdlib/public/core/UTFEncoding.swift @@ -17,7 +17,7 @@ public protocol _UTFParser { - associatedtype Encoding : _UnicodeEncoding_ + associatedtype Encoding : _UnicodeEncoding func _parseMultipleCodeUnits() -> (isValid: Bool, bitCount: UInt8) func _bufferedScalar(bitCount: UInt8) -> Encoding.EncodedScalar diff --git a/stdlib/public/core/UnicodeEncoding.swift b/stdlib/public/core/UnicodeEncoding.swift index 2bde99e60a8..ca81faba73b 100644 --- a/stdlib/public/core/UnicodeEncoding.swift +++ b/stdlib/public/core/UnicodeEncoding.swift @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -public protocol _UnicodeEncoding_ { +public protocol _UnicodeEncoding { /// The basic unit of encoding associatedtype CodeUnit : UnsignedInteger, FixedWidthInteger @@ -44,12 +44,12 @@ public protocol _UnicodeEncoding_ { /// A type that can be used to parse `CodeUnits` into /// `EncodedScalar`s. associatedtype ForwardParser : Unicode.Parser - // where ForwardParser.Encoding == Self + where ForwardParser.Encoding == Self /// A type that can be used to parse a reversed sequence of /// `CodeUnits` into `EncodedScalar`s. associatedtype ReverseParser : Unicode.Parser - // where ReverseParser.Encoding == Self + where ReverseParser.Encoding == Self //===--------------------------------------------------------------------===// // FIXME: this requirement shouldn't be here and is mitigated by the default @@ -60,15 +60,10 @@ public protocol _UnicodeEncoding_ { static func _isScalar(_ x: CodeUnit) -> Bool } -extension _UnicodeEncoding_ { +extension _UnicodeEncoding { // See note on declaration of requirement, above public static func _isScalar(_ x: CodeUnit) -> Bool { return false } -} -public protocol _UnicodeEncoding : _UnicodeEncoding_ -where ForwardParser.Encoding == Self, ReverseParser.Encoding == Self {} - -extension _UnicodeEncoding_ { public static func transcode( _ content: FromEncoding.EncodedScalar, from _: FromEncoding.Type ) -> EncodedScalar? { diff --git a/stdlib/public/core/UnicodeParser.swift b/stdlib/public/core/UnicodeParser.swift index 0a5ee647f4a..adc4a262dde 100644 --- a/stdlib/public/core/UnicodeParser.swift +++ b/stdlib/public/core/UnicodeParser.swift @@ -43,7 +43,7 @@ extension Unicode { /// scalar values. public protocol _UnicodeParser { /// The encoding with which this parser is associated - associatedtype Encoding : _UnicodeEncoding_ + associatedtype Encoding : _UnicodeEncoding /// Constructs an instance that can be used to begin parsing `CodeUnit`s at /// any Unicode scalar boundary.