@@ -187,7 +187,7 @@ f(arg) = arg
187187 @test StaticLint. CoreTypes. ismodule (bindingof (parse_and_pass (" module A end" ). args[1 ]). type)
188188 @test StaticLint. CoreTypes. ismodule (bindingof (parse_and_pass (" baremodule A end" ). args[1 ]). type)
189189
190- # @test parse_and_pass("function f(x::Int) x end")[1][2][3].binding.t == StaticLint.getsymbolserver(server)["Core"].vals["Function"]
190+ # @test parse_and_pass("function f(x::Int) x end")[1][2][3].binding.t == StaticLint.getsymbolserver(server)["Core"].vals["Function"]
191191 let cst = parse_and_pass ("""
192192 struct T end
193193 function f(x::T) x end
@@ -251,9 +251,9 @@ f(arg) = arg
251251 end
252252
253253 let cst = parse_and_pass ("""
254- macro mac_str() end
255- mac"whatever"
256- """ )
254+ macro mac_str() end
255+ mac"whatever"
256+ """ )
257257 @test refof (cst. args[2 ]. args[1 ]) == bindingof (cst. args[1 ])
258258 end
259259
@@ -266,50 +266,50 @@ f(arg) = arg
266266 end
267267
268268 let cst = parse_and_pass ("""
269- module Reparse
270- end
271- using .Reparse, CSTParser
272- """ )
269+ module Reparse
270+ end
271+ using .Reparse, CSTParser
272+ """ )
273273 @test refof (cst. args[2 ]. args[1 ]. args[2 ]). val == bindingof (cst[1 ])
274274 end
275275
276276 let cst = parse_and_pass ("""
277- module A
278- A
279- end
280- """ )
277+ module A
278+ A
279+ end
280+ """ )
281281 @test scopeof (cst). names[" A" ] == scopeof (cst. args[1 ]). names[" A" ]
282282 @test refof (cst. args[1 ]. args[2 ]) == bindingof (cst. args[1 ])
283283 @test refof (cst. args[1 ]. args[3 ]. args[1 ]) == bindingof (cst. args[1 ])
284284 end
285- # let cst = parse_and_pass("""
286- # using Test: @test
287- # """)
288- # @test bindingof(cst[1][4]) !== nothing
289- # end
285+ # let cst = parse_and_pass("""
286+ # using Test: @test
287+ # """)
288+ # @test bindingof(cst[1][4]) !== nothing
289+ # end
290290 let cst = parse_and_pass ("""
291- sin(1,2,3)
292- """ )
291+ sin(1,2,3)
292+ """ )
293293 @test errorof (cst. args[1 ]) === StaticLint. IncorrectCallArgs
294294 end
295295 let cst = parse_and_pass ("""
296- for i in length(1) end
297- for i in 1.1 end
298- for i in 1 end
299- for i in 1:1 end
300- """ )
296+ for i in length(1) end
297+ for i in 1.1 end
298+ for i in 1 end
299+ for i in 1:1 end
300+ """ )
301301 @test errorof (cst. args[1 ]. args[1 ]) === StaticLint. IncorrectIterSpec
302302 @test errorof (cst. args[2 ]. args[1 ]) === StaticLint. IncorrectIterSpec
303303 @test errorof (cst. args[3 ]. args[1 ]) === StaticLint. IncorrectIterSpec
304304 @test errorof (cst. args[4 ]. args[1 ]) === nothing
305305 end
306306
307307 let cst = parse_and_pass ("""
308- [i for i in length(1) end]
309- [i for i in 1.1 end]
310- [i for i in 1 end]
311- [i for i in 1:1 end]
312- """ )
308+ [i for i in length(1) end]
309+ [i for i in 1.1 end]
310+ [i for i in 1 end]
311+ [i for i in 1:1 end]
312+ """ )
313313 @test errorof (cst[1 ][2 ][3 ]) === StaticLint. IncorrectIterSpec
314314 @test errorof (cst[2 ][2 ][3 ]) === StaticLint. IncorrectIterSpec
315315 @test errorof (cst[3 ][2 ][3 ]) === StaticLint. IncorrectIterSpec
@@ -324,24 +324,24 @@ f(arg) = arg
324324 end
325325
326326 let cst = parse_and_pass ("""
327- struct Graph
328- children:: T
329- end
327+ struct Graph
328+ children:: T
329+ end
330330
331- function test()
332- g = Graph()
333- f = g.children
334- end""" )
331+ function test()
332+ g = Graph()
333+ f = g.children
334+ end""" )
335335 @test cst. args[2 ]. args[2 ]. args[2 ]. args[2 ]. args[2 ]. args[1 ] in bindingof (cst. args[1 ]. args[3 ]. args[1 ]). refs
336336 end
337337
338338 let cst = parse_and_pass ("""
339- __source__
340- __module__
341- macro m()
342- __source__
343- __module__
344- end""" )
339+ __source__
340+ __module__
341+ macro m()
342+ __source__
343+ __module__
344+ end""" )
345345 @test refof (cst[1 ]) === nothing
346346 @test refof (cst[2 ]) === nothing
347347 @test refof (cst[3 ][3 ][1 ]) != = nothing
@@ -1371,9 +1371,13 @@ f(arg) = arg
13711371 @testset " issue 1609" begin
13721372 let
13731373 cst1 = parse_and_pass (" function g(@nospecialize(x), y) x + y end" )
1374- cst2 = parse_and_pass (" function g(@nospecialize(x), y) y end" )
1374+ cst2 = parse_and_pass (" function g(@nospecialize(x) = 1) x end" )
1375+ cst3 = parse_and_pass (" function g(@nospecialize(x) = 1, y = 2) x + y end" )
1376+ cst4 = parse_and_pass (" function g(@nospecialize(x), y) y end" )
13751377 @test ! StaticLint. haserror (cst1. args[1 ]. args[1 ]. args[2 ]. args[3 ])
1376- @test StaticLint. haserror (cst2. args[1 ]. args[1 ]. args[2 ]. args[3 ])
1378+ @test ! StaticLint. haserror (cst2. args[1 ]. args[1 ]. args[2 ]. args[1 ])
1379+ @test ! StaticLint. haserror (cst3. args[1 ]. args[1 ]. args[2 ]. args[1 ])
1380+ @test StaticLint. haserror (cst4. args[1 ]. args[1 ]. args[2 ]. args[3 ])
13771381 end
13781382 end
13791383
0 commit comments