Skip to content

Commit 1ba69d5

Browse files
authored
improve type stability of Command(statement::Statement) (#3200)
I improved type stability to fix some invalidations. This is based on the following code: ```julia julia> using Pkg; Pkg.activate(temp=true); Pkg.add("ArrayInterface") julia> using SnoopCompileCore; invalidations = @Snoopr(using ArrayInterface); using SnoopCompile julia> trees = invalidation_trees(invalidations) ... inserting !(::Static.False) in Static at ~/.julia/packages/Static/sVI3g/src/Static.jl:427 invalidated: ... ``` The problem here is that `arguments` is only inferred as `Any`. I do not know whether we can assert something better (which may also fix the invalidations).
1 parent e5bb3dd commit 1ba69d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/REPLMode/REPLMode.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ function Command(statement::Statement)::Command
365365
# arguments
366366
arg_spec = statement.spec.argument_spec
367367
arguments = arg_spec.parser(statement.arguments, options)
368-
if !(arg_spec.count.first <= length(arguments) <= arg_spec.count.second)
368+
if !((arg_spec.count.first <= length(arguments) <= arg_spec.count.second)::Bool)
369369
pkgerror("Wrong number of arguments")
370370
end
371371
return Command(statement.spec, options, arguments)

0 commit comments

Comments
 (0)