Skip to content

Commit e839cd3

Browse files
authored
Merge pull request #30685 from dabrahams/squish-warn
Squash warnings
2 parents 68b3965 + fd48f8f commit e839cd3

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

test/Prototypes/PatternMatching.swift

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,11 @@ protocol Pattern {
3535

3636
func matched<C: Collection>(atStartOf c: C) -> MatchResult<Index, MatchData>
3737
where C.Index == Index, C.Element == Element
38-
// The following requirements go away with upcoming generics features
39-
, C.SubSequence : Collection
4038
}
4139

4240
extension Pattern {
4341
func found<C: Collection>(in c: C) -> (extent: Range<Index>, data: MatchData)?
4442
where C.Index == Index, C.Element == Element
45-
// The following requirements go away with upcoming generics features
46-
, C.SubSequence : Collection
4743
{
4844
var i = c.startIndex
4945
while i != c.endIndex {
@@ -72,8 +68,6 @@ where T.Element : Equatable {
7268

7369
func matched<C: Collection>(atStartOf c: C) -> MatchResult<Index, ()>
7470
where C.Index == Index, C.Element == Element
75-
// The following requirements go away with upcoming generics features
76-
, C.SubSequence : Collection
7771
{
7872
var i = c.startIndex
7973
for p in pattern {
@@ -93,8 +87,6 @@ struct MatchAnyOne<T : Equatable, Index : Comparable> : Pattern {
9387

9488
func matched<C: Collection>(atStartOf c: C) -> MatchResult<Index, ()>
9589
where C.Index == Index, C.Element == Element
96-
// The following requirements go away with upcoming generics features
97-
, C.SubSequence : Collection
9890
{
9991
return c.isEmpty
10092
? .notFound(resumeAt: c.endIndex)
@@ -126,8 +118,6 @@ where M0.Element == M1.Element, M0.Index == M1.Index {
126118

127119
func matched<C: Collection>(atStartOf c: C) -> MatchResult<Index, MatchData>
128120
where C.Index == Index, C.Element == Element
129-
// The following requirements go away with upcoming generics features
130-
, C.SubSequence : Collection
131121
{
132122
var src0 = c[c.startIndex..<c.endIndex]
133123
while true {
@@ -166,8 +156,6 @@ struct RepeatMatch<M0: Pattern> : Pattern {
166156

167157
func matched<C: Collection>(atStartOf c: C) -> MatchResult<M0.Index, MatchData>
168158
where C.Index == M0.Index, C.Element == M0.Element
169-
// The following requirements go away with upcoming generics features
170-
, C.SubSequence : Collection
171159
{
172160
var lastEnd = c.startIndex
173161
var rest = c.dropFirst(0)
@@ -176,11 +164,11 @@ struct RepeatMatch<M0: Pattern> : Pattern {
176164
searchLoop:
177165
while !rest.isEmpty {
178166
switch singlePattern.matched(atStartOf: rest) {
179-
case .found(let x):
180-
data.append(x)
181-
lastEnd = x.end
167+
case .found(let end1, let data1):
168+
data.append((end1, data1))
169+
lastEnd = end1
182170
if data.count == repeatLimits.upperBound { break }
183-
rest = rest[x.end..<rest.endIndex]
171+
rest = rest[end1..<rest.endIndex]
184172
case .notFound(let r):
185173
if !repeatLimits.contains(data.count) {
186174
return .notFound(resumeAt: r)
@@ -236,8 +224,6 @@ where M0.Element == M1.Element, M0.Index == M1.Index {
236224

237225
func matched<C: Collection>(atStartOf c: C) -> MatchResult<Index, MatchData>
238226
where C.Index == Index, C.Element == Element
239-
// The following requirements go away with upcoming generics features
240-
, C.SubSequence : Collection
241227
{
242228
switch matchers.0.matched(atStartOf: c) {
243229
case .found(let end, let data):
@@ -292,8 +278,6 @@ struct MatchStaticString : Pattern {
292278

293279
func matched<C: Collection>(atStartOf c: C) -> MatchResult<Index, ()>
294280
where C.Index == Index, C.Element == Element
295-
// The following requirements go away with upcoming generics features
296-
, C.SubSequence : Collection
297281
{
298282
return content.withUTF8Buffer {
299283
LiteralMatch<Buffer, Index>($0).matched(atStartOf: c)
@@ -327,8 +311,7 @@ extension Pattern where Element == UTF8.CodeUnit {
327311
in c: C,
328312
format: (MatchData)->String = { String(reflecting: $0) })
329313
where C.Index == Index, C.Element == Element
330-
// The following requirements go away with upcoming generics features
331-
, C.SubSequence : Collection {
314+
{
332315
print("searching for /\(self)/ in \(c.u8str)...", terminator: "")
333316
if let (extent, data) = self.found(in: c) {
334317
print(
@@ -382,8 +365,6 @@ struct Paired<T: Hashable, I: Comparable> : Pattern {
382365

383366
func matched<C: Collection>(atStartOf c: C) -> MatchResult<Index, MatchData>
384367
where C.Index == Index, C.Element == Element
385-
// The following requirements go away with upcoming generics features
386-
, C.SubSequence : Collection
387368
{
388369
guard let closer = c.first.flatMap({ pairs[$0] }) else {
389370
return .notFound(resumeAt: nil)

0 commit comments

Comments
 (0)