AaronC81/sord

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

Closed this issue · 2 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: #137

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.

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