File tree Expand file tree Collapse file tree
ql/test/query-tests/unusedentities Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -672,33 +672,7 @@ fn translation_rules() -> Vec<Rule<SwiftContext>> {
672672 tree!( ( call_expr callee: { callee} argument: { args} ) )
673673 }
674674 ) ,
675- // A call or enum-case pattern argument. Both use the shared `argument`
676- // shape, preserving the optional label as `name` and the child as `value`.
677- // The pattern-only shapes (`patternExpr`, `discardAssignmentExpr`) are
678- // matched first; they never occur as ordinary call arguments.
679- rule!(
680- ( labeledExpr
681- label: _? @@lbl
682- expression: ( functionCallExpr
683- calledExpression: @constructor
684- arguments: _* @elements) )
685- =>
686- argument {
687- tree!( ( argument
688- name_node: ( identifier #{ lbl} ) ?
689- value: ( call_expr callee: { constructor} argument: { elements} ) ) )
690- }
691- ) ,
692- rule!(
693- ( labeledExpr label: _? @@lbl expression: ( patternExpr pattern: @p) )
694- =>
695- ( argument name_node: ( identifier #{ lbl} ) ? value: { p} )
696- ) ,
697- rule!(
698- ( labeledExpr label: _? @@lbl expression: ( discardAssignmentExpr) @@wildcard)
699- =>
700- ( argument name_node: ( identifier #{ lbl} ) ? value: ( identifier #{ wildcard} ) )
701- ) ,
675+ // A call or enum-case pattern argument.
702676 rule!(
703677 ( labeledExpr label: _? @@lbl expression: @val)
704678 =>
Original file line number Diff line number Diff line change 11| test.swift:2:9:2:9 | a | Unused local variable 'a' |
2- | test.swift:12:9:12:9 | a | Unused local variable 'a ' |
2+ | test.swift:16:13:16:13 | b | Unused local variable 'b ' |
Original file line number Diff line number Diff line change @@ -10,9 +10,9 @@ func t2() -> Int {
1010 return " df "
1111 }
1212 // Note: This currently fails because the trailing closure is not extracted correctly
13- let a = 1 // $ SPURIOUS: Alert
13+ let a = 1
1414 print ( foo ( ) { _ in
1515 print ( a)
16- let b = 2 // $ MISSING: Alert[unified/unused-variable]
16+ let b = 2 // $ Alert[unified/unused-variable]
1717 } )
1818}
You can’t perform that action at this time.
0 commit comments