rbs icon indicating copy to clipboard operation
rbs copied to clipboard

Relax need for block

Open ksss opened this issue 3 years ago • 4 comments

Deciding that block is essential is difficult and often wrong.

This method of following type signature,

def foo
  yield if block_given?
end

I expected to following.

def foo: () ?{ () -> untyped } -> untyped 

However, it is actually required because of the existence of yield.

def foo: () { () -> untyped } -> untyped 

ksss avatar Oct 23 '22 14:10 ksss

Actual case https://github.com/ruby/gem_rbs_collection/pull/16

ksss avatar Oct 24 '22 07:10 ksss

@soutaro @pocke How about this?

ksss avatar Dec 16 '22 04:12 ksss

#1180 improved this problem.

soutaro avatar Jan 04 '23 13:01 soutaro

@soutaro I don't think the problem has been improved. Please see my comments https://github.com/ruby/rbs/pull/1180#issuecomment-1360942094

ksss avatar Jan 04 '23 14:01 ksss