From c9cacdddc67deb667db98e64fa827237fc546cfa Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki Date: Tue, 18 Jun 2024 14:46:22 +0900 Subject: [PATCH] renames --- src/analyzers/jetanalyzer.jl | 8 ++++---- test/analyzers/test_jetanalyzer.jl | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/analyzers/jetanalyzer.jl b/src/analyzers/jetanalyzer.jl index a096dd075..4ea04689b 100644 --- a/src/analyzers/jetanalyzer.jl +++ b/src/analyzers/jetanalyzer.jl @@ -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 @@ -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 diff --git a/test/analyzers/test_jetanalyzer.jl b/test/analyzers/test_jetanalyzer.jl index 00fdb08f8..7665374e3 100644 --- a/test/analyzers/test_jetanalyzer.jl +++ b/test/analyzers/test_jetanalyzer.jl @@ -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.