Skip to content

[Feature] #unwrap_optional helper #2970

@amomchilov

Description

@amomchilov

It's a really common operation to unwrap the optionality out of a type, e.g. turning String? into String.

I'd propose (in psuedocode):

interface RBS::Types::_TypeBase
  # @overridable
  #: -> _TypeBase
  def unwrap_optional
    self # not optional, nothing to unwrap.
  end
end

class RBS::Types::Optional
  # @override
  #: -> _TypeBase
  def unwrap_optional
    type
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions