From 2eb15269f99a1bb092a22abee9ec234ebde3c1fb Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Tue, 28 Nov 2023 09:45:13 -0500 Subject: [PATCH] Improve UnusedTypeDefinition replacement --- src/analyzer/expr/call/arguments_analyzer.rs | 9 ++++++++- src/file_scanner_analyzer/unused_symbols.rs | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/analyzer/expr/call/arguments_analyzer.rs b/src/analyzer/expr/call/arguments_analyzer.rs index 52a9e6ca..8b82f260 100644 --- a/src/analyzer/expr/call/arguments_analyzer.rs +++ b/src/analyzer/expr/call/arguments_analyzer.rs @@ -133,7 +133,14 @@ pub(crate) fn check_arguments_match( method_call_info = Some(MethodCallInfo { self_fq_classlike_name, declaring_method_id: Some(declaring_method_id), - classlike_storage: class_storage.unwrap(), + classlike_storage: if let Some(class_storage) = class_storage { + class_storage + } else { + return Err(AnalysisError::InternalError( + "Class storage does not exist".to_string(), + statements_analyzer.get_hpos(function_call_pos), + )); + }, }); } diff --git a/src/file_scanner_analyzer/unused_symbols.rs b/src/file_scanner_analyzer/unused_symbols.rs index 250eb87b..7a1e8566 100644 --- a/src/file_scanner_analyzer/unused_symbols.rs +++ b/src/file_scanner_analyzer/unused_symbols.rs @@ -414,8 +414,8 @@ pub(crate) fn find_unused_definitions( ); if config - .migration_symbols - .contains_key(interner.lookup(type_name)) + .issues_to_fix + .contains(&IssueKind::UnusedTypeDefinition) { analysis_result .replacements