From 7d19282f3b1fac062a0aa6ad7b20f927ddac88b3 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Wed, 4 May 2022 20:03:51 -0400 Subject: [PATCH] Fix BindingConstantWithoutTypeAlias for type members with arguments Signed-off-by: Alexandre Terrasa --- lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb | 2 +- .../cop/sorbet/binding_constant_without_type_alias_spec.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb b/lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb index 39b495dd..cc584413 100644 --- a/lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb +++ b/lib/rubocop/cop/sorbet/binding_constants_without_type_alias.rb @@ -65,7 +65,7 @@ class BindingConstantWithoutTypeAlias < RuboCop::Cop::Cop def_node_matcher(:generic_parameter_decl_block_call?, <<-PATTERN) (block - (send nil? {:type_template :type_member}) ... + (send nil? {:type_template :type_member} ...) ... ) PATTERN diff --git a/spec/rubocop/cop/sorbet/binding_constant_without_type_alias_spec.rb b/spec/rubocop/cop/sorbet/binding_constant_without_type_alias_spec.rb index 0bd9fba0..a26db587 100644 --- a/spec/rubocop/cop/sorbet/binding_constant_without_type_alias_spec.rb +++ b/spec/rubocop/cop/sorbet/binding_constant_without_type_alias_spec.rb @@ -63,6 +63,7 @@ def deprecation expect_no_offenses(<<~RUBY) A = type_member(fixed: T.untyped) A = type_member { { fixed: T.class_of(::ActiveRecord::Base) } } + A = type_member(:in) { { fixed: T.untyped } } RUBY end @@ -70,6 +71,7 @@ def deprecation expect_no_offenses(<<~RUBY) A = type_template(fixed: T.untyped) A = type_template { { fixed: T.class_of(::ActiveRecord::Base) } } + A = type_template(:in) { { fixed: T.untyped } } RUBY end