-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Force Unwrapping false positive #977
Labels
bug
Unexpected and reproducible misbehavior.
Comments
I'm currently using version 0.13.2 Please make sure to define the variable inside a function or method. For example:
The |
I was able to reproduce it on |
Sorry, moved my test files but not the config! Can now reproduce the issue. |
I think this is actually a consequence of #136. $ sourcekitten structure --text "func foo() { var x: [Int]! }"
{
"key.substructure" : [
{
"key.kind" : "source.lang.swift.decl.function.free",
"key.offset" : 0,
"key.nameoffset" : 5,
"key.namelength" : 5,
"key.bodyoffset" : 12,
"key.bodylength" : 15,
"key.accessibility" : "source.lang.swift.accessibility.internal",
"key.length" : 28,
"key.name" : "foo()"
}
],
"key.offset" : 0,
"key.diagnostic_stage" : "source.diagnostic.stage.swift.parse",
"key.length" : 28
} |
otaviolima
added a commit
to otaviolima/SwiftLint
that referenced
this issue
May 29, 2017
otaviolima
added a commit
to otaviolima/SwiftLint
that referenced
this issue
May 29, 2017
otaviolima
added a commit
to otaviolima/SwiftLint
that referenced
this issue
May 29, 2017
otaviolima
added a commit
to otaviolima/SwiftLint
that referenced
this issue
May 29, 2017
otaviolima
added a commit
to otaviolima/SwiftLint
that referenced
this issue
May 29, 2017
otaviolima
added a commit
to otaviolima/SwiftLint
that referenced
this issue
May 29, 2017
Fixed in #1620. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Declaring a local variable inside a function
var a: [Int]!
is considered force_unwrapping violation. But we are just defining an implicitly unwrapped optional and not force unwrapping it. Seems it is a false positive. It only occurs for Array type and not plain types. e.g.
var a: Int!
is not considered rule violation.The text was updated successfully, but these errors were encountered: