class Steep::Services::TypeCheckService::SourceFile

def self.no_data(path:, content:)

def self.no_data(path:, content:)
  new(path: path, content: content, node: false, errors: nil, typing: nil, ignores: nil)
end

def self.with_syntax_error(path:, content:, error:)

def self.with_syntax_error(path:, content:, error:)
  new(path: path, node: false, content: content, errors: [error], typing: nil, ignores: nil)
end

def self.with_typing(path:, content:, typing:, node:, ignores:)

def self.with_typing(path:, content:, typing:, node:, ignores:)
  new(path: path, node: node, content: content, errors: nil, typing: typing, ignores: ignores)
end

def diagnostics

def diagnostics
  case
  when errors
    errors
  when typing && ignores
    errors = [] #: Array[Diagnostic::Ruby::Base]
    errors.concat(
      typing.errors.delete_if do |diagnostic|
        case diagnostic.location
        when ::Parser::Source::Range
          ignores.ignore?(diagnostic.location.first_line, diagnostic.location.last_line, diagnostic.diagnostic_code)
        when RBS::Location
          ignores.ignore?(diagnostic.location.start_line, diagnostic.location.end_line, diagnostic.diagnostic_code)
        end
      end
    )
    ignores.error_ignores.each do |ignore|
      errors << Diagnostic::Ruby::InvalidIgnoreComment.new(comment: ignore.comment)
    end
    errors
  else
    []
  end
end

def initialize(path:, node:, content:, typing:, ignores:, errors:)

def initialize(path:, node:, content:, typing:, ignores:, errors:)
  @path = path
  @node = node
  @content = content
  @typing = typing
  @ignores = ignores
  @errors = errors
end

def update_content(content)

def update_content(content)
  self.class.new(
    path: path,
    content: content,
    node: node,
    errors: errors,
    typing: typing,
    ignores: ignores
  )
end