sord icon indicating copy to clipboard operation
sord copied to clipboard

second curly bracket is removed when block is used as a param

Open yratanov opened this issue 3 years ago • 1 comments

To Reproduce

class A
  def x(a: ->() {}); end
end

Expected behavior

class A
  # sord omit - no YARD type given for "a:", using untyped
  # sord omit - no YARD return type given, using untyped
  sig { params(a: T.untyped).returns(T.untyped) }
  def x(a: ->() {}); end
end

Actual behavior

class A
  # sord omit - no YARD type given for "a:", using untyped
  # sord omit - no YARD return type given, using untyped
  sig { params(a: T.untyped).returns(T.untyped) }
  def x(a: ->() {); end
end
- def x(a: ->() {); end
+ def x(a: ->() {}); end

Failing test: https://github.com/AaronC81/sord/pull/137

yratanov avatar Dec 15 '21 13:12 yratanov

I reckon this is because of the workaround in #127 to fix a YARD bug. The default parameter in your example kind of begins with a unary minus symbol, but it's actually a ->.

I'll take a look at this in the next couple of days! I don't think it should be too tricky to exclude this case from that workaround.

AaronC81 avatar Dec 15 '21 13:12 AaronC81

Just tidying up - already fixed by #137, so closing :)

AaronC81 avatar Oct 06 '22 21:10 AaronC81