Shopify/tapioca

v0.13.0 - Parsing errors

alex-tan opened this issue · 2 comments

##### INTERNAL ERROR #####

There are parse errors in the generated RBI files.

This seems related to a bug in Tapioca.
Please open an issue at https://github.com/Shopify/tapioca/issues/new with the following information:

Tapioca v0.13.0

Command:
  bin/tapioca dsl 

Compilers:
  Tapioca::Compilers::ReadModelFactories
  Tapioca::Dsl::Compilers::ActionControllerHelpers
  Tapioca::Dsl::Compilers::ActionMailer
  Tapioca::Dsl::Compilers::ActionText
  Tapioca::Dsl::Compilers::ActiveAdminControllers
  Tapioca::Dsl::Compilers::ActiveJob
  Tapioca::Dsl::Compilers::ActiveModelAttributes
  Tapioca::Dsl::Compilers::ActiveModelSecurePassword
  Tapioca::Dsl::Compilers::ActiveModelValidationsConfirmation
  Tapioca::Dsl::Compilers::ActiveRecordAssociations
  Tapioca::Dsl::Compilers::ActiveRecordColumns
  Tapioca::Dsl::Compilers::ActiveRecordDelegatedTypes
  Tapioca::Dsl::Compilers::ActiveRecordEnum
  Tapioca::Dsl::Compilers::ActiveRecordFixtures
  Tapioca::Dsl::Compilers::ActiveRecordRelations
  Tapioca::Dsl::Compilers::ActiveRecordScope
  Tapioca::Dsl::Compilers::ActiveRecordSecureToken
  Tapioca::Dsl::Compilers::ActiveRecordStore
  Tapioca::Dsl::Compilers::ActiveSupportConcern
  Tapioca::Dsl::Compilers::ActiveSupportCurrentAttributes
  Tapioca::Dsl::Compilers::JobConfigurable
  Tapioca::Dsl::Compilers::MixedInClassAttributes
  Tapioca::Dsl::Compilers::RailsGenerators
  Tapioca::Dsl::Compilers::UrlHelpers

Errors:
  sorbet/rbi/dsl/[model_name].rbi:94: unexpected token ")" (2001)

##########################

The error seems to be coming from this bit of generated code within [Model]::CommonRelationMethods where there's a double signature:

    sig do
      params(
        args: T.any(String, Symbol, ::ActiveSupport::Multibyte::Chars, T::Boolean, BigDecimal, Numeric, ::ActiveRecord::Type::Binary::Data, ::ActiveRecord::Type::Time::Value, Date, Time, ::ActiveSupport::Duration, T::Class[T.anything])
      ).returns(::ModelName)
    end
    sig do
      params(
        args: T::Array[T::Array[T.any(String, Symbol, ::ActiveSupport::Multibyte::Chars, T::Boolean, BigDecimal, Numeric, ::ActiveRecord::Type::Binary::Data, ::ActiveRecord::Type::Time::Value, Date, Time, ::ActiveSupport::Duration, T::Class[T.anything])]
      ).returns(T::Enumerable[::ModelName])
    end
    def find(args); end

Hey @alex-tan,

Thanks for the report. I pushed a fix to #1843, do you mind trying it out?

Thanks! 🙏

@Morriar yes thanks! dsl generates without any errors now.