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

allow #file to #filePath forwarding without warnings #32445

Closed
wants to merge 1 commit into from

Conversation

weissi
Copy link
Contributor

@weissi weissi commented Jun 18, 2020

Motivation

As of master/5.3 branch, #file == #filePath. However, libraries will switch to defaulting file parameters to #filePath and some already have. Unfortunately, before this patch forwarding #file to a parameter defaulted to #filePath will issue a warning.

The warning suggests a way to silence the warning (using an extra set of parenthesis file: (#file)) but unfortunately, this forwarding does not actually work. You will get the #file from where the ((#file)) has been written and not the callee's #file.

For all packages that do SemVer (ie. lots of them) we need to retain compatibility with Swift versions prior to 5.3 so we cannot just adopt #filePath. I documented the various serious problems and concerns with the current implementation in the following three issues.

This patch switches this particular warning (#file to #filePath) off. And if none of the other issues above are fixed independently, this needs to go into Swift 5.3.

@weissi weissi requested review from tomerd, beccadax and tkremenek June 18, 2020 11:18
@weissi
Copy link
Contributor Author

weissi commented Jun 18, 2020

@swift-ci smoke test

weissi added a commit to weissi/swift-nio that referenced this pull request Jun 18, 2020
Motivation:

only works if done when _calling_ a function, not when defining one :|.

- swiftlang/swift#32445
- https://bugs.swift.org/browse/SR-12936
- https://bugs.swift.org/browse/SR-12934
- https://bugs.swift.org/browse/SR-13041

Modifications:

Silence #file to #filePath differently.

Result:

Hopefully at some point we get this working.
weissi added a commit to weissi/swift-nio that referenced this pull request Jun 18, 2020
Motivation:

only works if done when _calling_ a function, not when defining one :|.

- swiftlang/swift#32445
- https://bugs.swift.org/browse/SR-12936
- https://bugs.swift.org/browse/SR-12934
- https://bugs.swift.org/browse/SR-13041

Modifications:

Silence #file to #filePath differently.

Result:

Hopefully at some point we get this working.
weissi added a commit to weissi/swift-log that referenced this pull request Jun 18, 2020
Motivation:

only works if done when _calling_ a function, not when defining one :|.

- swiftlang/swift#32445
- https://bugs.swift.org/browse/SR-12936
- https://bugs.swift.org/browse/SR-12934
- https://bugs.swift.org/browse/SR-13041

Modifications:

Silence #file to #filePath differently.

Result:

Hopefully at some point we get this working.
weissi added a commit to weissi/swift-nio-http2 that referenced this pull request Jun 18, 2020
Motivation:

only works if done when _calling_ a function, not when defining one :|.

- swiftlang/swift#32445
- https://bugs.swift.org/browse/SR-12936
- https://bugs.swift.org/browse/SR-12934
- https://bugs.swift.org/browse/SR-13041

Modifications:

Silence #file to #filePath differently.

Result:

Hopefully at some point we get this working.
weissi added a commit to weissi/swift-nio-transport-services that referenced this pull request Jun 18, 2020
Motivation:

only works if done when _calling_ a function, not when defining one :|.

- swiftlang/swift#32445
- https://bugs.swift.org/browse/SR-12936
- https://bugs.swift.org/browse/SR-12934
- https://bugs.swift.org/browse/SR-13041

Modifications:

Silence #file to #filePath differently.

Result:

Hopefully at some point we get this working.
weissi added a commit to weissi/swift-nio that referenced this pull request Jun 18, 2020
Motivation:

only works if done when _calling_ a function, not when defining one :|.

- swiftlang/swift#32445
- https://bugs.swift.org/browse/SR-12936
- https://bugs.swift.org/browse/SR-12934
- https://bugs.swift.org/browse/SR-13041

Modifications:

Silence #file to #filePath differently.

Result:

Hopefully at some point we get this working.
Lukasa pushed a commit to apple/swift-nio-http2 that referenced this pull request Jun 18, 2020
Motivation:

only works if done when _calling_ a function, not when defining one :|.

- swiftlang/swift#32445
- https://bugs.swift.org/browse/SR-12936
- https://bugs.swift.org/browse/SR-12934
- https://bugs.swift.org/browse/SR-13041

Modifications:

Silence #file to #filePath differently.

Result:

Hopefully at some point we get this working.
Lukasa pushed a commit to apple/swift-nio-transport-services that referenced this pull request Jun 18, 2020
Motivation:

only works if done when _calling_ a function, not when defining one :|.

- swiftlang/swift#32445
- https://bugs.swift.org/browse/SR-12936
- https://bugs.swift.org/browse/SR-12934
- https://bugs.swift.org/browse/SR-13041

Modifications:

Silence #file to #filePath differently.

Result:

Hopefully at some point we get this working.
weissi added a commit to apple/swift-nio that referenced this pull request Jun 18, 2020
Motivation:

only works if done when _calling_ a function, not when defining one :|.

- swiftlang/swift#32445
- https://bugs.swift.org/browse/SR-12936
- https://bugs.swift.org/browse/SR-12934
- https://bugs.swift.org/browse/SR-13041

Modifications:

Silence #file to #filePath differently.

Result:

Hopefully at some point we get this working.
weissi added a commit to apple/swift-log that referenced this pull request Jun 22, 2020
Motivation:

only works if done when _calling_ a function, not when defining one :|.

- swiftlang/swift#32445
- https://bugs.swift.org/browse/SR-12936
- https://bugs.swift.org/browse/SR-12934
- https://bugs.swift.org/browse/SR-13041

Modifications:

Silence #file to #filePath differently.

Result:

Hopefully at some point we get this working.
glbrntt added a commit to glbrntt/swift-nio-ssl that referenced this pull request Jun 30, 2020
Motivation:

Swift 5.3 warns when `#file` is passed to a function expecting
`#filePath` even though the values are currently the same.

- swiftlang/swift#32445
- https://bugs.swift.org/browse/SR-12936
- https://bugs.swift.org/browse/SR-12934
- https://bugs.swift.org/browse/SR-13041

Modifications:

- Wrap `file` in parentheses to silence warnings.

Result:

- No warnings, uglier code
Lukasa pushed a commit to apple/swift-nio-ssl that referenced this pull request Jun 30, 2020
Motivation:

Swift 5.3 warns when `#file` is passed to a function expecting
`#filePath` even though the values are currently the same.

- swiftlang/swift#32445
- https://bugs.swift.org/browse/SR-12936
- https://bugs.swift.org/browse/SR-12934
- https://bugs.swift.org/browse/SR-13041

Modifications:

- Wrap `file` in parentheses to silence warnings.

Result:

- No warnings, uglier code
golang4gg pushed a commit to golang4gg/swift-log that referenced this pull request Jul 4, 2020
Motivation:

only works if done when _calling_ a function, not when defining one :|.

- swiftlang/swift#32445
- https://bugs.swift.org/browse/SR-12936
- https://bugs.swift.org/browse/SR-12934
- https://bugs.swift.org/browse/SR-13041

Modifications:

Silence #file to #filePath differently.

Result:

Hopefully at some point we get this working.
@shahmishal
Copy link
Member

Please update the base branch to main by Oct 5th otherwise the pull request will be closed automatically.

  • How to change the base branch: (Link)
  • More detail about the branch update: (Link)

@shahmishal shahmishal closed this Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants