Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a "flat" formatting option #11

Open
AaronC81 opened this issue Jul 6, 2019 · 2 comments
Open

Add a "flat" formatting option #11

AaronC81 opened this issue Jul 6, 2019 · 2 comments

Comments

@AaronC81
Copy link
Owner

AaronC81 commented Jul 6, 2019

@manhhung741 suggested this on the original Sord RFC for this project, and I think it's a good option to have. If this option is set, then generate this style:

module A
end

class A::B
end

Rather than this:

module A
  class B
  end
end
@dorner
Copy link

dorner commented Jul 21, 2023

Bumping this - this is more than an option, this needs to be the new output format. RBI has serious trouble parsing the current format and being able to match constants.

@dorner
Copy link

dorner commented Jul 21, 2023

For example, this RBI output by Parlour:

module Deimos
  class BatchRecordList
    sig { params(records: T::Array[BatchRecord]).void }
    def initialize(records); end
    end
end

module Deimos
  class BatchRecord
  end
end

RBI will complain that it can't find BatchRecord even though it shares the same parent module, because when Tapioca reads the rbi files of the gems, it flattens them into the A::B format. This makes this nested lookup flat out not work.

In other words, when Sord outputs this code, everything looks fine, but when processed by Tapioca in a downstream project it starts failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants