Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-11307] .isAbsolutePath is available on String in Swift, not ObjC Foundation #3393

Open
compnerd opened this issue Aug 14, 2019 · 2 comments

Comments

@compnerd
Copy link
Collaborator

Previous ID SR-11307
Radar None
Original Reporter @compnerd
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: 2d04e5a2eb2c862d437d6e88592d3373

Issue Description:

import Foundation
func IsAbsolutePath(_ path: String) -> Bool {
  return path.isAbsolutePath
} 

This behaves differently across ObjC and Swift Foundation. The latter permits this, the former does not:

/Users/buildnode/jenkins/workspace/swift-package-manager-PR-osx-smoke-test/swiftpm/Sources/Basic/Path.swift:107:24: error: value of type 'String' has no member 'isAbsolutePath'
21:22:47             guard path.isAbsolutePath else {
21:22:47                   ~~~~ ^~~~~~~~~~~~~~
21:22:47 /Users/buildnode/jenkins/workspace/swift-package-manager-PR-osx-smoke-test/swiftpm/Sources/Basic/Path.swift:565:25: error: value of type 'String' has no member 'isAbsolutePath'
21:22:47     precondition(string.isAbsolutePath, "Failure normalizing \(string)")
21:22:47                  ~~~~~~ ^~~~~~~~~~~~~~ 
@compnerd
Copy link
Collaborator Author

CC: @millenomi

@spevans
Copy link
Collaborator

spevans commented Aug 18, 2019

isAbsolutePath is a method on NSString - see https://developer.apple.com/documentation/foundation/nsstring/1409068-isabsolutepath

This looks to be a dupe of https://bugs.swift.org/browse/SR-10916 in which swift on linux seems to auto bridge NSString methods to String and allows them to work

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants