module T::Private::Methods::CallValidation

def self.report_error(method_sig, error_message, kind, name, type, value, caller_offset: 0)

def self.report_error(method_sig, error_message, kind, name, type, value, caller_offset: 0)
  caller_loc = T.must(caller_locations(3 + caller_offset, 1))[0]
  definition_file, definition_line = method_sig.method.source_location
  pretty_message = "#{kind}#{name ? " '#{name}'" : ''}: #{error_message}\n" \
    "Caller: #{caller_loc.path}:#{caller_loc.lineno}\n" \
    "Definition: #{definition_file}:#{definition_line}"
  T::Configuration.call_validation_error_handler(
    method_sig,
    message: error_message,
    pretty_message: pretty_message,
    kind: kind,
    name: name,
    type: type,
    value: value,
    location: caller_loc
  )
end