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-11478] Using a static var with a property wrapper in a class leads to a wrong error message #53878
Comments
We should also consider whether writing |
The error would make sense then and match the current behavior when writing private static var _bool = Wrap(wrappedValue: true)
static var bool: Bool { return _bool.wrappedValue } with above's version using |
Just to be clear - is the bug that we're generating the wrong diagnostic or that we're generating a diagnostic instead of allowing it to compile? At the moment, we're calling to |
We shouldn't generate any diagnostic at all in the |
I totally forgot that we can use static wrappers (duh!!). Here's a fix: #27198 |
Right, but at that point we have the question about how |
With my patch, it mimics the original property (and context):
|
Wow, that was quick, thank you @theblixguy! |
You'll get an error -the backing variable is using the same static spelling as the original variable. |
Ah, my bad. I thought that |
Fixed on master. Please verify using the next available master snapshot! |
@swift-ci create |
Attachment: Download
Environment
Happens with Xcode 11 GM as well as the current master build.
GM:
Master Toolchain:
Additional Detail from JIRA
md5: 58900d576f93e36844162e5b8dc424cc
is duplicated by:
Issue Description:
The following code leads to an error message, that is wrong in this context. I assume that the generated wrapper var (the one with the underline prefix) is generated as
class var
instead ofstatic var
even though the wrapped variable definition isstatic
:Error that results from this code:
The text was updated successfully, but these errors were encountered: