lib/rubocop/cop/rbs/style/redundant_parentheses.rb in rubocop-on-rbs-0.6.0 vs lib/rubocop/cop/rbs/style/redundant_parentheses.rb in rubocop-on-rbs-0.7.0

- old
+ new

@@ -70,12 +70,23 @@ end excludes = [ ::RBS::Types::Union, ::RBS::Types::Intersection, - ::RBS::Types::Proc + ::RBS::Types::Proc, ] @cop.on_not_type(excludes, @type) do |type| + case type + when ::RBS::Types::Optional + case type.type + when ::RBS::Types::Literal + case type.type.literal + when Symbol + # Skip optional with symbol literal (e.g. `(:sym)?`) + @skip << type.location.start_pos + end + end + end check_parentheses(type) end end def check_parentheses(type)