-
Notifications
You must be signed in to change notification settings - Fork 697
Improve diagnostics for depracted Lock
.
#2285
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
Improve diagnostics for depracted Lock
.
#2285
Conversation
Motivation: When using a `Lock` instance handed by another library and calling `withLock` or `withLockVoid` on it, the compiler will issue an incorrect fix-it warning that `withLock` (or `withLockVoid`) was renamed to `NIOLock`. Modifications: The warning results from annotating the extension that adds `withLock` and `withLockVoid` with `@available(*, deprecated, renamed: "NIOLock")`. This removes the annotation and moves these two methods into the main declaration of `Lock`. Result: The fix-it warning no longer appears when using `withLock` or `withLockVoid`.
Can one of the admins verify this patch? |
10 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Hmm, @swift-server-bot seems to be a bit of an overachiever... 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a reasonable change to me.
@swift-server-bot test this please |
Improve diagnostics for depracted
Lock
.Motivation:
When using a
Lock
instance handed by another library and callingwithLock
orwithLockVoid
on it, the compiler will issue an incorrect fix-it warning thatwithLock
(orwithLockVoid
) was renamed toNIOLock
and by applying it will incorrectly change the method signature toNIOLock
.For example when using Vapor, there is a property called
locks
on Vapor'sApplication
class. Vapors hands out locks to users here. However, creating these locks isn't done by the users of Vapor, but by Vapor itself. Thus, users cannot fix the deprecation themselves.Modifications:
The warning results from annotating the extension that adds
withLock
andwithLockVoid
with@available(*, deprecated, renamed: "NIOLock")
. This removes the annotation and moves these two methods into the main declaration ofLock
.Result:
The fix-it warning no longer appears when using
withLock
orwithLockVoid
.