class Steep::Subtyping::Check

def expand_block_given(name, relation, &block)

def expand_block_given(name, relation, &block)
  relation.block!
  sub_block, super_block = relation
  case
  when !super_block && !sub_block
    true
  when super_block && sub_block && super_block.optional? == sub_block.optional?
    Relation.new(sub_type: sub_block, super_type: super_block)
  when sub_block&.optional?
    true
  else
    Failure(relation, Result::Failure::BlockMismatchError.new(name: name))
  end
end