Skip to content

Commit b2925cc

Browse files
committed
fix bunch of type instabilities and logic errors
1 parent d603d62 commit b2925cc

File tree

8 files changed

+11
-9
lines changed

8 files changed

+11
-9
lines changed

src/analysis/full-analysis.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ function lookup_analysis_entry(state::ServerState, uri::URI)
329329
end
330330

331331
pkgname = find_pkg_name(env_path)
332+
if isnothing(pkgname)
333+
return ScriptInEnvAnalysisEntry(env_path, uri)
334+
end
332335
filepath = uri2filepath(uri)::String # uri.scheme === "file"
333336
filekind, filedir = find_package_directory(filepath, env_path)
334337
if filekind === :src

src/config.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ struct ConfigChange
164164
path::String
165165
old_val
166166
new_val
167-
ConfigChange(path::String, @nospecialize(old_val), @nospecialize(new_val)) = new(path, old_val, new_val)
167+
ConfigChange(path::AbstractString, @nospecialize(old_val), @nospecialize(new_val)) = new(path, old_val, new_val)
168168
end
169169

170170
mutable struct ConfigChangeTracker

src/diagnostics.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,8 @@ function inference_error_report_code(@nospecialize report::JET.InferenceErrorRep
345345
else
346346
return INFERENCE_UNDEF_LOCAL_VAR_CODE
347347
end
348-
else
349-
return nothing
350348
end
349+
error(lazy"Diagnostic code is not defined for this report: $report")
351350
end
352351

353352
function jet_frame_to_location(frame)

src/did-change-watched-files.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ end
118118
function handle_DidChangeWatchedFilesNotification(server::Server, msg::DidChangeWatchedFilesNotification)
119119
for change in msg.params.changes
120120
changed_path = uri2filepath(change.uri)
121-
if is_config_file(changed_path)
121+
if changed_path !== nothing && is_config_file(changed_path)
122122
handle_config_file_change!(server, changed_path, change.type)
123123
end
124124
end

src/signature-help.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ end
262262
# active_arg is either an argument index, or :next (available pos. arg), or :none
263263
function make_siginfo(m::Method, ca::CallArgs, active_arg::Union{Int, Symbol};
264264
postprocessor::LSPostProcessor = LSPostProcessor())
265-
msig = get_sig_str(m, ca)
265+
msig = @something get_sig_str(m, ca)
266266
msig = postprocessor(msig)
267267
mnode = JS.parsestmt(JL.SyntaxTree, msig; ignore_errors=true)
268268
label = String(msig)

src/types.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ end
430430

431431
is_static_setting(path::Symbol...) =
432432
is_static_setting(JETLSConfig, path...)
433-
433+
is_static_setting(::Type{<:ConfigSection}) = false
434434
is_static_setting(::Type{T}, head::Symbol, rest::Symbol...) where {T<:ConfigSection} =
435435
is_static_setting(_unwrap_maybe(fieldtype(T, head)), rest...)
436436

src/utils/ast.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ function _without_kinds(st::JL.SyntaxTree, kinds::Tuple{Vararg{JS.Kind}})
2626
end
2727

2828
function without_kinds(st::JL.SyntaxTree, kinds::Tuple{Vararg{JS.Kind}})
29-
return JS.kind(st) in kinds ?
29+
return (JS.kind(st) in kinds ?
3030
JL.@ast(JL.syntax_graph(st), st, [JS.K"TOMBSTONE"]) :
31-
_without_kinds(st, kinds)[1]
31+
_without_kinds(st, kinds)[1])::JL.SyntaxTree
3232
end
3333

3434
function _remove_macrocalls(st::JL.SyntaxTree)

src/utils/general.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ function install_instruction_message(app::AbstractString, instruction_url::Abstr
189189
"""
190190
end
191191

192-
function check_settings_message(setting_path::String...)
192+
function check_settings_message(setting_path::Symbol...)
193193
"""
194194
This value is configured in the `$(join(setting_path, "."))`.
195195
Please check the settings.

0 commit comments

Comments
 (0)