Skip to content

[SR-14779] Closure in NSRegularExpression.enumerateMatches is marked as "@escaping" when it shouldn't be. #3957

Open
@swift-ci

Description

@swift-ci
Previous ID SR-14779
Radar rdar://problem/79401146
Original Reporter GalenRhodes1967 (JIRA User)
Type Bug
Environment

Open source version of Swift up to and including version 5.5.

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: e1a8415d7b9bb1ee1ec4da64bde2c3bc

Issue Description:

In the open source version of Swift the closure in the method NSRegularExpression.enumerateMatches(in:options:range:using) is marked as "@escaping" when it shouldn't be. The macOS version of Swift does not have this. Besides creating a discontinuity between the Apple version of Swift and the open source version of Swift it keeps you from doing some things that you could if the closure was not marked as "@escaping".

Since this method is NOT asynchronous I don't see why it is marked as escaping.

public func enumerateMatches(in string: String, options: NSRegularExpression.MatchingOptions = [], range: NSRange, using block: @escaping (NSTextCheckingResult?, NSRegularExpression.MatchingFlags, UnsafeMutablePointer<ObjCBool>) -> Swift.Void)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions