Skip to content

[SR-1903] Method in TextCheckingResult conflicts with property #4561

Open
@swift-ci

Description

@swift-ci
Previous ID SR-1903
Radar None
Original Reporter rdemarest (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug, SDKOverlay
Assignee None
Priority Medium

md5: 9c19171050fa9a944374dfec0cf34d98

Issue Description:

In (NS)TextCheckingResult class we have a property named range:

public var range: NSRange { get }

but also a method named range:

public func range(at idx: Int) -> NSRange

The latter is due to the name translation from ObjC to Swift. This conflicts with the property, if you try to use the function like so:

if match.range(at: MatchGroup.localVariable).location != NSNotFound {

You get the follow error: "Cannot call value of non-function type 'NSRange' (aka '_NSRange')"

Because it thinks I'm trying to use the property rather than the method.

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