steep icon indicating copy to clipboard operation
steep copied to clipboard

`nil` YARD annotation not recognized in arrays, hashes?

Open thomthom opened this issue 3 years ago • 1 comments

Is nil not always recognized by steep?

module Example

  # @return [nil]
  def self.hello
  end

  # @return [Array<Integer, nil>]
  def self.world
  end

end
[INFER] Assuming from filename you wish to generate in RBS format
[INFO ] Running YARD...
Could not locate Gemfile or .bundle/ directory
[WARN ] (Example.world) nil is probably not a type, but using anyway
[WARN ] (Example.world) nil wasn't able to be resolved to a constant in this project
[DONE ] Processed 3 objects (1 namespaces and 2 methods)
[WARN ] There were 2 important warnings in the output file, listed below.
[WARN ] The types which caused them have been replaced with SORD_ERROR_ constants.
[WARN ] Please edit the file to fix these errors.
[WARN ] Alternatively, edit your YARD documentation so that your types are valid and re-run Sord.
        (Example.world) nil is probably not a type, but using anyway
        (Example.world) nil wasn't able to be resolved to a constant in this project

Shouldn't nil always be resolved? The Boolean YARD meta type appear to have no problems.

module Example

  # @return [Boolean]
  def self.foo
  end

  # @return [Array<Integer, Boolean>]
  def self.bar
  end

end

thomthom avatar Jul 28 '22 09:07 thomthom

Hi @thomthom,

It looks like the issue is something related to sord. Could you ask it with the developer of sord? Let me know if there is anything Steep/RBS can help. https://github.com/AaronC81/sord

soutaro avatar Aug 08 '22 07:08 soutaro