rbs 1.0.3 → 1.1.1
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/.github/workflows/ruby.yml +2 -2
- data/CHANGELOG.md +65 -0
- data/Gemfile +0 -1
- data/Rakefile +3 -2
- data/Steepfile +2 -0
- data/bin/rbs-prof +1 -1
- data/core/array.rbs +10 -6
- data/core/complex.rbs +1 -1
- data/core/enumerable.rbs +15 -1
- data/core/enumerator.rbs +4 -0
- data/core/file.rbs +2 -1
- data/core/integer.rbs +2 -1
- data/core/module.rbs +1 -1
- data/core/rational.rbs +2 -1
- data/core/string.rbs +2 -1
- data/core/symbol.rbs +2 -1
- data/core/thread.rbs +14 -1
- data/core/time.rbs +2 -1
- data/docs/stdlib.md +1 -1
- data/lib/rbs.rb +3 -0
- data/lib/rbs/ancestor_graph.rb +90 -0
- data/lib/rbs/ast/members.rb +13 -0
- data/lib/rbs/char_scanner.rb +20 -0
- data/lib/rbs/definition_builder.rb +50 -25
- data/lib/rbs/definition_builder/method_builder.rb +23 -2
- data/lib/rbs/environment.rb +42 -5
- data/lib/rbs/environment_walker.rb +4 -4
- data/lib/rbs/errors.rb +32 -17
- data/lib/rbs/parser.rb +437 -416
- data/lib/rbs/parser.y +29 -16
- data/lib/rbs/test/type_check.rb +7 -3
- data/lib/rbs/version.rb +1 -1
- data/sig/ancestor_graph.rbs +40 -0
- data/sig/char_scanner.rbs +9 -0
- data/sig/definition_builder.rbs +5 -1
- data/sig/environment.rbs +22 -2
- data/sig/environment_walker.rbs +39 -0
- data/sig/errors.rbs +42 -17
- data/sig/members.rbs +2 -0
- data/sig/method_builder.rbs +2 -0
- data/sig/parser.rbs +11 -4
- data/sig/polyfill.rbs +0 -14
- data/sig/types.rbs +7 -1
- data/stdlib/bigdecimal/0/big_decimal.rbs +1 -1
- data/stdlib/cgi/0/core.rbs +595 -0
- data/stdlib/date/0/date.rbs +1 -1
- data/stdlib/json/0/json.rbs +288 -0
- data/stdlib/pathname/0/pathname.rbs +2 -1
- data/stdlib/rubygems/0/basic_specification.rbs +3 -0
- data/stdlib/rubygems/0/config_file.rbs +3 -0
- data/stdlib/rubygems/0/dependency_installer.rbs +5 -0
- data/stdlib/rubygems/0/installer.rbs +3 -0
- data/stdlib/rubygems/0/path_support.rbs +3 -0
- data/stdlib/rubygems/0/platform.rbs +3 -0
- data/stdlib/rubygems/0/request_set.rbs +7 -0
- data/stdlib/rubygems/0/requirement.rbs +3 -0
- data/stdlib/rubygems/0/rubygems.rbs +710 -0
- data/stdlib/rubygems/0/source_list.rbs +2 -0
- data/stdlib/rubygems/0/specification.rbs +3 -0
- data/stdlib/rubygems/0/stream_ui.rbs +3 -0
- data/stdlib/rubygems/0/uninstaller.rbs +3 -0
- data/stdlib/rubygems/0/version.rbs +228 -0
- data/stdlib/set/0/set.rbs +7 -0
- data/stdlib/strscan/0/string_scanner.rbs +582 -0
- data/stdlib/timeout/0/timeout.rbs +57 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +144 -7
- data/steep/Gemfile.lock +17 -19
- metadata +24 -2
    
        data/lib/rbs/parser.y
    CHANGED
    
    | @@ -760,8 +760,8 @@ rule | |
| 760 760 | 
             
                    location = val[0].location + val[1].location
         | 
| 761 761 | 
             
                    result = Types::Tuple.new(types: [], location: location)
         | 
| 762 762 | 
             
                  }
         | 
| 763 | 
            -
                | kLBRACKET type_list kRBRACKET {
         | 
| 764 | 
            -
                    location = val[0].location + val[ | 
| 763 | 
            +
                | kLBRACKET type_list comma_opt kRBRACKET {
         | 
| 764 | 
            +
                    location = val[0].location + val[3].location
         | 
| 765 765 | 
             
                    types = val[1]
         | 
| 766 766 | 
             
                    result = Types::Tuple.new(types: types, location: location)
         | 
| 767 767 | 
             
                  }
         | 
| @@ -794,10 +794,10 @@ rule | |
| 794 794 | 
             
                  }
         | 
| 795 795 |  | 
| 796 796 | 
             
              record_type:
         | 
| 797 | 
            -
                  kLBRACE record_fields kRBRACE {
         | 
| 797 | 
            +
                  kLBRACE record_fields comma_opt kRBRACE {
         | 
| 798 798 | 
             
                    result = Types::Record.new(
         | 
| 799 799 | 
             
                      fields: val[1],
         | 
| 800 | 
            -
                      location: val[0].location + val[ | 
| 800 | 
            +
                      location: val[0].location + val[3].location
         | 
| 801 801 | 
             
                    )
         | 
| 802 802 | 
             
                  }
         | 
| 803 803 |  | 
| @@ -805,7 +805,7 @@ rule | |
| 805 805 | 
             
                  record_field {
         | 
| 806 806 | 
             
                    result = val[0]
         | 
| 807 807 | 
             
                  }
         | 
| 808 | 
            -
                |  | 
| 808 | 
            +
                | record_fields kCOMMA record_field {
         | 
| 809 809 | 
             
                    result = val[0].merge!(val[2])
         | 
| 810 810 | 
             
                  }
         | 
| 811 811 |  | 
| @@ -1062,6 +1062,10 @@ rule | |
| 1062 1062 | 
             
                    namespace = Namespace.parse(val[0].value)
         | 
| 1063 1063 | 
             
                    result = LocatedValue.new(value: namespace, location: val[0].location)
         | 
| 1064 1064 | 
             
                  }
         | 
| 1065 | 
            +
             | 
| 1066 | 
            +
              comma_opt:
         | 
| 1067 | 
            +
                  kCOMMA | # empty
         | 
| 1068 | 
            +
             | 
| 1065 1069 | 
             
            end
         | 
| 1066 1070 |  | 
| 1067 1071 | 
             
            ---- inner
         | 
| @@ -1084,8 +1088,6 @@ class LocatedValue | |
| 1084 1088 | 
             
              end
         | 
| 1085 1089 | 
             
            end
         | 
| 1086 1090 |  | 
| 1087 | 
            -
            require "strscan"
         | 
| 1088 | 
            -
             | 
| 1089 1091 | 
             
            attr_reader :input
         | 
| 1090 1092 | 
             
            attr_reader :buffer
         | 
| 1091 1093 | 
             
            attr_reader :eof_re
         | 
| @@ -1094,7 +1096,7 @@ def initialize(type, buffer:, eof_re:) | |
| 1094 1096 | 
             
              super()
         | 
| 1095 1097 | 
             
              @type = type
         | 
| 1096 1098 | 
             
              @buffer = buffer
         | 
| 1097 | 
            -
              @input =  | 
| 1099 | 
            +
              @input = CharScanner.new(buffer.content)
         | 
| 1098 1100 | 
             
              @eof_re = eof_re
         | 
| 1099 1101 | 
             
              @eof = false
         | 
| 1100 1102 | 
             
              @bound_variables_stack = []
         | 
| @@ -1210,11 +1212,7 @@ def new_token(type, value = input.matched) | |
| 1210 1212 | 
             
            end
         | 
| 1211 1213 |  | 
| 1212 1214 | 
             
            def charpos(scanner)
         | 
| 1213 | 
            -
               | 
| 1214 | 
            -
                scanner.pos
         | 
| 1215 | 
            -
              else
         | 
| 1216 | 
            -
                scanner.charpos
         | 
| 1217 | 
            -
              end
         | 
| 1215 | 
            +
              scanner.charpos
         | 
| 1218 1216 | 
             
            end
         | 
| 1219 1217 |  | 
| 1220 1218 | 
             
            def empty_params_result
         | 
| @@ -1421,7 +1419,11 @@ def next_token | |
| 1421 1419 | 
             
                s = input.matched.yield_self {|s| s[1, s.length - 2] }.gsub(/\\'/, "'")
         | 
| 1422 1420 | 
             
                new_token(:tSTRING, s)
         | 
| 1423 1421 | 
             
              else
         | 
| 1424 | 
            -
                 | 
| 1422 | 
            +
                text = input.peek(10)
         | 
| 1423 | 
            +
                start_index = charpos(input)
         | 
| 1424 | 
            +
                end_index = start_index + text.length
         | 
| 1425 | 
            +
                location = RBS::Location.new(buffer: buffer, start_pos: start_index, end_pos: end_index)
         | 
| 1426 | 
            +
                raise LexerError.new(input: text, location: location)
         | 
| 1425 1427 | 
             
              end
         | 
| 1426 1428 | 
             
            end
         | 
| 1427 1429 |  | 
| @@ -1429,7 +1431,7 @@ def on_error(token_id, error_value, value_stack) | |
| 1429 1431 | 
             
              raise SyntaxError.new(token_str: token_to_str(token_id), error_value: error_value, value_stack: value_stack)
         | 
| 1430 1432 | 
             
            end
         | 
| 1431 1433 |  | 
| 1432 | 
            -
            class SyntaxError <  | 
| 1434 | 
            +
            class SyntaxError < ParsingError
         | 
| 1433 1435 | 
             
              attr_reader :token_str, :error_value, :value_stack
         | 
| 1434 1436 |  | 
| 1435 1437 | 
             
              def initialize(token_str:, error_value:, value_stack: nil)
         | 
| @@ -1441,7 +1443,7 @@ class SyntaxError < StandardError | |
| 1441 1443 | 
             
              end
         | 
| 1442 1444 | 
             
            end
         | 
| 1443 1445 |  | 
| 1444 | 
            -
            class SemanticsError <  | 
| 1446 | 
            +
            class SemanticsError < ParsingError
         | 
| 1445 1447 | 
             
              attr_reader :subject, :location, :original_message
         | 
| 1446 1448 |  | 
| 1447 1449 | 
             
              def initialize(message, subject:, location:)
         | 
| @@ -1453,4 +1455,15 @@ class SemanticsError < StandardError | |
| 1453 1455 | 
             
              end
         | 
| 1454 1456 | 
             
            end
         | 
| 1455 1457 |  | 
| 1458 | 
            +
            class LexerError < ParsingError
         | 
| 1459 | 
            +
              attr_reader :location, :input
         | 
| 1460 | 
            +
             | 
| 1461 | 
            +
              def initialize(input:, location:)
         | 
| 1462 | 
            +
                @input = input
         | 
| 1463 | 
            +
                @location = location
         | 
| 1464 | 
            +
             | 
| 1465 | 
            +
                super "Unexpected string: #{input}..."
         | 
| 1466 | 
            +
              end
         | 
| 1467 | 
            +
            end
         | 
| 1468 | 
            +
             | 
| 1456 1469 | 
             
            ---- footer
         | 
    
        data/lib/rbs/test/type_check.rb
    CHANGED
    
    | @@ -5,13 +5,17 @@ module RBS | |
| 5 5 | 
             
                  attr_reader :builder
         | 
| 6 6 | 
             
                  attr_reader :sample_size
         | 
| 7 7 | 
             
                  attr_reader :unchecked_classes
         | 
| 8 | 
            +
                  attr_reader :instance_class
         | 
| 9 | 
            +
                  attr_reader :class_class
         | 
| 8 10 |  | 
| 9 11 | 
             
                  attr_reader :const_cache
         | 
| 10 12 |  | 
| 11 13 | 
             
                  DEFAULT_SAMPLE_SIZE = 100
         | 
| 12 14 |  | 
| 13 | 
            -
                  def initialize(self_class:, builder:, sample_size:, unchecked_classes:)
         | 
| 15 | 
            +
                  def initialize(self_class:, builder:, sample_size:, unchecked_classes:, instance_class: Object, class_class: Module)
         | 
| 14 16 | 
             
                    @self_class = self_class
         | 
| 17 | 
            +
                    @instance_class = instance_class
         | 
| 18 | 
            +
                    @class_class = class_class
         | 
| 15 19 | 
             
                    @builder = builder
         | 
| 16 20 | 
             
                    @sample_size = sample_size
         | 
| 17 21 | 
             
                    @unchecked_classes = unchecked_classes.uniq
         | 
| @@ -237,9 +241,9 @@ module RBS | |
| 237 241 | 
             
                    when Types::Bases::Nil
         | 
| 238 242 | 
             
                      Test.call(val, IS_AP, ::NilClass)
         | 
| 239 243 | 
             
                    when Types::Bases::Class
         | 
| 240 | 
            -
                      Test.call(val, IS_AP,  | 
| 244 | 
            +
                      Test.call(val, IS_AP, class_class)
         | 
| 241 245 | 
             
                    when Types::Bases::Instance
         | 
| 242 | 
            -
                      Test.call(val, IS_AP,  | 
| 246 | 
            +
                      Test.call(val, IS_AP, instance_class)
         | 
| 243 247 | 
             
                    when Types::ClassInstance
         | 
| 244 248 | 
             
                      klass = get_class(type.name) or return false
         | 
| 245 249 | 
             
                      case
         | 
    
        data/lib/rbs/version.rb
    CHANGED
    
    
| @@ -0,0 +1,40 @@ | |
| 1 | 
            +
            module RBS
         | 
| 2 | 
            +
              class AncestorGraph
         | 
| 3 | 
            +
                class InstanceNode
         | 
| 4 | 
            +
                  attr_reader type_name: TypeName
         | 
| 5 | 
            +
                  def initialize: (type_name: TypeName) -> void
         | 
| 6 | 
            +
                end
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                class SingletonNode
         | 
| 9 | 
            +
                  attr_reader type_name: TypeName
         | 
| 10 | 
            +
                  def initialize: (type_name: TypeName) -> void
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                type node = InstanceNode | SingletonNode
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                attr_reader env: Environment
         | 
| 16 | 
            +
                attr_reader ancestor_builder: DefinitionBuilder::AncestorBuilder
         | 
| 17 | 
            +
                attr_reader parents: Hash[node, Set[node]]
         | 
| 18 | 
            +
                attr_reader children: Hash[node, Set[node]]
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                def initialize: (env: Environment, ?ancestor_builder: DefinitionBuilder::AncestorBuilder) -> void
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                def build: () -> void
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                def each_parent: (node) { (node) -> void } -> void
         | 
| 25 | 
            +
                               | (node) -> Enumerator[node, void]
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                def each_ancestor: (node, ?yielded: Set[node]) { (node) -> void } -> void
         | 
| 28 | 
            +
                                 | (node) -> Enumerator[node, void]
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                def each_child: (node) { (node) -> void } -> void
         | 
| 31 | 
            +
                              | (node) -> Enumerator[node, void]
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                def each_descendant: (node, ?yielded: Set[node]) { (node) -> void } -> void
         | 
| 34 | 
            +
                                   | (node) -> Enumerator[node, void]
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                def build_ancestors: (node, DefinitionBuilder::AncestorBuilder::OneAncestors) -> void
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                def register: (parent: node, child: node) -> void
         | 
| 39 | 
            +
              end
         | 
| 40 | 
            +
            end
         | 
    
        data/sig/definition_builder.rbs
    CHANGED
    
    | @@ -10,7 +10,7 @@ module RBS | |
| 10 10 | 
             
                attr_reader singleton0_cache: Hash[TypeName, Definition | false | nil]
         | 
| 11 11 | 
             
                attr_reader interface_cache: Hash[TypeName, Definition | false | nil]
         | 
| 12 12 |  | 
| 13 | 
            -
                def initialize: (env: Environment) -> void
         | 
| 13 | 
            +
                def initialize: (env: Environment, ?ancestor_builder: AncestorBuilder?, ?method_builder: MethodBuilder?) -> void
         | 
| 14 14 |  | 
| 15 15 | 
             
                def validate_super_class!: (TypeName, Environment::ClassEntry) -> void
         | 
| 16 16 |  | 
| @@ -42,5 +42,9 @@ module RBS | |
| 42 42 | 
             
                def insert_variable: (TypeName, Hash[Symbol, Definition::Variable], name: Symbol, type: Types::t) -> void
         | 
| 43 43 |  | 
| 44 44 | 
             
                def define_methods: (Definition, interface_methods: Hash[Symbol, Definition::Method], methods: MethodBuilder::Methods, super_interface_method: bool) -> void
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                def expand_alias: (TypeName) -> Types::t
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                def update: (env: Environment, ancestor_builder: AncestorBuilder, except: _Each[TypeName]) -> DefinitionBuilder
         | 
| 45 49 | 
             
              end
         | 
| 46 50 | 
             
            end
         | 
    
        data/sig/environment.rbs
    CHANGED
    
    | @@ -58,7 +58,7 @@ module RBS | |
| 58 58 | 
             
                  def initialize: (name: N, decl: D, outer: Array[module_decl]) -> void
         | 
| 59 59 | 
             
                end
         | 
| 60 60 |  | 
| 61 | 
            -
                 | 
| 61 | 
            +
                # Top level declarations.
         | 
| 62 62 | 
             
                attr_reader declarations: Array[AST::Declarations::t]
         | 
| 63 63 |  | 
| 64 64 | 
             
                attr_reader class_decls: Hash[TypeName, ModuleEntry | ClassEntry]
         | 
| @@ -77,9 +77,20 @@ module RBS | |
| 77 77 |  | 
| 78 78 | 
             
                def insert_decl: (AST::Declarations::t, outer: Array[module_decl], namespace: Namespace) -> void
         | 
| 79 79 |  | 
| 80 | 
            +
                # Insert a toplevel declaration into the env.
         | 
| 81 | 
            +
                #
         | 
| 80 82 | 
             
                def <<: (AST::Declarations::t decl) -> self
         | 
| 81 83 |  | 
| 82 | 
            -
                 | 
| 84 | 
            +
                # Runs generics type params validation over each class definitions.
         | 
| 85 | 
            +
                def validate_type_params: () -> void
         | 
| 86 | 
            +
             | 
| 87 | 
            +
                # Resolve all type names in the environment to absolute type names.
         | 
| 88 | 
            +
                # Relative type name will be left if absolute type name cannot be found.
         | 
| 89 | 
            +
                #
         | 
| 90 | 
            +
                # When `only` is given, it skips other _top-level_ declarations not included in the collection.
         | 
| 91 | 
            +
                # This helps running resolution faster in the case of _partial updates_.
         | 
| 92 | 
            +
                #
         | 
| 93 | 
            +
                def resolve_type_names: (?only: Set[AST::Declarations::t]?) -> Environment
         | 
| 83 94 |  | 
| 84 95 | 
             
                def resolve_declaration: (TypeNameResolver resolver, AST::Declarations::t decl, outer: Array[module_decl], prefix: Namespace) -> AST::Declarations::t
         | 
| 85 96 |  | 
| @@ -90,5 +101,14 @@ module RBS | |
| 90 101 | 
             
                def absolute_type_name: (TypeNameResolver, TypeName, context: Array[Namespace]) -> TypeName
         | 
| 91 102 |  | 
| 92 103 | 
             
                def inspect: () -> String
         | 
| 104 | 
            +
             | 
| 105 | 
            +
                def buffers: () -> Array[Buffer]
         | 
| 106 | 
            +
             | 
| 107 | 
            +
                def buffers_decls: () -> Hash[Buffer, Array[AST::Declarations::t]]
         | 
| 108 | 
            +
             | 
| 109 | 
            +
                # Construct new environment without declarations tested `true` by block.
         | 
| 110 | 
            +
                # Construction of new environment is done with `<<` so that nested declarations will work well.
         | 
| 111 | 
            +
                #
         | 
| 112 | 
            +
                def reject: () { (AST::Declarations::t) -> boolish } -> Environment
         | 
| 93 113 | 
             
              end
         | 
| 94 114 | 
             
            end
         | 
| @@ -0,0 +1,39 @@ | |
| 1 | 
            +
            module RBS
         | 
| 2 | 
            +
              class EnvironmentWalker
         | 
| 3 | 
            +
                class InstanceNode
         | 
| 4 | 
            +
                  attr_reader type_name: TypeName
         | 
| 5 | 
            +
                  def initialize: (type_name: TypeName) -> void
         | 
| 6 | 
            +
                end
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                class SingletonNode
         | 
| 9 | 
            +
                  attr_reader type_name: TypeName
         | 
| 10 | 
            +
                  def initialize: (type_name: TypeName) -> void
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                class TypeNameNode
         | 
| 14 | 
            +
                  attr_reader type_name: TypeName
         | 
| 15 | 
            +
                  def initialize: (type_name: TypeName) -> void
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                attr_reader env: Environment
         | 
| 19 | 
            +
                attr_reader only_ancestors: bool
         | 
| 20 | 
            +
                attr_reader builder: DefinitionBuilder
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                def initialize: (env: Environment) -> void
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                def only_ancestors!: (?bool only) -> self
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                def only_ancestors?: () -> bool
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                type node = InstanceNode | SingletonNode | TypeNameNode
         | 
| 29 | 
            +
                include TSort[node]
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                def tsort_each_node: () { (node) -> void } -> void
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                def tsort_each_child: (node) { (node) -> void } -> void
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                def each_type_name: (Types::t) { (TypeName) -> void } -> void
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                def each_type_node: (Types::t) { (node) -> void } -> void
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
            end
         | 
    
        data/sig/errors.rbs
    CHANGED
    
    | @@ -11,7 +11,27 @@ module RBS | |
| 11 11 | 
             
                def method_name_string: () -> String
         | 
| 12 12 | 
             
              end
         | 
| 13 13 |  | 
| 14 | 
            -
              class  | 
| 14 | 
            +
              # Error class for errors defined in RBS.
         | 
| 15 | 
            +
              #
         | 
| 16 | 
            +
              class BaseError < StandardError
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              # Error class for errors raised during parsing.
         | 
| 20 | 
            +
              #
         | 
| 21 | 
            +
              class ParsingError < BaseError
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              # Error class for errors raised during loading environments.
         | 
| 25 | 
            +
              #
         | 
| 26 | 
            +
              class LoadingError < BaseError
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              # Error class for errors raised during building definitions.
         | 
| 30 | 
            +
              #
         | 
| 31 | 
            +
              class DefinitionError < BaseError
         | 
| 32 | 
            +
              end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
              class InvalidTypeApplicationError < DefinitionError
         | 
| 15 35 | 
             
                attr_reader type_name: TypeName
         | 
| 16 36 | 
             
                attr_reader args: Array[Types::t]
         | 
| 17 37 | 
             
                attr_reader params: Array[Symbol]
         | 
| @@ -22,16 +42,16 @@ module RBS | |
| 22 42 | 
             
                def self.check!: (type_name: TypeName, args: Array[Types::t], params: Array[Symbol], location: Location?) -> void
         | 
| 23 43 | 
             
              end
         | 
| 24 44 |  | 
| 25 | 
            -
              class RecursiveAncestorError <  | 
| 45 | 
            +
              class RecursiveAncestorError < DefinitionError
         | 
| 26 46 | 
             
                attr_reader ancestors: Array[Definition::Ancestor::t]
         | 
| 27 | 
            -
                attr_reader location: Location
         | 
| 47 | 
            +
                attr_reader location: Location?
         | 
| 28 48 |  | 
| 29 49 | 
             
                def initialize: (ancestors: Array[Definition::Ancestor::t], location: Location?) -> void
         | 
| 30 50 |  | 
| 31 51 | 
             
                def self.check!: (Definition::Ancestor::t, ancestors: Array[Definition::Ancestor::t], location: Location?) -> void
         | 
| 32 52 | 
             
              end
         | 
| 33 53 |  | 
| 34 | 
            -
              class NoTypeFoundError <  | 
| 54 | 
            +
              class NoTypeFoundError < DefinitionError
         | 
| 35 55 | 
             
                attr_reader type_name: TypeName
         | 
| 36 56 | 
             
                attr_reader location: Location?
         | 
| 37 57 |  | 
| @@ -40,7 +60,7 @@ module RBS | |
| 40 60 | 
             
                def self.check!: (TypeName, env: Environment, location: Location?) -> TypeName
         | 
| 41 61 | 
             
              end
         | 
| 42 62 |  | 
| 43 | 
            -
              class NoSuperclassFoundError <  | 
| 63 | 
            +
              class NoSuperclassFoundError < DefinitionError
         | 
| 44 64 | 
             
                attr_reader type_name: TypeName
         | 
| 45 65 | 
             
                attr_reader location: Location?
         | 
| 46 66 |  | 
| @@ -49,7 +69,7 @@ module RBS | |
| 49 69 | 
             
                def self.check!: (TypeName, env: Environment, location: Location?) -> void
         | 
| 50 70 | 
             
              end
         | 
| 51 71 |  | 
| 52 | 
            -
              class NoSelfTypeFoundError <  | 
| 72 | 
            +
              class NoSelfTypeFoundError < DefinitionError
         | 
| 53 73 | 
             
                attr_reader type_name: TypeName
         | 
| 54 74 | 
             
                attr_reader location: Location?
         | 
| 55 75 |  | 
| @@ -58,7 +78,7 @@ module RBS | |
| 58 78 | 
             
                def self.check!: (AST::Declarations::Module::Self, env: Environment) -> void
         | 
| 59 79 | 
             
              end
         | 
| 60 80 |  | 
| 61 | 
            -
              class NoMixinFoundError <  | 
| 81 | 
            +
              class NoMixinFoundError < DefinitionError
         | 
| 62 82 | 
             
                attr_reader type_name: TypeName
         | 
| 63 83 | 
             
                attr_reader member: AST::Members::t
         | 
| 64 84 |  | 
| @@ -69,7 +89,7 @@ module RBS | |
| 69 89 | 
             
                def self.check!: (TypeName, env: Environment, member: AST::Members::t) -> void
         | 
| 70 90 | 
             
              end
         | 
| 71 91 |  | 
| 72 | 
            -
              class DuplicatedMethodDefinitionError <  | 
| 92 | 
            +
              class DuplicatedMethodDefinitionError < DefinitionError
         | 
| 73 93 | 
             
                type ty = Types::ClassSingleton | Types::ClassInstance | Types::Interface
         | 
| 74 94 | 
             
                type original = DefinitionBuilder::MethodBuilder::Methods::Definition::original
         | 
| 75 95 |  | 
| @@ -79,6 +99,8 @@ module RBS | |
| 79 99 |  | 
| 80 100 | 
             
                def initialize: (type: ty, method_name: Symbol, members: Array[original]) -> void
         | 
| 81 101 |  | 
| 102 | 
            +
                def type_name: () -> TypeName
         | 
| 103 | 
            +
             | 
| 82 104 | 
             
                def qualified_method_name: () -> String
         | 
| 83 105 |  | 
| 84 106 | 
             
                def location: () -> Location?
         | 
| @@ -86,7 +108,7 @@ module RBS | |
| 86 108 | 
             
                def other_locations: () -> Array[Location?]
         | 
| 87 109 | 
             
              end
         | 
| 88 110 |  | 
| 89 | 
            -
              class DuplicatedInterfaceMethodDefinitionError <  | 
| 111 | 
            +
              class DuplicatedInterfaceMethodDefinitionError < DefinitionError
         | 
| 90 112 | 
             
                type ty = Types::ClassSingleton | Types::ClassInstance | Types::Interface
         | 
| 91 113 | 
             
                type mixin_member = AST::Members::Include | AST::Members::Extend
         | 
| 92 114 |  | 
| @@ -96,25 +118,28 @@ module RBS | |
| 96 118 |  | 
| 97 119 | 
             
                def initialize: (type: ty, method_name: Symbol, member: mixin_member) -> void
         | 
| 98 120 |  | 
| 121 | 
            +
                def type_name: () -> TypeName
         | 
| 122 | 
            +
             | 
| 99 123 | 
             
                def qualified_method_name: () -> String
         | 
| 100 124 | 
             
              end
         | 
| 101 125 |  | 
| 102 | 
            -
              class UnknownMethodAliasError <  | 
| 126 | 
            +
              class UnknownMethodAliasError < DefinitionError
         | 
| 127 | 
            +
                attr_reader type_name: TypeName
         | 
| 103 128 | 
             
                attr_reader original_name: Symbol
         | 
| 104 129 | 
             
                attr_reader aliased_name: Symbol
         | 
| 105 130 | 
             
                attr_reader location: Location?
         | 
| 106 131 |  | 
| 107 | 
            -
                def initialize: (original_name: Symbol, aliased_name: Symbol, location: Location?) -> void
         | 
| 132 | 
            +
                def initialize: (type_name: TypeName, original_name: Symbol, aliased_name: Symbol, location: Location?) -> void
         | 
| 108 133 | 
             
              end
         | 
| 109 134 |  | 
| 110 | 
            -
              class SuperclassMismatchError <  | 
| 135 | 
            +
              class SuperclassMismatchError < DefinitionError
         | 
| 111 136 | 
             
                attr_reader name: TypeName
         | 
| 112 137 | 
             
                attr_reader entry: Environment::ClassEntry
         | 
| 113 138 |  | 
| 114 139 | 
             
                def initialize: (name: TypeName, entry: Environment::ClassEntry) -> void
         | 
| 115 140 | 
             
              end
         | 
| 116 141 |  | 
| 117 | 
            -
              class InvalidOverloadMethodError <  | 
| 142 | 
            +
              class InvalidOverloadMethodError < DefinitionError
         | 
| 118 143 | 
             
                attr_reader type_name: TypeName
         | 
| 119 144 | 
             
                attr_reader method_name: Symbol
         | 
| 120 145 | 
             
                attr_reader kind: :instance | :singleton
         | 
| @@ -123,21 +148,21 @@ module RBS | |
| 123 148 | 
             
                def initialize: (type_name: TypeName, method_name: Symbol, kind: :instance | :singleton, members: Array[AST::Members::MethodDefinition]) -> void
         | 
| 124 149 | 
             
              end
         | 
| 125 150 |  | 
| 126 | 
            -
              class GenericParameterMismatchError <  | 
| 151 | 
            +
              class GenericParameterMismatchError < LoadingError
         | 
| 127 152 | 
             
                attr_reader name: TypeName
         | 
| 128 153 | 
             
                attr_reader decl: AST::Declarations::Class | AST::Declarations::Module
         | 
| 129 154 |  | 
| 130 155 | 
             
                def initialize: (name: TypeName, decl: AST::Declarations::Class | AST::Declarations::Module) -> void
         | 
| 131 156 | 
             
              end
         | 
| 132 157 |  | 
| 133 | 
            -
              class DuplicatedDeclarationError <  | 
| 158 | 
            +
              class DuplicatedDeclarationError < LoadingError
         | 
| 134 159 | 
             
                attr_reader name: TypeName | Symbol
         | 
| 135 160 | 
             
                attr_reader decls: Array[AST::Declarations::t]
         | 
| 136 161 |  | 
| 137 162 | 
             
                def initialize: (TypeName | Symbol, *AST::Declarations::t) -> void
         | 
| 138 163 | 
             
              end
         | 
| 139 164 |  | 
| 140 | 
            -
              class InvalidVarianceAnnotationError <  | 
| 165 | 
            +
              class InvalidVarianceAnnotationError < DefinitionError
         | 
| 141 166 | 
             
                attr_reader type_name: TypeName
         | 
| 142 167 | 
             
                attr_reader param: AST::Declarations::ModuleTypeParams::TypeParam
         | 
| 143 168 | 
             
                attr_reader location: Location?
         | 
| @@ -145,7 +170,7 @@ module RBS | |
| 145 170 | 
             
                def initialize: (type_name: TypeName, param: AST::Declarations::ModuleTypeParams::TypeParam, location: Location?) -> void
         | 
| 146 171 | 
             
              end
         | 
| 147 172 |  | 
| 148 | 
            -
              class RecursiveAliasDefinitionError <  | 
| 173 | 
            +
              class RecursiveAliasDefinitionError < DefinitionError
         | 
| 149 174 | 
             
                type ty = Types::ClassInstance | Types::ClassSingleton | Types::Interface
         | 
| 150 175 | 
             
                type defn = DefinitionBuilder::MethodBuilder::Methods::Definition
         | 
| 151 176 |  |