rbs icon indicating copy to clipboard operation
rbs copied to clipboard

safe_dump function missing from Psych

Open rubin55 opened this issue 6 months ago • 3 comments

As experienced here: https://github.com/castwide/solargraph/issues/959

the safe_dump method is not found; According to a comment on the above issue, this is due to it missing from RBS; maybe other methods are also missing.

Could this be updated/fixed so all methods in Psych module are found/documented?

rubin55 avatar May 27 '25 14:05 rubin55

It’s a simple example, but I believe it can still serve as a useful reference. Since it includes internal methods as well, I don’t believe we need to provide all of them.

$ bundle exec rbs -r json -r psych prototype runtime --todo Psych
Generating prototypes with `--todo` option is experimental
module Psych
  def self.add_builtin_type: (untyped type_tag) { (*untyped) -> untyped } -> untyped

  def self.add_domain_type: (untyped domain, untyped type_tag) { (*untyped) -> untyped } -> untyped

  def self.add_tag: (untyped tag, untyped klass) -> untyped

  def self.config: () -> untyped

  def self.domain_types: (*untyped args, **untyped) { (*untyped) -> untyped } -> untyped

  def self.domain_types=: (*untyped args, **untyped) { (*untyped) -> untyped } -> untyped

  def self.dump_stream: (*untyped objects) -> untyped

  def self.dump_tags: (*untyped args, **untyped) { (*untyped) -> untyped } -> untyped

  def self.dump_tags=: (*untyped args, **untyped) { (*untyped) -> untyped } -> untyped

  def self.libyaml_version: () -> untyped

  def self.load_stream: (untyped yaml, ?filename: untyped, ?fallback: untyped, **untyped) -> untyped

  def self.load_tags: (*untyped args, **untyped) { (*untyped) -> untyped } -> untyped

  def self.load_tags=: (*untyped args, **untyped) { (*untyped) -> untyped } -> untyped

  def self.parse: (untyped yaml, ?filename: untyped) -> untyped

  def self.parse_file: (untyped filename, ?fallback: untyped) -> untyped

  def self.parse_stream: (untyped yaml, ?filename: untyped) { (*untyped) -> untyped } -> untyped

  def self.parser: () -> untyped

  def self.remove_type: (untyped type_tag) -> untyped

  def self.safe_dump: (untyped o, ?untyped io, ?untyped options) -> untyped

  def self.safe_load_file: (untyped filename, **untyped) -> untyped

  def self.unsafe_load_file: (untyped filename, **untyped) -> untyped

  LIBYAML_VERSION: ::String

  LOADER_VERSION: ::String

  VERSION: ::String
end

ksss avatar May 27 '25 15:05 ksss

@ksss does the above output signify that it should work? When I run that command locally, I get the same output as you, including the safe_dump function.. Or does this mean: "here is a list of things we haven't done yet, no types for you!"

rubin55 avatar May 27 '25 15:05 rubin55

This is a list of methods that have Ruby methods but no types provided yet. They are shown as prototypes so that types can be added immediately.

ksss avatar May 28 '25 01:05 ksss