Skip to content

Commit

Permalink
Merge pull request #178 from ksss/quoted
Browse files Browse the repository at this point in the history
Should quote var name
  • Loading branch information
pocke committed Aug 9, 2021
2 parents 4538fdf + 08d5575 commit f71f8e8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions lib/rbs_rails/active_record.rb
Expand Up @@ -260,17 +260,17 @@ def reload_#{a.name}: () -> #{type_optional}
args_node.children.each do |node|
case node.type
when :arg
res << "untyped #{node.children[0]}"
res << "untyped `#{node.children[0]}`"
when :optarg
res << "?untyped #{node.children[0]}"
res << "?untyped `#{node.children[0]}`"
when :kwarg
res << "#{node.children[0]}: untyped"
when :kwoptarg
res << "?#{node.children[0]}: untyped"
when :restarg
res << "*untyped #{node.children[0]}"
res << "*untyped `#{node.children[0]}`"
when :kwrestarg
res << "**untyped #{node.children[0]}"
res << "**untyped `#{node.children[0]}`"
when :blockarg
block = " { (*untyped) -> untyped }"
else
Expand Down
4 changes: 2 additions & 2 deletions test/app/Gemfile.lock
Expand Up @@ -74,8 +74,8 @@ GEM
concurrent-ruby (1.1.8)
crass (1.0.6)
erubi (1.10.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
globalid (0.5.1)
activesupport (>= 5.0)
i18n (1.8.10)
concurrent-ruby (~> 1.0)
loofah (2.9.1)
Expand Down
2 changes: 1 addition & 1 deletion test/app/app/models/user.rb
@@ -1,5 +1,5 @@
class User < ApplicationRecord
scope :all_kind_args, -> (a, m = 1, n = 1, *rest, x, k: 1, **kwrest, &blk) { all }
scope :all_kind_args, -> (type, m = 1, n = 1, *rest, x, k: 1,**untyped, &blk) { all }
scope :no_arg, -> () { all }

has_and_belongs_to_many :blogs
Expand Down
6 changes: 3 additions & 3 deletions test/rbs_rails/active_record_test.rb
Expand Up @@ -106,14 +106,14 @@ def will_save_change_to_updated_at?: () -> bool
def restore_updated_at!: () -> void
def clear_updated_at_change: () -> void
def self.all_kind_args: (untyped a, ?untyped m, ?untyped n, *untyped rest, untyped x, ?k: untyped, **untyped kwrest) { (*untyped) -> untyped } -> ActiveRecord_Relation
def self.all_kind_args: (untyped `type`, ?untyped m, ?untyped n, *untyped rest, untyped x, ?k: untyped, **untyped `untyped`) { (*untyped) -> untyped } -> ActiveRecord_Relation
def self.no_arg: () -> ActiveRecord_Relation
class ActiveRecord_Relation < ActiveRecord::Relation
include _ActiveRecord_Relation[User, Integer]
include Enumerable[User]
def all_kind_args: (untyped a, ?untyped m, ?untyped n, *untyped rest, untyped x, ?k: untyped, **untyped kwrest) { (*untyped) -> untyped } -> ActiveRecord_Relation
def all_kind_args: (untyped `type`, ?untyped m, ?untyped n, *untyped rest, untyped x, ?k: untyped, **untyped `untyped`) { (*untyped) -> untyped } -> ActiveRecord_Relation
def no_arg: () -> ActiveRecord_Relation
end
Expand All @@ -124,7 +124,7 @@ class ActiveRecord_Associations_CollectionProxy < ActiveRecord::Associations::Co
end

def app_dir
File.expand_path('../app', __dir__)
File.expand_path('../app', __dir__)
end

def setup!
Expand Down

0 comments on commit f71f8e8

Please sign in to comment.