File tree Expand file tree Collapse file tree
lib/codeql/unified/internal
test/library-tests/local-name-binding Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -203,8 +203,17 @@ private module LocalNameBindingInput implements LocalNameBindingInputSig<Locatio
203203 declaration = func
204204 )
205205 or
206- exists ( Parameter param |
207- scope = param .getDeclaringCallable ( ) and
206+ exists ( Parameter param , Callable callable |
207+ callable = param .getDeclaringCallable ( ) and
208+ (
209+ // Scope to the body so parameter defaults cannot see the parameter list
210+ // TODO: Use a plugin for languages where parameter defaults can reference earlier parameters
211+ scope = callable .getBody ( )
212+ or
213+ // For bodyless functions, choose an arbitrary scope
214+ not exists ( callable .getBody ( ) ) and
215+ scope = param
216+ ) and
208217 pattern = param .getPattern ( ) and
209218 declaration = param
210219 )
Original file line number Diff line number Diff line change @@ -397,9 +397,9 @@ func t41() {
397397 // This function and its parameter have the same name
398398 // The parameter default value must resolve to the outer name (the function)
399399 // swift-format-ignore
400- func foo ( // name=foo1
400+ func foo ( // $ captured=foo1 // name=foo1
401401 _ foo : Any = // name=foo2
402- foo // $ MISSING: access=foo1 SPURIOUS: access=foo2
402+ foo // $ access=foo1
403403 ) {
404404 foo // $ access=foo2
405405 }
You can’t perform that action at this time.
0 commit comments