File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 16
16
function lookup_expr (frame, e:: Expr )
17
17
head = e. head
18
18
head == :the_exception && return frame. framedata. last_exception[]
19
- head == :static_parameter && return frame. framedata. sparams[e. args[1 ]:: Int ]
19
+ if head == :static_parameter
20
+ arg = e. args[1 ]:: Int
21
+ if isassigned (frame. framedata. sparams, arg)
22
+ return frame. framedata. sparams[arg]
23
+ else
24
+ syms = sparam_syms (frame. framecode. scope)
25
+ throw (UndefVarError (syms[arg]))
26
+ end
27
+ end
20
28
head == :boundscheck && length (e. args) == 0 && return true
21
29
error (" invalid lookup expr " , e)
22
30
end
Original file line number Diff line number Diff line change @@ -401,3 +401,15 @@ file, line = JuliaInterpreter.whereis(fr)
401
401
@test isfile (file)
402
402
@test isfile (JuliaInterpreter. getfile (fr. framecode. src. linetable[1 ]))
403
403
@test occursin (Sys. STDLIB, repr (fr))
404
+
405
+ # Test undef sparam (https://github.com/JuliaDebug/JuliaInterpreter.jl/issues/165)
406
+ function foo (x:: T ) where {T <: AbstractString , S <: AbstractString }
407
+ return S
408
+ end
409
+ e = try
410
+ @interpret foo (" " )
411
+ catch err
412
+ err
413
+ end
414
+ @test e isa UndefVarError
415
+ @test e. var == :S
You can’t perform that action at this time.
0 commit comments