use Steep::Interface::Function::Params, Steep::Interface::Block module Steep module TypeInference # Type checking context class Context # Information about the method which the body is being type checked # class MethodContext # Name of the method attr_reader name: Symbol? # `nil` when RBS doesn't have the corresponding method definition attr_reader method: RBS::Definition::Method? # `nil` when no method type is given attr_reader method_type: Interface::MethodType? # Falls back to `untyped` attr_reader return_type: AST::Types::t # The *super* method if identified attr_reader super_method: RBS::Definition::Method? # The type of forwarding params when `...` is given attr_reader forward_arg_type: [Params, Block?]? def initialize: ( name: Symbol, method: RBS::Definition::Method?, method_type: Interface::MethodType?, return_type: AST::Types::t, super_method: RBS::Definition::Method?, forward_arg_type: [Params, Block?]? ) -> void # Type of the block of the current method type def block_type: () -> Interface::Block? end # Information about the block which the body is being type checked # class BlockContext # The type of block itself # # Returns `nil` if no type is specified. # attr_reader body_type: AST::Types::t? def initialize: (body_type: AST::Types::t?) -> void def subst: (Interface::Substitution) -> BlockContext end # Context about the `break` syntax class BreakContext # Type of arguments to `break` statement # attr_reader break_type: AST::Types::t # Type of arguments to `next` statement # # `nil` means the passed value will be ignored. # attr_reader next_type: AST::Types::t? def initialize: (break_type: AST::Types::t, next_type: AST::Types::t?) -> void def subst: (Interface::Substitution) -> BreakContext end # Information about the module which the body is being type checked # class ModuleContext # The type of an instance of current module attr_reader instance_type: AST::Types::t # The type of singleton of current module attr_reader module_type: AST::Types::t # The set of name of instance methods that is defined in the `module`/`class` statement attr_reader defined_instance_methods: Set[Symbol] # The set of name of singleton methods that is defined in the `module`/`class` statement attr_reader defined_module_methods: Set[Symbol] # The nesting of current module # # Cannot be `nil`. # attr_reader nesting: RBS::Resolver::context # The name that is given to `@implements` annotation # # `nil` when no `@implements` annotation is given. # attr_reader implement_name: AST::Annotation::Implements::Module? # The name of the class/module. attr_reader class_name: RBS::TypeName # The definition of the instance of the module attr_reader instance_definition: RBS::Definition? # The definition of the singleton of the module attr_reader module_definition: RBS::Definition? @class_variables: Hash[Symbol, RBS::Types::t]? def initialize: ( instance_type: AST::Types::t, module_type: AST::Types::t, implement_name: AST::Annotation::Implements::Module?, class_name: RBS::TypeName, nesting: RBS::Resolver::context, ?instance_definition: RBS::Definition?, ?module_definition: RBS::Definition? ) -> void # Returns a hash from the name of a class variable to its type %a{pure} def class_variables: () -> Hash[Symbol, RBS::Types::t]? def update: ( ?instance_type: AST::Types::t, ?module_type: AST::Types::t, ?implement_name: AST::Annotation::Implements::Module?, ?class_name: RBS::TypeName, ?instance_definition: RBS::Definition?, ?module_definition: RBS::Definition?, ?nesting: RBS::Resolver::context ) -> ModuleContext end # Information about the free type variables # class TypeVariableContext attr_reader table: Hash[Symbol, Interface::TypeParam] attr_reader type_params: Array[Interface::TypeParam] def initialize: (Array[Interface::TypeParam] type_params, ?parent_context: TypeVariableContext?) -> void # Returns the upper bound of a type variable def []: (Symbol name) -> AST::Types::t? def upper_bounds: () -> Hash[Symbol, AST::Types::t] def self.empty: () -> TypeVariableContext end # The caller where a method is called from attr_reader call_context: MethodCall::context # MethodContext for current execution point # # `nil` when not in any method definition. # attr_reader method_context: MethodContext? # BlockContext for current execution point # # `nil` when not in iterator block. # attr_reader block_context: BlockContext? # BreakContext for current execution point # # `nil` if `break` is not allowed. # attr_reader break_context: BreakContext? # ModuleContext for current execution point attr_reader module_context: ModuleContext # The type of `self` # attr_reader self_type: AST::Types::t attr_reader type_env: TypeEnv attr_reader variable_context: TypeVariableContext def initialize: ( method_context: MethodContext?, block_context: BlockContext?, break_context: BreakContext?, module_context: ModuleContext, self_type: AST::Types::t, type_env: TypeEnv, call_context: MethodCall::context, variable_context: TypeVariableContext ) -> void def with: ( ?method_context: MethodContext?, ?block_context: BlockContext?, ?break_context: BreakContext?, ?module_context: ModuleContext, ?self_type: AST::Types::t, ?type_env: TypeEnv, ?call_context: MethodCall::context, ?variable_context: TypeVariableContext ) -> Context def factory: () -> AST::Types::Factory def env: () -> RBS::Environment end end end