steep 1.3.0.pre.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/Gemfile.lock +3 -3
- data/Gemfile.steep +1 -2
- data/Gemfile.steep.lock +4 -5
- data/bin/steep-prof +1 -1
- data/lib/steep/ast/types/class.rb +9 -3
- data/lib/steep/ast/types/factory.rb +9 -2
- data/lib/steep/ast/types/helper.rb +4 -3
- data/lib/steep/ast/types/instance.rb +8 -3
- data/lib/steep/ast/types/intersection.rb +6 -2
- data/lib/steep/ast/types/literal.rb +1 -1
- data/lib/steep/ast/types/logic.rb +5 -3
- data/lib/steep/ast/types/name.rb +11 -5
- data/lib/steep/ast/types/proc.rb +5 -5
- data/lib/steep/ast/types/record.rb +5 -1
- data/lib/steep/ast/types/self.rb +8 -2
- data/lib/steep/ast/types/tuple.rb +7 -5
- data/lib/steep/ast/types/union.rb +10 -4
- data/lib/steep/ast/types/var.rb +1 -1
- data/lib/steep/drivers/check.rb +1 -1
- data/lib/steep/drivers/checkfile.rb +1 -1
- data/lib/steep/drivers/langserver.rb +2 -2
- data/lib/steep/drivers/stats.rb +1 -1
- data/lib/steep/drivers/utils/jobs_option.rb +0 -4
- data/lib/steep/drivers/watch.rb +1 -1
- data/lib/steep/interface/substitution.rb +11 -10
- data/lib/steep/server/worker_process.rb +16 -11
- data/lib/steep/services/completion_provider.rb +2 -1
- data/lib/steep/services/goto_service.rb +2 -1
- data/lib/steep/services/hover_provider/ruby.rb +2 -1
- data/lib/steep/services/signature_service.rb +16 -0
- data/lib/steep/services/type_check_service.rb +4 -4
- data/lib/steep/signature/validator.rb +13 -13
- data/lib/steep/type_construction.rb +25 -20
- data/lib/steep/type_inference/logic_type_interpreter.rb +2 -2
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +0 -1
- data/rbs_collection.steep.lock.yaml +1 -1
- data/sig/steep/ast/builtin.rbs +1 -1
- data/sig/steep/ast/types/any.rbs +6 -6
- data/sig/steep/ast/types/boolean.rbs +7 -7
- data/sig/steep/ast/types/bot.rbs +6 -6
- data/sig/steep/ast/types/class.rbs +8 -7
- data/sig/steep/ast/types/helper.rbs +6 -3
- data/sig/steep/ast/types/instance.rbs +7 -6
- data/sig/steep/ast/types/intersection.rbs +13 -10
- data/sig/steep/ast/types/literal.rbs +6 -4
- data/sig/steep/ast/types/logic.rbs +9 -9
- data/sig/steep/ast/types/name.rbs +9 -5
- data/sig/steep/ast/types/nil.rbs +7 -7
- data/sig/steep/ast/types/proc.rbs +8 -3
- data/sig/steep/ast/types/record.rbs +8 -9
- data/sig/steep/ast/types/self.rbs +8 -7
- data/sig/steep/ast/types/top.rbs +6 -6
- data/sig/steep/ast/types/tuple.rbs +6 -5
- data/sig/steep/ast/types/union.rbs +9 -9
- data/sig/steep/ast/types/var.rbs +16 -11
- data/sig/steep/ast/types/void.rbs +6 -6
- data/sig/steep/ast/types.rbs +5 -26
- data/sig/steep/drivers/utils/jobs_option.rbs +0 -2
- data/sig/steep/interface/substitution.rbs +9 -9
- data/sig/steep/server/worker_process.rbs +2 -2
- data/sig/steep/services/signature_service.rbs +14 -0
- data/sig/steep/services/type_check_service.rbs +2 -2
- data/sig/steep.rbs +2 -0
- data/steep.gemspec +1 -1
- metadata +6 -7
- data/lib/steep/ast/types.rb +0 -62
| @@ -19,6 +19,10 @@ module Steep | |
| 19 19 | 
             
                        builder.env(last_builder.env)
         | 
| 20 20 | 
             
                      end
         | 
| 21 21 | 
             
                    end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                    def constant_resolver
         | 
| 24 | 
            +
                      @constant_resolver ||= RBS::Resolver::ConstantResolver.new(builder: last_builder)
         | 
| 25 | 
            +
                    end
         | 
| 22 26 | 
             
                  end
         | 
| 23 27 |  | 
| 24 28 | 
             
                  class AncestorErrorStatus
         | 
| @@ -37,6 +41,10 @@ module Steep | |
| 37 41 | 
             
                        builder.env(last_builder.env)
         | 
| 38 42 | 
             
                      end
         | 
| 39 43 | 
             
                    end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                    def constant_resolver
         | 
| 46 | 
            +
                      @constant_resolver ||= RBS::Resolver::ConstantResolver.new(builder: last_builder)
         | 
| 47 | 
            +
                    end
         | 
| 40 48 | 
             
                  end
         | 
| 41 49 |  | 
| 42 50 | 
             
                  class LoadedStatus
         | 
| @@ -61,6 +69,10 @@ module Steep | |
| 61 69 | 
             
                        builder.env(self.builder.env)
         | 
| 62 70 | 
             
                      end
         | 
| 63 71 | 
             
                    end
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                    def constant_resolver
         | 
| 74 | 
            +
                      @constant_resolver ||= RBS::Resolver::ConstantResolver.new(builder: builder)
         | 
| 75 | 
            +
                    end
         | 
| 64 76 | 
             
                  end
         | 
| 65 77 |  | 
| 66 78 | 
             
                  FileStatus = _ = Struct.new(:path, :content, :decls, keyword_init: true)
         | 
| @@ -125,6 +137,10 @@ module Steep | |
| 125 137 | 
             
                    status.rbs_index
         | 
| 126 138 | 
             
                  end
         | 
| 127 139 |  | 
| 140 | 
            +
                  def latest_constant_resolver
         | 
| 141 | 
            +
                    status.constant_resolver
         | 
| 142 | 
            +
                  end
         | 
| 143 | 
            +
             | 
| 128 144 | 
             
                  def current_subtyping
         | 
| 129 145 | 
             
                    if status.is_a?(LoadedStatus)
         | 
| 130 146 | 
             
                      status.subtyping
         | 
| @@ -280,7 +280,7 @@ module Steep | |
| 280 280 |  | 
| 281 281 | 
             
                        if subtyping
         | 
| 282 282 | 
             
                          text = source_files[path].content
         | 
| 283 | 
            -
                          file = type_check_file(target: target, subtyping: subtyping, path: path, text: text)
         | 
| 283 | 
            +
                          file = type_check_file(target: target, subtyping: subtyping, path: path, text: text) { signature_service.latest_constant_resolver }
         | 
| 284 284 | 
             
                          yield [file.path, file.diagnostics]
         | 
| 285 285 | 
             
                          source_files[path] = file
         | 
| 286 286 | 
             
                        end
         | 
| @@ -326,7 +326,7 @@ module Steep | |
| 326 326 | 
             
                  def type_check_file(target:, subtyping:, path:, text:)
         | 
| 327 327 | 
             
                    Steep.logger.tagged "#type_check_file(#{path}@#{target.name})" do
         | 
| 328 328 | 
             
                      source = Source.parse(text, path: path, factory: subtyping.factory)
         | 
| 329 | 
            -
                      typing = TypeCheckService.type_check(source: source, subtyping: subtyping)
         | 
| 329 | 
            +
                      typing = TypeCheckService.type_check(source: source, subtyping: subtyping, constant_resolver: yield)
         | 
| 330 330 | 
             
                      SourceFile.with_typing(path: path, content: text, node: source.node, typing: typing)
         | 
| 331 331 | 
             
                    end
         | 
| 332 332 | 
             
                  rescue AnnotationParser::SyntaxError => exn
         | 
| @@ -342,7 +342,7 @@ module Steep | |
| 342 342 | 
             
                    SourceFile.no_data(path: path, content: text)
         | 
| 343 343 | 
             
                  end
         | 
| 344 344 |  | 
| 345 | 
            -
                  def self.type_check(source:, subtyping:)
         | 
| 345 | 
            +
                  def self.type_check(source:, subtyping:, constant_resolver:)
         | 
| 346 346 | 
             
                    annotations = source.annotations(block: source.node, factory: subtyping.factory, context: nil)
         | 
| 347 347 |  | 
| 348 348 | 
             
                    definition = subtyping.factory.definition_builder.build_instance(AST::Builtin::Object.module_name)
         | 
| @@ -350,7 +350,7 @@ module Steep | |
| 350 350 | 
             
                    const_env = TypeInference::ConstantEnv.new(
         | 
| 351 351 | 
             
                      factory: subtyping.factory,
         | 
| 352 352 | 
             
                      context: nil,
         | 
| 353 | 
            -
                      resolver:  | 
| 353 | 
            +
                      resolver: constant_resolver
         | 
| 354 354 | 
             
                    )
         | 
| 355 355 | 
             
                    type_env = TypeInference::TypeEnv.new(const_env)
         | 
| 356 356 | 
             
                    type_env = TypeInference::TypeEnvBuilder.new(
         | 
| @@ -270,9 +270,9 @@ module Steep | |
| 270 270 | 
             
                            mixin_constraints(definition, ancestors.included_modules || raise, immediate_self_types: ancestors.self_types).each do |relation, ancestor|
         | 
| 271 271 | 
             
                              checker.check(
         | 
| 272 272 | 
             
                                relation,
         | 
| 273 | 
            -
                                self_type: AST::Types::Self. | 
| 274 | 
            -
                                instance_type: AST::Types::Instance. | 
| 275 | 
            -
                                class_type: AST::Types::Class. | 
| 273 | 
            +
                                self_type: AST::Types::Self.instance,
         | 
| 274 | 
            +
                                instance_type: AST::Types::Instance.instance,
         | 
| 275 | 
            +
                                class_type: AST::Types::Class.instance,
         | 
| 276 276 | 
             
                                constraints: Subtyping::Constraints.empty
         | 
| 277 277 | 
             
                              ).else do
         | 
| 278 278 | 
             
                                raise if ancestor.source.is_a?(Symbol)
         | 
| @@ -314,16 +314,16 @@ module Steep | |
| 314 314 | 
             
                              relation = Subtyping::Relation.new(sub_type: var_type, super_type: parent_type)
         | 
| 315 315 | 
             
                              result1 = checker.check(
         | 
| 316 316 | 
             
                                relation,
         | 
| 317 | 
            -
                                self_type: AST::Types::Self. | 
| 318 | 
            -
                                instance_type: AST::Types::Instance. | 
| 319 | 
            -
                                class_type: AST::Types::Class. | 
| 317 | 
            +
                                self_type: AST::Types::Self.instance,
         | 
| 318 | 
            +
                                instance_type: AST::Types::Instance.instance,
         | 
| 319 | 
            +
                                class_type: AST::Types::Class.instance,
         | 
| 320 320 | 
             
                                constraints: Subtyping::Constraints.empty
         | 
| 321 321 | 
             
                              )
         | 
| 322 322 | 
             
                              result2 = checker.check(
         | 
| 323 323 | 
             
                                relation.flip,
         | 
| 324 | 
            -
                                self_type: AST::Types::Self. | 
| 325 | 
            -
                                instance_type: AST::Types::Instance. | 
| 326 | 
            -
                                class_type: AST::Types::Class. | 
| 324 | 
            +
                                self_type: AST::Types::Self.instance,
         | 
| 325 | 
            +
                                instance_type: AST::Types::Instance.instance,
         | 
| 326 | 
            +
                                class_type: AST::Types::Class.instance,
         | 
| 327 327 | 
             
                                constraints: Subtyping::Constraints.empty
         | 
| 328 328 | 
             
                              )
         | 
| 329 329 |  | 
| @@ -362,13 +362,13 @@ module Steep | |
| 362 362 | 
             
                          mixin_constraints(definition, ancestors.extended_modules, immediate_self_types: ancestors.self_types).each do |relation, ancestor|
         | 
| 363 363 | 
             
                            checker.check(
         | 
| 364 364 | 
             
                              relation,
         | 
| 365 | 
            -
                              self_type: AST::Types::Self. | 
| 366 | 
            -
                              instance_type: AST::Types::Instance. | 
| 367 | 
            -
                              class_type: AST::Types::Class. | 
| 365 | 
            +
                              self_type: AST::Types::Self.instance ,
         | 
| 366 | 
            +
                              instance_type: AST::Types::Instance.instance,
         | 
| 367 | 
            +
                              class_type: AST::Types::Class.instance,
         | 
| 368 368 | 
             
                              constraints: Subtyping::Constraints.empty
         | 
| 369 369 | 
             
                            ).else do
         | 
| 370 370 | 
             
                              raise if ancestor.source.is_a?(Symbol)
         | 
| 371 | 
            -
             | 
| 371 | 
            +
             | 
| 372 372 | 
             
                              @errors << Diagnostic::Signature::ModuleSelfTypeError.new(
         | 
| 373 373 | 
             
                                name: name,
         | 
| 374 374 | 
             
                                location: ancestor.source&.location || raise,
         | 
| @@ -3216,12 +3216,15 @@ module Steep | |
| 3216 3216 | 
             
                def type_method_call(node, method_name:, receiver_type:, method:, arguments:, block_params:, block_body:, tapp:)
         | 
| 3217 3217 | 
             
                  node_range = node.loc.expression.yield_self {|l| l.begin_pos..l.end_pos }
         | 
| 3218 3218 |  | 
| 3219 | 
            -
                   | 
| 3219 | 
            +
                  # @type var fails: Array[[TypeInference::MethodCall::t, TypeConstruction]]
         | 
| 3220 | 
            +
                  fails = []
         | 
| 3221 | 
            +
             | 
| 3222 | 
            +
                  method.method_types.each do |method_type|
         | 
| 3220 3223 | 
             
                    Steep.logger.tagged method_type.to_s do
         | 
| 3221 3224 | 
             
                      typing.new_child(node_range) do |child_typing|
         | 
| 3222 3225 | 
             
                        constr = self.with_new_typing(child_typing)
         | 
| 3223 3226 |  | 
| 3224 | 
            -
                        constr.try_special_method(
         | 
| 3227 | 
            +
                        call, constr = constr.try_special_method(
         | 
| 3225 3228 | 
             
                          node,
         | 
| 3226 3229 | 
             
                          receiver_type: receiver_type,
         | 
| 3227 3230 | 
             
                          method_name: method_name,
         | 
| @@ -3239,30 +3242,32 @@ module Steep | |
| 3239 3242 | 
             
                          block_body: block_body,
         | 
| 3240 3243 | 
             
                          tapp: tapp
         | 
| 3241 3244 | 
             
                        )
         | 
| 3245 | 
            +
             | 
| 3246 | 
            +
                        if call.is_a?(TypeInference::MethodCall::Typed)
         | 
| 3247 | 
            +
                          constr.typing.save!
         | 
| 3248 | 
            +
                          return [
         | 
| 3249 | 
            +
                            call,
         | 
| 3250 | 
            +
                            update_type_env { constr.context.type_env }
         | 
| 3251 | 
            +
                          ]
         | 
| 3252 | 
            +
                        else
         | 
| 3253 | 
            +
                          fails << [call, constr]
         | 
| 3254 | 
            +
                        end
         | 
| 3242 3255 | 
             
                      end
         | 
| 3243 3256 | 
             
                    end
         | 
| 3244 3257 | 
             
                  end
         | 
| 3245 3258 |  | 
| 3246 | 
            -
                   | 
| 3247 | 
            -
             | 
| 3248 | 
            -
                    # There is only one overload, use the type checking result
         | 
| 3249 | 
            -
                    call, constr = results[0]
         | 
| 3250 | 
            -
                  when (call, constr = results.find {|call, _| call.is_a?(TypeInference::MethodCall::Typed) })
         | 
| 3251 | 
            -
                    # Successfully type checked with one of the overloads
         | 
| 3252 | 
            -
                  else
         | 
| 3253 | 
            -
                    # No suitable overload, more than one overlodas
         | 
| 3254 | 
            -
                    return
         | 
| 3255 | 
            -
                  end
         | 
| 3256 | 
            -
             | 
| 3257 | 
            -
                  constr or raise
         | 
| 3258 | 
            -
                  call or raise
         | 
| 3259 | 
            +
                  if fails.one?
         | 
| 3260 | 
            +
                    call, constr = fails[0]
         | 
| 3259 3261 |  | 
| 3260 | 
            -
             | 
| 3262 | 
            +
                    constr.typing.save!
         | 
| 3261 3263 |  | 
| 3262 | 
            -
             | 
| 3263 | 
            -
             | 
| 3264 | 
            -
             | 
| 3265 | 
            -
             | 
| 3264 | 
            +
                    [
         | 
| 3265 | 
            +
                      call,
         | 
| 3266 | 
            +
                      update_type_env { constr.context.type_env }
         | 
| 3267 | 
            +
                    ]
         | 
| 3268 | 
            +
                  else
         | 
| 3269 | 
            +
                    nil
         | 
| 3270 | 
            +
                  end
         | 
| 3266 3271 | 
             
                end
         | 
| 3267 3272 |  | 
| 3268 3273 | 
             
                def inspect
         | 
| @@ -390,14 +390,14 @@ module Steep | |
| 390 390 | 
             
                      # 4. none of the above (example: T = String, K = Integer)
         | 
| 391 391 |  | 
| 392 392 | 
             
                      relation = Subtyping::Relation.new(sub_type: type, super_type: instance_type)
         | 
| 393 | 
            -
                      if subtyping.check(relation, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self. | 
| 393 | 
            +
                      if subtyping.check(relation, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self.instance, instance_type: AST::Types::Instance.instance, class_type: AST::Types::Class.instance).success?
         | 
| 394 394 | 
             
                        # 1 or 2. Satisfies the condition, no narrowing because `type` is already more specific than/equals to `instance_type`
         | 
| 395 395 | 
             
                        [
         | 
| 396 396 | 
             
                          [type],
         | 
| 397 397 | 
             
                          []
         | 
| 398 398 | 
             
                        ]
         | 
| 399 399 | 
             
                      else
         | 
| 400 | 
            -
                        if subtyping.check(relation.flip, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self. | 
| 400 | 
            +
                        if subtyping.check(relation.flip, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self.instance, instance_type: AST::Types::Instance.instance, class_type: AST::Types::Class.instance).success?
         | 
| 401 401 | 
             
                          # 3. Satisfied the condition, narrows to `instance_type`, but cannot remove it from *falsy* list
         | 
| 402 402 | 
             
                          [
         | 
| 403 403 | 
             
                            [instance_type],
         | 
    
        data/lib/steep/version.rb
    CHANGED
    
    
    
        data/lib/steep.rb
    CHANGED
    
    | @@ -93,7 +93,6 @@ require "steep/type_inference/type_env_builder" | |
| 93 93 | 
             
            require "steep/type_inference/logic_type_interpreter"
         | 
| 94 94 | 
             
            require "steep/type_inference/multiple_assignment"
         | 
| 95 95 | 
             
            require "steep/type_inference/method_call"
         | 
| 96 | 
            -
            require "steep/ast/types"
         | 
| 97 96 |  | 
| 98 97 | 
             
            require "steep/index/rbs_index"
         | 
| 99 98 | 
             
            require "steep/index/signature_symbol_provider"
         | 
    
        data/sig/steep/ast/builtin.rbs
    CHANGED
    
    
    
        data/sig/steep/ast/types/any.rbs
    CHANGED
    
    | @@ -6,23 +6,23 @@ module Steep | |
| 6 6 |  | 
| 7 7 | 
             
                    def initialize: (?location: untyped?) -> void
         | 
| 8 8 |  | 
| 9 | 
            -
                    def ==: (untyped other) ->  | 
| 9 | 
            +
                    def ==: (untyped other) -> bool
         | 
| 10 10 |  | 
| 11 | 
            -
                    def hash: () ->  | 
| 11 | 
            +
                    def hash: () -> Integer
         | 
| 12 12 |  | 
| 13 13 | 
             
                    alias eql? ==
         | 
| 14 14 |  | 
| 15 | 
            -
                    def subst: ( | 
| 15 | 
            +
                    def subst: (Interface::Substitution s) -> Any
         | 
| 16 16 |  | 
| 17 | 
            -
                    def to_s: () ->  | 
| 17 | 
            +
                    def to_s: () -> String
         | 
| 18 18 |  | 
| 19 19 | 
             
                    include Helper::NoFreeVariables
         | 
| 20 20 |  | 
| 21 21 | 
             
                    include Helper::NoChild
         | 
| 22 22 |  | 
| 23 | 
            -
                    def level: () ->  | 
| 23 | 
            +
                    def level: () -> Array[Integer]
         | 
| 24 24 |  | 
| 25 | 
            -
                    def with_location: (untyped new_location) ->  | 
| 25 | 
            +
                    def with_location: (untyped new_location) -> Any
         | 
| 26 26 | 
             
                  end
         | 
| 27 27 | 
             
                end
         | 
| 28 28 | 
             
              end
         | 
| @@ -6,25 +6,25 @@ module Steep | |
| 6 6 |  | 
| 7 7 | 
             
                    def initialize: (?location: untyped?) -> void
         | 
| 8 8 |  | 
| 9 | 
            -
                    def ==: (untyped other) ->  | 
| 9 | 
            +
                    def ==: (untyped other) -> bool
         | 
| 10 10 |  | 
| 11 | 
            -
                    def hash: () ->  | 
| 11 | 
            +
                    def hash: () -> Integer
         | 
| 12 12 |  | 
| 13 13 | 
             
                    alias eql? ==
         | 
| 14 14 |  | 
| 15 | 
            -
                    def subst: ( | 
| 15 | 
            +
                    def subst: (Interface::Substitution) -> Boolean
         | 
| 16 16 |  | 
| 17 | 
            -
                    def to_s: () ->  | 
| 17 | 
            +
                    def to_s: () -> String
         | 
| 18 18 |  | 
| 19 19 | 
             
                    include Helper::NoFreeVariables
         | 
| 20 20 |  | 
| 21 21 | 
             
                    include Helper::NoChild
         | 
| 22 22 |  | 
| 23 | 
            -
                    def level: () ->  | 
| 23 | 
            +
                    def level: () -> Array[Integer]
         | 
| 24 24 |  | 
| 25 | 
            -
                    def with_location: (untyped new_location) ->  | 
| 25 | 
            +
                    def with_location: (untyped new_location) -> Boolean
         | 
| 26 26 |  | 
| 27 | 
            -
                    def back_type: () ->  | 
| 27 | 
            +
                    def back_type: () -> t
         | 
| 28 28 | 
             
                  end
         | 
| 29 29 | 
             
                end
         | 
| 30 30 | 
             
              end
         | 
    
        data/sig/steep/ast/types/bot.rbs
    CHANGED
    
    | @@ -6,23 +6,23 @@ module Steep | |
| 6 6 |  | 
| 7 7 | 
             
                    def initialize: (?location: untyped?) -> void
         | 
| 8 8 |  | 
| 9 | 
            -
                    def ==: (untyped other) ->  | 
| 9 | 
            +
                    def ==: (untyped other) -> bool
         | 
| 10 10 |  | 
| 11 | 
            -
                    def hash: () ->  | 
| 11 | 
            +
                    def hash: () -> Integer
         | 
| 12 12 |  | 
| 13 13 | 
             
                    alias eql? ==
         | 
| 14 14 |  | 
| 15 | 
            -
                    def subst: ( | 
| 15 | 
            +
                    def subst: (Interface::Substitution) -> Bot
         | 
| 16 16 |  | 
| 17 | 
            -
                    def to_s: () ->  | 
| 17 | 
            +
                    def to_s: () -> String
         | 
| 18 18 |  | 
| 19 19 | 
             
                    include Helper::NoFreeVariables
         | 
| 20 20 |  | 
| 21 21 | 
             
                    include Helper::NoChild
         | 
| 22 22 |  | 
| 23 | 
            -
                    def level: () ->  | 
| 23 | 
            +
                    def level: () -> Array[Integer]
         | 
| 24 24 |  | 
| 25 | 
            -
                    def with_location: (untyped new_location) ->  | 
| 25 | 
            +
                    def with_location: (untyped new_location) -> Bot
         | 
| 26 26 | 
             
                  end
         | 
| 27 27 | 
             
                end
         | 
| 28 28 | 
             
              end
         | 
| @@ -6,23 +6,24 @@ module Steep | |
| 6 6 |  | 
| 7 7 | 
             
                    def initialize: (?location: untyped?) -> void
         | 
| 8 8 |  | 
| 9 | 
            -
                    def to_s: () ->  | 
| 9 | 
            +
                    def to_s: () -> String
         | 
| 10 10 |  | 
| 11 | 
            -
                    def ==: (untyped other) ->  | 
| 11 | 
            +
                    def ==: (untyped other) -> bool
         | 
| 12 12 |  | 
| 13 | 
            -
                    def hash: () ->  | 
| 13 | 
            +
                    def hash: () -> Integer
         | 
| 14 14 |  | 
| 15 15 | 
             
                    alias eql? ==
         | 
| 16 16 |  | 
| 17 | 
            -
                    def subst: ( | 
| 17 | 
            +
                    def subst: (Interface::Substitution s) -> t
         | 
| 18 18 |  | 
| 19 | 
            -
                     | 
| 19 | 
            +
                    @@fvs: Set[variable]
         | 
| 20 | 
            +
                    def free_variables: () -> Set[variable]
         | 
| 20 21 |  | 
| 21 22 | 
             
                    include Helper::NoChild
         | 
| 22 23 |  | 
| 23 | 
            -
                    def level: () ->  | 
| 24 | 
            +
                    def level: () -> Array[Integer]
         | 
| 24 25 |  | 
| 25 | 
            -
                    def with_location: (untyped new_location) ->  | 
| 26 | 
            +
                    def with_location: (untyped new_location) -> Class
         | 
| 26 27 |  | 
| 27 28 | 
             
                    self.@instance: Class
         | 
| 28 29 | 
             
                    def self.instance: () -> Class
         | 
| @@ -3,15 +3,18 @@ module Steep | |
| 3 3 | 
             
                module Types
         | 
| 4 4 | 
             
                  module Helper
         | 
| 5 5 | 
             
                    module ChildrenLevel
         | 
| 6 | 
            -
                      def level_of_children: ( | 
| 6 | 
            +
                      def level_of_children: (Array[t] children) -> Array[Integer]
         | 
| 7 7 | 
             
                    end
         | 
| 8 8 |  | 
| 9 9 | 
             
                    module NoFreeVariables
         | 
| 10 | 
            -
                       | 
| 10 | 
            +
                      @fvs: Set[variable]
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                      def free_variables: () -> Set[variable]
         | 
| 11 13 | 
             
                    end
         | 
| 12 14 |  | 
| 13 15 | 
             
                    module NoChild
         | 
| 14 | 
            -
                      def each_child: ()  | 
| 16 | 
            +
                      def each_child: () { (t) -> void } -> void
         | 
| 17 | 
            +
                                    | () -> Enumerator[t, void]
         | 
| 15 18 | 
             
                    end
         | 
| 16 19 | 
             
                  end
         | 
| 17 20 | 
             
                end
         | 
| @@ -6,21 +6,22 @@ module Steep | |
| 6 6 |  | 
| 7 7 | 
             
                    def initialize: (?location: untyped?) -> void
         | 
| 8 8 |  | 
| 9 | 
            -
                    def ==: (untyped other) ->  | 
| 9 | 
            +
                    def ==: (untyped other) -> bool
         | 
| 10 10 |  | 
| 11 | 
            -
                    def hash: () ->  | 
| 11 | 
            +
                    def hash: () -> Integer
         | 
| 12 12 |  | 
| 13 13 | 
             
                    alias eql? ==
         | 
| 14 14 |  | 
| 15 | 
            -
                    def subst: ( | 
| 15 | 
            +
                    def subst: (Interface::Substitution s) -> t
         | 
| 16 16 |  | 
| 17 | 
            -
                     | 
| 17 | 
            +
                    @@fvs: Set[variable]
         | 
| 18 | 
            +
                    def free_variables: () -> Set[variable]
         | 
| 18 19 |  | 
| 19 20 | 
             
                    include Helper::NoChild
         | 
| 20 21 |  | 
| 21 | 
            -
                    def to_s: () ->  | 
| 22 | 
            +
                    def to_s: () -> String
         | 
| 22 23 |  | 
| 23 | 
            -
                    def level: () ->  | 
| 24 | 
            +
                    def level: () -> Array[Integer]
         | 
| 24 25 |  | 
| 25 26 | 
             
                    def with_location: (untyped new_location) -> untyped
         | 
| 26 27 |  | 
| @@ -2,33 +2,36 @@ module Steep | |
| 2 2 | 
             
              module AST
         | 
| 3 3 | 
             
                module Types
         | 
| 4 4 | 
             
                  class Intersection
         | 
| 5 | 
            -
                    attr_reader types:  | 
| 5 | 
            +
                    attr_reader types: Array[t]
         | 
| 6 6 |  | 
| 7 7 | 
             
                    attr_reader location: untyped
         | 
| 8 8 |  | 
| 9 | 
            -
                    def initialize: (types:  | 
| 9 | 
            +
                    def initialize: (types: Array[t], ?location: untyped?) -> void
         | 
| 10 10 |  | 
| 11 11 | 
             
                    def self.build: (types: Array[t], ?location: untyped?) -> t
         | 
| 12 12 |  | 
| 13 | 
            -
                    def ==: (untyped other) ->  | 
| 13 | 
            +
                    def ==: (untyped other) -> bool
         | 
| 14 14 |  | 
| 15 | 
            -
                     | 
| 15 | 
            +
                    @hash: Integer
         | 
| 16 | 
            +
                    def hash: () -> Integer
         | 
| 16 17 |  | 
| 17 18 | 
             
                    alias eql? ==
         | 
| 18 19 |  | 
| 19 | 
            -
                    def subst: ( | 
| 20 | 
            +
                    def subst: (Interface::Substitution s) -> t
         | 
| 20 21 |  | 
| 21 | 
            -
                    def to_s: () ->  | 
| 22 | 
            +
                    def to_s: () -> String
         | 
| 22 23 |  | 
| 23 | 
            -
                     | 
| 24 | 
            +
                    @fvs: Set[variable]
         | 
| 25 | 
            +
                    def free_variables: () -> Set[variable]
         | 
| 24 26 |  | 
| 25 27 | 
             
                    include Helper::ChildrenLevel
         | 
| 26 28 |  | 
| 27 | 
            -
                    def each_child: ()  | 
| 29 | 
            +
                    def each_child: () { (t) -> void } -> void
         | 
| 30 | 
            +
                                  | () -> Enumerator[t, void]
         | 
| 28 31 |  | 
| 29 | 
            -
                    def level: () ->  | 
| 32 | 
            +
                    def level: () -> Array[Integer]
         | 
| 30 33 |  | 
| 31 | 
            -
                    def with_location: (untyped new_location) ->  | 
| 34 | 
            +
                    def with_location: (untyped new_location) -> Intersection
         | 
| 32 35 | 
             
                  end
         | 
| 33 36 | 
             
                end
         | 
| 34 37 | 
             
              end
         | 
| @@ -4,9 +4,11 @@ module Steep | |
| 4 4 | 
             
                  class Literal
         | 
| 5 5 | 
             
                    attr_reader location: untyped
         | 
| 6 6 |  | 
| 7 | 
            -
                     | 
| 7 | 
            +
                    type value = Integer | String | Symbol | TrueClass | FalseClass
         | 
| 8 8 |  | 
| 9 | 
            -
                     | 
| 9 | 
            +
                    attr_reader value: value
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                    def initialize: (value: value, ?location: untyped?) -> void
         | 
| 10 12 |  | 
| 11 13 | 
             
                    def ==: (untyped other) -> bool
         | 
| 12 14 |  | 
| @@ -14,7 +16,7 @@ module Steep | |
| 14 16 |  | 
| 15 17 | 
             
                    alias eql? ==
         | 
| 16 18 |  | 
| 17 | 
            -
                    def subst: (Interface::Substitution s) ->  | 
| 19 | 
            +
                    def subst: (Interface::Substitution s) -> Literal
         | 
| 18 20 |  | 
| 19 21 | 
             
                    def to_s: () -> String
         | 
| 20 22 |  | 
| @@ -24,7 +26,7 @@ module Steep | |
| 24 26 |  | 
| 25 27 | 
             
                    def level: () -> Array[Integer]
         | 
| 26 28 |  | 
| 27 | 
            -
                    def with_location: (untyped new_location) ->  | 
| 29 | 
            +
                    def with_location: (untyped new_location) -> Literal
         | 
| 28 30 |  | 
| 29 31 | 
             
                    def back_type: () -> AST::Types::Name::Instance
         | 
| 30 32 | 
             
                  end
         | 
| @@ -2,24 +2,24 @@ module Steep | |
| 2 2 | 
             
              module AST
         | 
| 3 3 | 
             
                module Types
         | 
| 4 4 | 
             
                  module Logic
         | 
| 5 | 
            -
                    type loc = RBS::Location[untyped, untyped]
         | 
| 6 | 
            -
             | 
| 7 5 | 
             
                    class Base
         | 
| 8 6 | 
             
                      attr_reader location: untyped
         | 
| 9 7 |  | 
| 10 | 
            -
                      def subst: ( | 
| 8 | 
            +
                      def subst: (Interface::Substitution s) -> self
         | 
| 11 9 |  | 
| 12 | 
            -
                       | 
| 10 | 
            +
                      include Helper::NoFreeVariables
         | 
| 13 11 |  | 
| 14 12 | 
             
                      include Helper::NoChild
         | 
| 15 13 |  | 
| 16 | 
            -
                      def hash: () ->  | 
| 14 | 
            +
                      def hash: () -> Integer
         | 
| 17 15 |  | 
| 18 | 
            -
                      def ==: (untyped other) ->  | 
| 16 | 
            +
                      def ==: (untyped other) -> bool
         | 
| 19 17 |  | 
| 20 18 | 
             
                      alias eql? ==
         | 
| 21 19 |  | 
| 22 | 
            -
                      def to_s: () ->  | 
| 20 | 
            +
                      def to_s: () -> String
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                      def level: () -> Array[Integer]
         | 
| 23 23 | 
             
                    end
         | 
| 24 24 |  | 
| 25 25 | 
             
                    # A type for `!` (not) operator results.
         | 
| @@ -60,7 +60,7 @@ module Steep | |
| 60 60 |  | 
| 61 61 | 
             
                      attr_reader type: t
         | 
| 62 62 |  | 
| 63 | 
            -
                      def initialize: (truthy: TypeInference::TypeEnv, falsy: TypeInference::TypeEnv, type: t, ?location:  | 
| 63 | 
            +
                      def initialize: (truthy: TypeInference::TypeEnv, falsy: TypeInference::TypeEnv, type: t, ?location: untyped) -> void
         | 
| 64 64 |  | 
| 65 65 | 
             
                      def ==: (untyped other) -> bool
         | 
| 66 66 |  | 
| @@ -68,7 +68,7 @@ module Steep | |
| 68 68 |  | 
| 69 69 | 
             
                      def hash: () -> Integer
         | 
| 70 70 |  | 
| 71 | 
            -
                      def inspect: () ->  | 
| 71 | 
            +
                      def inspect: () -> String
         | 
| 72 72 |  | 
| 73 73 | 
             
                      alias to_s inspect
         | 
| 74 74 | 
             
                    end
         | 
| @@ -1,6 +1,8 @@ | |
| 1 1 | 
             
            module Steep
         | 
| 2 2 | 
             
              module AST
         | 
| 3 3 | 
             
                module Types
         | 
| 4 | 
            +
                  # Types with names
         | 
| 5 | 
            +
                  #
         | 
| 4 6 | 
             
                  module Name
         | 
| 5 7 | 
             
                    class Base
         | 
| 6 8 | 
             
                      attr_reader location: untyped
         | 
| @@ -13,7 +15,7 @@ module Steep | |
| 13 15 |  | 
| 14 16 | 
             
                      def subst: (Steep::Interface::Substitution s) -> self
         | 
| 15 17 |  | 
| 16 | 
            -
                      def level: () ->  | 
| 18 | 
            +
                      def level: () -> Array[Integer]
         | 
| 17 19 | 
             
                    end
         | 
| 18 20 |  | 
| 19 21 | 
             
                    class Applying < Base
         | 
| @@ -25,22 +27,24 @@ module Steep | |
| 25 27 |  | 
| 26 28 | 
             
                      alias eql? ==
         | 
| 27 29 |  | 
| 30 | 
            +
                      @hash: Integer
         | 
| 28 31 | 
             
                      def hash: () -> Integer
         | 
| 29 32 |  | 
| 30 33 | 
             
                      def to_s: () -> ::String
         | 
| 31 34 |  | 
| 32 | 
            -
                      def with_location: (untyped new_location) ->  | 
| 35 | 
            +
                      def with_location: (untyped new_location) -> self
         | 
| 33 36 |  | 
| 34 37 | 
             
                      def subst: (Steep::Interface::Substitution s) -> self
         | 
| 35 38 |  | 
| 36 | 
            -
                       | 
| 39 | 
            +
                      @fvs: Set[variable]
         | 
| 40 | 
            +
                      def free_variables: () -> Set[variable]
         | 
| 37 41 |  | 
| 38 42 | 
             
                      def each_child: () { (t) -> void } -> void
         | 
| 39 43 | 
             
                                    | () -> Enumerator[t, void]
         | 
| 40 44 |  | 
| 41 45 | 
             
                      include Helper::ChildrenLevel
         | 
| 42 46 |  | 
| 43 | 
            -
                      def level: () ->  | 
| 47 | 
            +
                      def level: () -> Array[Integer]
         | 
| 44 48 | 
             
                    end
         | 
| 45 49 |  | 
| 46 50 | 
             
                    class Singleton < Base
         | 
| @@ -52,7 +56,7 @@ module Steep | |
| 52 56 |  | 
| 53 57 | 
             
                      def to_s: () -> ::String
         | 
| 54 58 |  | 
| 55 | 
            -
                      def with_location: (untyped new_location) ->  | 
| 59 | 
            +
                      def with_location: (untyped new_location) -> Singleton
         | 
| 56 60 |  | 
| 57 61 | 
             
                      include Helper::NoChild
         | 
| 58 62 | 
             
                    end
         | 
    
        data/sig/steep/ast/types/nil.rbs
    CHANGED
    
    | @@ -6,25 +6,25 @@ module Steep | |
| 6 6 |  | 
| 7 7 | 
             
                    def initialize: (?location: untyped?) -> void
         | 
| 8 8 |  | 
| 9 | 
            -
                    def ==: (untyped other) ->  | 
| 9 | 
            +
                    def ==: (untyped other) -> bool
         | 
| 10 10 |  | 
| 11 | 
            -
                    def hash: () ->  | 
| 11 | 
            +
                    def hash: () -> Integer
         | 
| 12 12 |  | 
| 13 13 | 
             
                    alias eql? ==
         | 
| 14 14 |  | 
| 15 | 
            -
                    def subst: ( | 
| 15 | 
            +
                    def subst: (Interface::Substitution s) -> Nil
         | 
| 16 16 |  | 
| 17 | 
            -
                    def to_s: () ->  | 
| 17 | 
            +
                    def to_s: () -> String
         | 
| 18 18 |  | 
| 19 19 | 
             
                    include Helper::NoFreeVariables
         | 
| 20 20 |  | 
| 21 21 | 
             
                    include Helper::NoChild
         | 
| 22 22 |  | 
| 23 | 
            -
                    def level: () ->  | 
| 23 | 
            +
                    def level: () -> Array[Integer]
         | 
| 24 24 |  | 
| 25 | 
            -
                    def with_location: (untyped new_location) ->  | 
| 25 | 
            +
                    def with_location: (untyped new_location) -> Nil
         | 
| 26 26 |  | 
| 27 | 
            -
                    def back_type: () ->  | 
| 27 | 
            +
                    def back_type: () -> Name::Instance
         | 
| 28 28 | 
             
                  end
         | 
| 29 29 | 
             
                end
         | 
| 30 30 | 
             
              end
         |