rbs 1.6.1 → 1.7.0.beta.3

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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +18 -3
  3. data/.gitignore +10 -1
  4. data/CHANGELOG.md +25 -0
  5. data/Gemfile +1 -0
  6. data/Rakefile +22 -22
  7. data/core/enumerator.rbs +1 -0
  8. data/core/io.rbs +1 -1
  9. data/core/kernel.rbs +4 -4
  10. data/core/trace_point.rbs +1 -1
  11. data/ext/rbs_extension/constants.c +139 -0
  12. data/ext/rbs_extension/constants.h +72 -0
  13. data/ext/rbs_extension/extconf.rb +3 -0
  14. data/ext/rbs_extension/lexer.c +2533 -0
  15. data/ext/rbs_extension/lexer.h +161 -0
  16. data/ext/rbs_extension/lexer.re +140 -0
  17. data/ext/rbs_extension/lexstate.c +139 -0
  18. data/ext/rbs_extension/location.c +295 -0
  19. data/ext/rbs_extension/location.h +59 -0
  20. data/ext/rbs_extension/main.c +9 -0
  21. data/ext/rbs_extension/parser.c +2390 -0
  22. data/ext/rbs_extension/parser.h +18 -0
  23. data/ext/rbs_extension/parserstate.c +313 -0
  24. data/ext/rbs_extension/parserstate.h +141 -0
  25. data/ext/rbs_extension/rbs_extension.h +40 -0
  26. data/ext/rbs_extension/ruby_objs.c +521 -0
  27. data/ext/rbs_extension/ruby_objs.h +46 -0
  28. data/ext/rbs_extension/unescape.c +65 -0
  29. data/goodcheck.yml +1 -1
  30. data/lib/rbs/ast/comment.rb +0 -12
  31. data/lib/rbs/buffer.rb +4 -0
  32. data/lib/rbs/cli.rb +5 -8
  33. data/lib/rbs/collection/installer.rb +1 -0
  34. data/lib/rbs/collection/sources/git.rb +18 -3
  35. data/lib/rbs/errors.rb +28 -1
  36. data/lib/rbs/location.rb +221 -217
  37. data/lib/rbs/location_aux.rb +121 -0
  38. data/lib/rbs/locator.rb +10 -7
  39. data/lib/rbs/parser_aux.rb +63 -0
  40. data/lib/rbs/parser_compat/lexer_error.rb +4 -0
  41. data/lib/rbs/parser_compat/located_value.rb +5 -0
  42. data/lib/rbs/parser_compat/semantics_error.rb +4 -0
  43. data/lib/rbs/parser_compat/syntax_error.rb +4 -0
  44. data/lib/rbs/types.rb +2 -3
  45. data/lib/rbs/version.rb +1 -1
  46. data/lib/rbs/writer.rb +4 -2
  47. data/lib/rbs.rb +14 -7
  48. data/rbs.gemspec +2 -1
  49. data/sig/ancestor_builder.rbs +2 -2
  50. data/sig/annotation.rbs +2 -2
  51. data/sig/comment.rbs +7 -7
  52. data/sig/constant_table.rbs +1 -1
  53. data/sig/declarations.rbs +9 -9
  54. data/sig/definition.rbs +1 -1
  55. data/sig/definition_builder.rbs +2 -2
  56. data/sig/errors.rbs +40 -25
  57. data/sig/location.rbs +46 -78
  58. data/sig/locator.rbs +2 -2
  59. data/sig/members.rbs +7 -7
  60. data/sig/method_types.rbs +3 -3
  61. data/sig/parser.rbs +15 -20
  62. data/sig/rbs.rbs +4 -0
  63. data/sig/types.rbs +45 -27
  64. data/sig/writer.rbs +1 -1
  65. data/stdlib/io-console/0/io-console.rbs +137 -0
  66. data/stdlib/json/0/json.rbs +3 -3
  67. data/stdlib/net-http/0/net-http.rbs +2 -1
  68. data/stdlib/tempfile/0/tempfile.rbs +4 -6
  69. metadata +32 -7
  70. data/lib/rbs/parser.rb +0 -3614
@@ -0,0 +1,63 @@
1
+ module RBS
2
+ class Parser
3
+ def self.parse_type(source, line: 1, column: 0, variables: [])
4
+ _parse_type(buffer(source), line, column, variables)
5
+ end
6
+
7
+ def self.parse_method_type(source, line: 1, column: 0, variables: [])
8
+ _parse_method_type(buffer(source), line, column, variables)
9
+ end
10
+
11
+ def self.parse_signature(source, line: 1, column: 0)
12
+ _parse_signature(buffer(source), line, column)
13
+ end
14
+
15
+ def self.buffer(source)
16
+ case source
17
+ when String
18
+ Buffer.new(content: source, name: "a.rbs")
19
+ when Buffer
20
+ source
21
+ end
22
+ end
23
+
24
+ autoload :SyntaxError, "rbs/parser_compat/syntax_error"
25
+ autoload :SemanticsError, "rbs/parser_compat/semantics_error"
26
+ autoload :LexerError, "rbs/parser_compat/lexer_error"
27
+ autoload :LocatedValue, "rbs/parser_compat/located_value"
28
+
29
+ KEYWORDS = Set.new(
30
+ %w(
31
+ bool
32
+ bot
33
+ class
34
+ instance
35
+ interface
36
+ nil
37
+ self
38
+ singleton
39
+ top
40
+ void
41
+ type
42
+ unchecked
43
+ in
44
+ out
45
+ end
46
+ def
47
+ include
48
+ extend
49
+ prepend
50
+ alias
51
+ module
52
+ attr_reader
53
+ attr_writer
54
+ attr_accessor
55
+ public
56
+ private
57
+ untyped
58
+ true
59
+ false
60
+ )
61
+ )
62
+ end
63
+ end
@@ -0,0 +1,4 @@
1
+ RBS.print_warning {
2
+ "RBS::Parser::LexerError is deprecated and will be deleted in RBS 2.0."
3
+ }
4
+ RBS::Parser::LexerError = RBS::ParsingError
@@ -0,0 +1,5 @@
1
+ RBS.print_warning {
2
+ "RBS::Parser::LocatedValue is deprecated and will be deleted in RBS 2.0."
3
+ }
4
+ class RBS::Parser::LocatedValue
5
+ end
@@ -0,0 +1,4 @@
1
+ RBS.print_warning {
2
+ "RBS::Parser::SemanticsError is deprecated and will be deleted in RBS 2.0."
3
+ }
4
+ RBS::Parser::SemanticsError = RBS::ParsingError
@@ -0,0 +1,4 @@
1
+ RBS.print_warning {
2
+ "RBS::Parser::SyntaxError is deprecated and will be deleted in RBS 2.0."
3
+ }
4
+ RBS::Parser::SyntaxError = RBS::ParsingError
data/lib/rbs/types.rb CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  module RBS
3
2
  module Types
4
3
  module NoFreeVariables
@@ -434,7 +433,7 @@ module RBS
434
433
  return "{ }" if self.fields.empty?
435
434
 
436
435
  fields = self.fields.map do |key, type|
437
- if key.is_a?(Symbol) && key.match?(/\A[A-Za-z_][A-Za-z_]*\z/) && !key.match?(Parser::KEYWORDS_RE)
436
+ if key.is_a?(Symbol) && key.match?(/\A[A-Za-z_][A-Za-z_]*\z/) && !Parser::KEYWORDS.include?(key)
438
437
  "#{key}: #{type}"
439
438
  else
440
439
  "#{key.inspect} => #{type}"
@@ -691,7 +690,7 @@ module RBS
691
690
 
692
691
  def to_s
693
692
  if name
694
- if /\A#{Parser::KEYWORDS_RE}\z/.match?(name)
693
+ if Parser::KEYWORDS.include?(name)
695
694
  "#{type} `#{name}`"
696
695
  else
697
696
  "#{type} #{name}"
data/lib/rbs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RBS
2
- VERSION = "1.6.1"
2
+ VERSION = "1.7.0.beta.3"
3
3
  end
data/lib/rbs/writer.rb CHANGED
@@ -232,8 +232,10 @@ module RBS
232
232
  def method_name(name)
233
233
  s = name.to_s
234
234
 
235
- if [:tOPERATOR, :kAMP, :kHAT, :kSTAR, :kLT, :kEXCLAMATION, :kSTAR2, :kBAR].include?(Parser::PUNCTS[s]) ||
236
- (/\A[a-zA-Z_]\w*[?!=]?\z/.match?(s) && !/\Aself\??\z/.match?(s))
235
+ case s
236
+ when /\A(_?)[A-Za-z_]\w*(\?|!|=)?\Z/
237
+ s
238
+ when *%w(| ^ & <=> == === =~ > >= < <= << >> + - * / % ** ~ +@ -@ [] []= ` ! != !~)
237
239
  s
238
240
  else
239
241
  "`#{s}`"
data/lib/rbs.rb CHANGED
@@ -12,7 +12,6 @@ require "strscan"
12
12
  require "rbs/char_scanner"
13
13
  require "rbs/errors"
14
14
  require "rbs/buffer"
15
- require "rbs/location"
16
15
  require "rbs/namespace"
17
16
  require "rbs/type_name"
18
17
  require "rbs/types"
@@ -47,12 +46,9 @@ require "rbs/locator"
47
46
  require "rbs/type_alias_dependency"
48
47
  require "rbs/collection"
49
48
 
50
- begin
51
- require "rbs/parser"
52
- rescue LoadError
53
- STDERR.puts "Missing parser Ruby code? Running `rake parser` may solve the issue"
54
- raise
55
- end
49
+ require "rbs_extension"
50
+ require "rbs/parser_aux"
51
+ require "rbs/location_aux"
56
52
 
57
53
  module RBS
58
54
  class <<self
@@ -72,5 +68,16 @@ module RBS
72
68
  @logger_level = level
73
69
  @logger = nil
74
70
  end
71
+
72
+ def print_warning()
73
+ @warnings ||= Set[]
74
+
75
+ message = yield()
76
+
77
+ unless @warnings.include?(message)
78
+ @warnings << message
79
+ logger.warn { message }
80
+ end
81
+ end
75
82
  end
76
83
  end
data/rbs.gemspec CHANGED
@@ -30,7 +30,8 @@ Gem::Specification.new do |spec|
30
30
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
31
31
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|bin)/}) }
32
32
  end
33
- spec.files << "lib/rbs/parser.rb"
33
+ spec.extensions = %w{ext/rbs_extension/extconf.rb}
34
+
34
35
  spec.bindir = "exe"
35
36
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
37
  spec.require_paths = ["lib"]
@@ -82,7 +82,7 @@ module RBS
82
82
  def mixin_ancestors: (Environment::ClassEntry | Environment::ModuleEntry,
83
83
  TypeName,
84
84
  included_modules: Array[Definition::Ancestor::Instance]?,
85
- included_interfaces:Array[Definition::Ancestor::Instance]?,
85
+ included_interfaces: Array[Definition::Ancestor::Instance]?,
86
86
  prepended_modules: Array[Definition::Ancestor::Instance]?,
87
87
  extended_modules: Array[Definition::Ancestor::Instance]?,
88
88
  extended_interfaces: Array[Definition::Ancestor::Instance]?) -> void
@@ -91,7 +91,7 @@ module RBS
91
91
  TypeName,
92
92
  align_params: Substitution?,
93
93
  included_modules: Array[Definition::Ancestor::Instance]?,
94
- included_interfaces:Array[Definition::Ancestor::Instance]?,
94
+ included_interfaces: Array[Definition::Ancestor::Instance]?,
95
95
  prepended_modules: Array[Definition::Ancestor::Instance]?,
96
96
  extended_modules: Array[Definition::Ancestor::Instance]?,
97
97
  extended_interfaces: Array[Definition::Ancestor::Instance]?) -> void
data/sig/annotation.rbs CHANGED
@@ -10,9 +10,9 @@ module RBS
10
10
  #
11
11
  class Annotation
12
12
  attr_reader string: String
13
- attr_reader location: Location?
13
+ attr_reader location: Location[untyped, untyped]?
14
14
 
15
- def initialize: (string: String, location: Location?) -> void
15
+ def initialize: (string: String, location: Location[untyped, untyped]?) -> void
16
16
 
17
17
  def ==: (untyped other) -> bool
18
18
 
data/sig/comment.rbs CHANGED
@@ -2,15 +2,17 @@ module RBS
2
2
  module AST
3
3
  # RBS allows writing documentation of declarations and members.
4
4
  #
5
- # # This is a doc for class.
6
- # class Hello
7
- # end
5
+ # ```
6
+ # # This is a doc for class.
7
+ # class Hello
8
+ # end
9
+ # ```
8
10
  #
9
11
  class Comment
10
12
  attr_reader string: String
11
- attr_reader location: Location?
13
+ attr_reader location: Location[bot, bot]?
12
14
 
13
- def initialize: (string: String, location: Location?) -> void
15
+ def initialize: (string: String, location: Location[bot, bot]?) -> void
14
16
 
15
17
  def ==: (untyped other) -> bool
16
18
 
@@ -19,8 +21,6 @@ module RBS
19
21
  def hash: () -> Integer
20
22
 
21
23
  include _ToJson
22
-
23
- def concat: (string: String, location: Location?) -> self
24
24
  end
25
25
  end
26
26
  end
@@ -9,7 +9,7 @@ module RBS
9
9
 
10
10
  def absolute_type: (Types::t, context: Array[Namespace]) -> Types::t
11
11
 
12
- def absolute_type_name: (TypeName, context: Array[Namespace], location: Location?) -> TypeName
12
+ def absolute_type_name: (TypeName, context: Array[Namespace], location: Location[untyped, untyped]?) -> TypeName
13
13
 
14
14
  def name_to_constant: (TypeName) -> Constant?
15
15
 
data/sig/declarations.rbs CHANGED
@@ -17,7 +17,7 @@ module RBS
17
17
  # ^^^^^^^^^ unchecked
18
18
  # ^^^ variance
19
19
  # ^^^^ name
20
- type loc = Location::WithChildren[:name, :variance | :unchecked]
20
+ type loc = Location[:name, :variance | :unchecked]
21
21
 
22
22
  attr_reader name: Symbol
23
23
  attr_reader variance: variance
@@ -86,7 +86,7 @@ module RBS
86
86
  # ^^^^^ name
87
87
  # ^^^^^^^^ args
88
88
  #
89
- type loc = Location::WithChildren[:name, :args]
89
+ type loc = Location[:name, :args]
90
90
 
91
91
  attr_reader name: TypeName
92
92
  attr_reader args: Array[Types::t]
@@ -112,7 +112,7 @@ module RBS
112
112
  # ^ lt
113
113
  # ^^^ end
114
114
  #
115
- type loc = Location::WithChildren[:keyword | :name | :end, :type_params | :lt]
115
+ type loc = Location[:keyword | :name | :end, :type_params | :lt]
116
116
 
117
117
  include NestedDeclarationHelper
118
118
  include MixinHelper
@@ -137,7 +137,7 @@ module RBS
137
137
  # ^^^^^ name
138
138
  # ^^^^^^^^ args
139
139
  #
140
- type loc = Location::WithChildren[:name, :args]
140
+ type loc = Location[:name, :args]
141
141
 
142
142
  attr_reader name: TypeName
143
143
  attr_reader args: Array[Types::t]
@@ -166,7 +166,7 @@ module RBS
166
166
  # ^^^^^^^^^^^ self_types
167
167
  # ^^^ end
168
168
  #
169
- type loc = Location::WithChildren[:keyword | :name | :end, :type_params | :colon | :self_types]
169
+ type loc = Location[:keyword | :name | :end, :type_params | :colon | :self_types]
170
170
 
171
171
  include NestedDeclarationHelper
172
172
  include MixinHelper
@@ -199,7 +199,7 @@ module RBS
199
199
  # ^^^^^^ type_params
200
200
  # ^^^ end
201
201
  #
202
- type loc = Location::WithChildren[:name | :keyword | :end, :type_params]
202
+ type loc = Location[:name | :keyword | :end, :type_params]
203
203
 
204
204
  attr_reader name: TypeName
205
205
  attr_reader type_params: ModuleTypeParams
@@ -221,7 +221,7 @@ module RBS
221
221
  # ^^^^ keyword
222
222
  # ^^^ name
223
223
  # ^ eq
224
- type loc = Location::WithChildren[:keyword | :name | :eq, bot]
224
+ type loc = Location[:keyword | :name | :eq, bot]
225
225
 
226
226
  attr_reader name: TypeName
227
227
  attr_reader type: Types::t
@@ -240,7 +240,7 @@ module RBS
240
240
  # ^^^^^^^ name
241
241
  # ^ colon
242
242
  #
243
- type loc = Location::WithChildren[:name | :colon, bot]
243
+ type loc = Location[:name | :colon, bot]
244
244
 
245
245
  attr_reader name: TypeName
246
246
  attr_reader type: Types::t
@@ -258,7 +258,7 @@ module RBS
258
258
  # ^^^^^ name
259
259
  # ^ colon
260
260
  #
261
- type loc = Location::WithChildren[:name | :colon, bot]
261
+ type loc = Location[:name | :colon, bot]
262
262
 
263
263
  attr_reader name: Symbol
264
264
  attr_reader type: Types::t
data/sig/definition.rbs CHANGED
@@ -90,7 +90,7 @@ module RBS
90
90
 
91
91
  def initialize: (type_name: TypeName, params: Array[Symbol], ancestors: Array[Ancestor::t]) -> void
92
92
 
93
- def apply: (Array[Types::t], location: Location?) -> Array[Ancestor::t]
93
+ def apply: (Array[Types::t], location: Location[untyped, untyped]?) -> Array[Ancestor::t]
94
94
  end
95
95
 
96
96
  class SingletonAncestors
@@ -14,7 +14,7 @@ module RBS
14
14
 
15
15
  def validate_super_class!: (TypeName, Environment::ClassEntry) -> void
16
16
 
17
- def ensure_namespace!: (Namespace, location: Location?) -> void
17
+ def ensure_namespace!: (Namespace, location: Location[untyped, untyped]?) -> void
18
18
 
19
19
  def build_interface: (TypeName) -> Definition
20
20
 
@@ -37,7 +37,7 @@ module RBS
37
37
 
38
38
  def validate_type_params: (Definition, ancestors: AncestorBuilder::OneAncestors, methods: MethodBuilder::Methods) -> void
39
39
 
40
- def source_location: (Definition::Ancestor::Instance::source, AST::Declarations::t) -> Location?
40
+ def source_location: (Definition::Ancestor::Instance::source, AST::Declarations::t) -> Location[untyped, untyped]?
41
41
 
42
42
  def insert_variable: (TypeName, Hash[Symbol, Definition::Variable], name: Symbol, type: Types::t) -> void
43
43
 
data/sig/errors.rbs CHANGED
@@ -19,6 +19,21 @@ module RBS
19
19
  # Error class for errors raised during parsing.
20
20
  #
21
21
  class ParsingError < BaseError
22
+ attr_reader location: Location[untyped, untyped]
23
+ attr_reader error_message: String
24
+ attr_reader token_type: String
25
+
26
+ def initialize: (Location[untyped, untyped], String error_message, String token_type) -> void
27
+
28
+ def error_value: () -> String
29
+
30
+ def token_str: () -> String
31
+ end
32
+
33
+ class Parser
34
+ SemanticsError: singleton(ParsingError)
35
+ SyntaxError: singleton(ParsingError)
36
+ LexerError: singleton(ParsingError)
22
37
  end
23
38
 
24
39
  # Error class for errors raised during loading environments.
@@ -35,45 +50,45 @@ module RBS
35
50
  attr_reader type_name: TypeName
36
51
  attr_reader args: Array[Types::t]
37
52
  attr_reader params: Array[Symbol]
38
- attr_reader location: Location?
53
+ attr_reader location: Location[untyped, untyped]?
39
54
 
40
- def initialize: (type_name: TypeName, args: Array[Types::t], params: Array[Symbol], location: Location?) -> void
55
+ def initialize: (type_name: TypeName, args: Array[Types::t], params: Array[Symbol], location: Location[untyped, untyped]?) -> void
41
56
 
42
- def self.check!: (type_name: TypeName, args: Array[Types::t], params: Array[Symbol], location: Location?) -> void
57
+ def self.check!: (type_name: TypeName, args: Array[Types::t], params: Array[Symbol], location: Location[untyped, untyped]?) -> void
43
58
  end
44
59
 
45
60
  class RecursiveAncestorError < DefinitionError
46
61
  attr_reader ancestors: Array[Definition::Ancestor::t]
47
- attr_reader location: Location?
62
+ attr_reader location: Location[untyped, untyped]?
48
63
 
49
- def initialize: (ancestors: Array[Definition::Ancestor::t], location: Location?) -> void
64
+ def initialize: (ancestors: Array[Definition::Ancestor::t], location: Location[untyped, untyped]?) -> void
50
65
 
51
- def self.check!: (Definition::Ancestor::t, ancestors: Array[Definition::Ancestor::t], location: Location?) -> void
66
+ def self.check!: (Definition::Ancestor::t, ancestors: Array[Definition::Ancestor::t], location: Location[untyped, untyped]?) -> void
52
67
  end
53
68
 
54
69
  class NoTypeFoundError < DefinitionError
55
70
  attr_reader type_name: TypeName
56
- attr_reader location: Location?
71
+ attr_reader location: Location[untyped, untyped]?
57
72
 
58
- def initialize: (type_name: TypeName, location: Location?) -> void
73
+ def initialize: (type_name: TypeName, location: Location[untyped, untyped]?) -> void
59
74
 
60
- def self.check!: (TypeName, env: Environment, location: Location?) -> TypeName
75
+ def self.check!: (TypeName, env: Environment, location: Location[untyped, untyped]?) -> TypeName
61
76
  end
62
77
 
63
78
  class NoSuperclassFoundError < DefinitionError
64
79
  attr_reader type_name: TypeName
65
- attr_reader location: Location?
80
+ attr_reader location: Location[untyped, untyped]?
66
81
 
67
- def initialize: (type_name: TypeName, location: Location?) -> void
82
+ def initialize: (type_name: TypeName, location: Location[untyped, untyped]?) -> void
68
83
 
69
- def self.check!: (TypeName, env: Environment, location: Location?) -> void
84
+ def self.check!: (TypeName, env: Environment, location: Location[untyped, untyped]?) -> void
70
85
  end
71
86
 
72
87
  class NoSelfTypeFoundError < DefinitionError
73
88
  attr_reader type_name: TypeName
74
- attr_reader location: Location?
89
+ attr_reader location: Location[untyped, untyped]?
75
90
 
76
- def initialize: (type_name: TypeName, location: Location?) -> void
91
+ def initialize: (type_name: TypeName, location: Location[untyped, untyped]?) -> void
77
92
 
78
93
  def self.check!: (AST::Declarations::Module::Self, env: Environment) -> void
79
94
  end
@@ -84,7 +99,7 @@ module RBS
84
99
 
85
100
  def initialize: (type_name: TypeName, member: AST::Members::t) -> void
86
101
 
87
- def location: () -> Location?
102
+ def location: () -> Location[untyped, untyped]?
88
103
 
89
104
  def self.check!: (TypeName, env: Environment, member: AST::Members::t) -> void
90
105
  end
@@ -103,9 +118,9 @@ module RBS
103
118
 
104
119
  def qualified_method_name: () -> String
105
120
 
106
- def location: () -> Location?
121
+ def location: () -> Location[untyped, untyped]?
107
122
 
108
- def other_locations: () -> Array[Location?]
123
+ def other_locations: () -> Array[Location[untyped, untyped]?]
109
124
  end
110
125
 
111
126
  class DuplicatedInterfaceMethodDefinitionError < DefinitionError
@@ -127,9 +142,9 @@ module RBS
127
142
  attr_reader type_name: TypeName
128
143
  attr_reader original_name: Symbol
129
144
  attr_reader aliased_name: Symbol
130
- attr_reader location: Location?
145
+ attr_reader location: Location[untyped, untyped]?
131
146
 
132
- def initialize: (type_name: TypeName, original_name: Symbol, aliased_name: Symbol, location: Location?) -> void
147
+ def initialize: (type_name: TypeName, original_name: Symbol, aliased_name: Symbol, location: Location[untyped, untyped]?) -> void
133
148
  end
134
149
 
135
150
  class SuperclassMismatchError < DefinitionError
@@ -165,9 +180,9 @@ module RBS
165
180
  class InvalidVarianceAnnotationError < DefinitionError
166
181
  attr_reader type_name: TypeName
167
182
  attr_reader param: AST::Declarations::ModuleTypeParams::TypeParam
168
- attr_reader location: Location?
183
+ attr_reader location: Location[untyped, untyped]?
169
184
 
170
- def initialize: (type_name: TypeName, param: AST::Declarations::ModuleTypeParams::TypeParam, location: Location?) -> void
185
+ def initialize: (type_name: TypeName, param: AST::Declarations::ModuleTypeParams::TypeParam, location: Location[untyped, untyped]?) -> void
171
186
  end
172
187
 
173
188
  class RecursiveAliasDefinitionError < DefinitionError
@@ -179,7 +194,7 @@ module RBS
179
194
 
180
195
  def initialize: (type: ty, defs: Array[defn]) -> void
181
196
 
182
- def location: () -> Location?
197
+ def location: () -> Location[untyped, untyped]?
183
198
  end
184
199
 
185
200
  class MixinClassError < DefinitionError
@@ -190,7 +205,7 @@ module RBS
190
205
 
191
206
  def initialize: (type_name: TypeName, member: member) -> void
192
207
 
193
- def location: () -> Location?
208
+ def location: () -> Location[untyped, untyped]?
194
209
 
195
210
  def self.check!: (type_name: TypeName, env: Environment, member: member) -> void
196
211
 
@@ -199,9 +214,9 @@ module RBS
199
214
 
200
215
  class RecursiveTypeAliasError < LoadingError
201
216
  attr_reader alias_names: Array[TypeName]
202
- attr_reader location: Location
217
+ attr_reader location: Location[untyped, untyped]?
203
218
 
204
- def initialize: (alias_names: Array[TypeName], location: Location) -> void
219
+ def initialize: (alias_names: Array[TypeName], location: Location[untyped, untyped]?) -> void
205
220
 
206
221
  def name: () -> String
207
222
  end