class T::Private::Methods::DeclBuilder

def final(&blk)

def final(&blk)
  check_live!
  if !decl.final.equal?(ARG_NOT_PROVIDED)
    raise BuilderError.new("You can't call .final multiple times in a signature.")
  end
  if @inside_sig_block
    raise BuilderError.new(
      "Unlike other sig annotations, the `final` annotation must remain outside the sig block, " \
      "using either `sig(:final) {...}` or `sig.final {...}`, not `sig {final. ...}"
    )
  end
  raise BuilderError.new(".final cannot be repeated in a single signature") if final?
  decl.final = true
  check_sig_block_is_unset!
  if blk
    T::Private::DeclState.current.active_declaration.blk = blk
  end
  self
end