Skip to content

Commit

Permalink
renames
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Jun 18, 2024
1 parent 5f042b7 commit c9cacdd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/analyzers/jetanalyzer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1235,14 +1235,14 @@ const MODULE_SETFIELD_MSG = "cannot assign variables in other modules"
const DIVIDE_ERROR_MSG = sprint(showerror, DivideError())
@nospecs type_error_msg(f, expected, actual) =
lazy"TypeError: in $f, expected $expected, got a value of type $actual"
function nofield_msg(@nospecialize(typ), name::Symbol)
function field_error_msg(@nospecialize(typ), name::Symbol)
if typ <: Tuple
typ = Tuple # reproduce base error message
end
tname = nameof(typ::Union{DataType,UnionAll})
return lazy"type $tname has no field $name"
end
function boundserror_msg(@nospecialize(typ), name::Int)
function bounds_error_msg(@nospecialize(typ), name::Int)
return lazy"BoundsError: attempt to access $typ at index [$name]"
end

Expand Down Expand Up @@ -1299,9 +1299,9 @@ function report_fieldaccess!(analyzer::JETAnalyzer, sv::InferenceState, @nospeci
namev = (name::Const).val
objtyp = s00
if namev isa Symbol
msg = nofield_msg(objtyp, namev)
msg = field_error_msg(objtyp, namev)
elseif namev isa Int
msg = boundserror_msg(objtyp, namev)
msg = bounds_error_msg(objtyp, namev)
else
@assert false "invalid field analysis"
end
Expand Down
1 change: 0 additions & 1 deletion test/analyzers/test_jetanalyzer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,6 @@ end
struct NoFieldStruct; v; end
access_field(x::NoFieldStruct, sym) = getfield(x, sym)


@testset "TypoPass" begin
@test_call mode=:typo sum("julia") # don't report NoMethodError, etc.

Expand Down

0 comments on commit c9cacdd

Please sign in to comment.