sig/raap.rbs in raap-0.1.0 vs sig/raap.rbs in raap-0.2.0

- old
+ new

@@ -101,10 +101,11 @@ @fun_type: FunctionType def initialize: (::RBS::MethodType | String method, ?type_params_decl: Array[untyped], ?type_args: Array[untyped], ?self_type: ::RBS::Types::ClassInstance?, ?instance_type: ::RBS::Types::ClassInstance?, ?class_type: ::RBS::Types::ClassSingleton?) -> void def pick_arguments: (?size: Integer, ?eval: bool) -> [Array[untyped], Hash[Symbol, untyped], ::Proc?] def pick_block: (?size: Integer, ?eval: bool) -> ::Proc? + def check_return: (untyped) -> bool end class MethodValue < Data def self.new: (untyped receiver_value, [Array[untyped], Hash[Symbol, untyped], ::Proc?] arguments, Symbol method_name, Integer size) -> instance | (receiver_value: untyped, arguments: [Array[untyped], Hash[Symbol, untyped], ::Proc?], method_name: Symbol, size: Integer) -> instance @@ -127,11 +128,18 @@ def argument_str: () -> String def block_str: () -> String? end + module Minitest + end + module RBS + self.@builder: ::RBS::DefinitionBuilder + self.@env: ::RBS::Environment + self.@loader: ::RBS::EnvironmentLoader + def self.builder: () -> ::RBS::DefinitionBuilder def self.env: () -> ::RBS::Environment def self.loader: () -> ::RBS::EnvironmentLoader def self.parse_type: (String) -> ::RBS::Types::t end @@ -167,25 +175,28 @@ attr_reader method_value: MethodValue? attr_reader exception: ::Exception end end - interface _Pick[T] - def pick: (size: Integer) -> T - end - - class Sized + class Sized[T] @block: ::Proc @such_that: ::Proc? def initialize: () { (Integer) -> untyped } -> void - include _Pick[untyped] + def pick: (size: Integer) -> T def such_that: () { (untyped) -> boolish } -> self def such_that_loop: [R] () { (Integer) -> R } -> R end class SymbolicCaller + class Var + attr_reader name: String + def initialize: (String name) -> void + def +: (String) -> String + def to_s: () -> String + end + attr_reader symbolic_call: untyped def initialize: (untyped) -> void def eval: () -> untyped def walk: () ?{ (symbolic_call) -> untyped} -> untyped def to_lines: () -> Array[String] @@ -211,51 +222,57 @@ interface _MapType def map_type: { (untyped) -> untyped } -> untyped end - def sub: (_MapType search, self_type: ::RBS::Types::ClassInstance?, instance_type: ::RBS::Types::ClassInstance?, ?class_type: ::RBS::Types::ClassSingleton?) -> untyped + def sub: (_MapType search, self_type: ::RBS::Types::ClassInstance?, instance_type: ::RBS::Types::ClassInstance?, class_type: ::RBS::Types::ClassSingleton?) -> untyped end class Type module Arithmetic def self.float: () -> Float def self.positive_float: () -> Float end - GENERATORS: Hash[String, ^() -> _Pick[untyped] | Proc] + @such_that: (^(untyped) -> ::boolish)? + + GENERATORS: Hash[String, ^() -> Sized[untyped]] SIMPLE_SOURCE: Array[String] RECURSION: Hash[String, :found | :logged] - def self.register: (String) { () [self: instance] -> _Pick[untyped] } -> void + def self.register: (String) { () [self: instance] -> Sized[untyped] } -> void attr_reader type: ::RBS::Types::t attr_reader range: Range[untyped] def initialize: (String | ::RBS::Types::t, ?range: Range[untyped]) -> void - include _Pick[untyped] - def pick: (?size: Integer, ?eval: bool) -> untyped | ... + # Define rule for generating values + # type.such_that { |i| i != 0 }.pick #=> ensure that the value is not 0 + def such_that: () { (untyped) -> boolish } -> self + + # Basic API for materializing values + def pick: (?size: Integer, ?eval: bool) -> untyped def to_symbolic_call: (?size: Integer) -> untyped - def pick_from_initialize: (::RBS::Types::ClassInstance, size: Integer) -> untyped - def sized: () { (Integer size) -> untyped } -> _Pick[untyped] + def sized: [T] () { (Integer size) -> T } -> Sized[T] private + def pick_from_initialize: (::RBS::Types::ClassInstance, size: Integer) -> (symbolic_call | Value::Module) def parse: (String | ::RBS::Types::t) -> ::RBS::Types::t? def try: (times: Integer, size: Integer) { (Integer size) -> untyped } -> untyped - def numeric: () -> _Pick[Numeric] - def integer: () -> _Pick[Integer] - def none_zero_integer: () -> _Pick[Integer] - def float: () -> _Pick[Float] - def rational: () -> _Pick[Rational] - def complex: () -> _Pick[Complex] - def string: () -> _Pick[String] - def symbol: () -> _Pick[Symbol] - def array: (Type) -> _Pick[Array[untyped]] - def encoding: () -> _Pick[Encoding] - def bool: () -> _Pick[bool] - def untyped: () -> _Pick[untyped] + def numeric: () -> Sized[Numeric] + def integer: () -> Sized[Integer] + def none_zero_integer: () -> Sized[Integer] + def float: () -> Sized[Float] + def rational: () -> Sized[symbolic_call] + def complex: () -> Sized[symbolic_call] + def string: () -> Sized[String] + def symbol: () -> Sized[Symbol] + def array: (Type) -> Sized[Array[untyped]] + def encoding: () -> Sized[symbolic_call] + def bool: () -> Sized[bool] + def untyped: () -> Sized[untyped] def temp_method_object: () -> ::Method end module Value class Bottom < BasicObject