rbs 1.6.0 → 1.7.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +0 -4
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +26 -0
  5. data/Gemfile +1 -0
  6. data/Rakefile +7 -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 +140 -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 +1070 -0
  15. data/ext/rbs_extension/lexer.h +145 -0
  16. data/ext/rbs_extension/location.c +295 -0
  17. data/ext/rbs_extension/location.h +59 -0
  18. data/ext/rbs_extension/main.c +9 -0
  19. data/ext/rbs_extension/parser.c +2422 -0
  20. data/ext/rbs_extension/parser.h +23 -0
  21. data/ext/rbs_extension/parserstate.c +313 -0
  22. data/ext/rbs_extension/parserstate.h +141 -0
  23. data/ext/rbs_extension/rbs_extension.h +40 -0
  24. data/ext/rbs_extension/ruby_objs.c +585 -0
  25. data/ext/rbs_extension/ruby_objs.h +46 -0
  26. data/ext/rbs_extension/unescape.c +65 -0
  27. data/goodcheck.yml +1 -1
  28. data/lib/rbs/ast/comment.rb +0 -12
  29. data/lib/rbs/buffer.rb +4 -0
  30. data/lib/rbs/cli.rb +5 -8
  31. data/lib/rbs/collection/sources/git.rb +18 -3
  32. data/lib/rbs/errors.rb +22 -1
  33. data/lib/rbs/location.rb +221 -217
  34. data/lib/rbs/location_aux.rb +121 -0
  35. data/lib/rbs/locator.rb +10 -7
  36. data/lib/rbs/parser_aux.rb +31 -0
  37. data/lib/rbs/types.rb +2 -3
  38. data/lib/rbs/version.rb +1 -1
  39. data/lib/rbs/writer.rb +4 -2
  40. data/lib/rbs.rb +3 -7
  41. data/rbs.gemspec +2 -1
  42. data/sig/ancestor_builder.rbs +2 -2
  43. data/sig/annotation.rbs +2 -2
  44. data/sig/comment.rbs +7 -7
  45. data/sig/constant_table.rbs +1 -1
  46. data/sig/declarations.rbs +9 -9
  47. data/sig/definition.rbs +1 -1
  48. data/sig/definition_builder.rbs +2 -2
  49. data/sig/errors.rbs +40 -25
  50. data/sig/location.rbs +46 -78
  51. data/sig/locator.rbs +2 -2
  52. data/sig/members.rbs +7 -7
  53. data/sig/method_types.rbs +3 -3
  54. data/sig/parser.rbs +13 -20
  55. data/sig/types.rbs +45 -27
  56. data/sig/writer.rbs +1 -1
  57. data/stdlib/json/0/json.rbs +3 -3
  58. metadata +25 -7
  59. data/lib/rbs/parser.rb +0 -3614
@@ -0,0 +1,121 @@
1
+ module RBS
2
+ class Location
3
+ def inspect
4
+ rks = each_required_key.to_a
5
+ ops = each_optional_key.to_a.map {|x| "?#{x}" }
6
+ "#<#{self.class}:#{self.__id__} buffer=#{buffer.name}, start=#{start_line}:#{start_column}, pos=#{start_pos}...#{end_pos}, children=#{(rks + ops).join(",")} source='#{source.lines.first&.chomp}'>"
7
+ end
8
+
9
+ def self.new(buffer_ = nil, start_pos_ = nil, end_pos_ = nil, buffer: nil, start_pos: nil, end_pos: nil)
10
+ __skip__ =
11
+ begin
12
+ if buffer && start_pos && end_pos
13
+ super(buffer, start_pos, end_pos)
14
+ else
15
+ super(buffer_, start_pos_, end_pos_)
16
+ end
17
+ end
18
+ end
19
+
20
+ WithChildren = self
21
+
22
+ def name
23
+ buffer.name
24
+ end
25
+
26
+ def start_line
27
+ start_loc[0]
28
+ end
29
+
30
+ def start_column
31
+ start_loc[1]
32
+ end
33
+
34
+ def end_line
35
+ end_loc[0]
36
+ end
37
+
38
+ def end_column
39
+ end_loc[1]
40
+ end
41
+
42
+ def start_loc
43
+ @start_loc ||= begin
44
+ _start_loc || buffer.pos_to_loc(start_pos)
45
+ end
46
+ end
47
+
48
+ def end_loc
49
+ @end_loc ||= begin
50
+ _end_loc || buffer.pos_to_loc(end_pos)
51
+ end
52
+ end
53
+
54
+ def range
55
+ @range ||= start_pos...end_pos
56
+ end
57
+
58
+ def source
59
+ @source ||= buffer.content[range] or raise
60
+ end
61
+
62
+ def to_s
63
+ "#{name || "-"}:#{start_line}:#{start_column}...#{end_line}:#{end_column}"
64
+ end
65
+
66
+ def ==(other)
67
+ other.is_a?(Location) &&
68
+ other.buffer == buffer &&
69
+ other.start_pos == start_pos &&
70
+ other.end_pos == end_pos
71
+ end
72
+
73
+ def to_json(state = _ = nil)
74
+ {
75
+ start: {
76
+ line: start_line,
77
+ column: start_column
78
+ },
79
+ end: {
80
+ line: end_line,
81
+ column: end_column
82
+ },
83
+ buffer: {
84
+ name: name&.to_s
85
+ }
86
+ }.to_json(state)
87
+ end
88
+
89
+ def self.to_string(location, default: "*:*:*...*:*")
90
+ location&.to_s || default
91
+ end
92
+
93
+ def add_required_child(name, range)
94
+ _add_required_child(name, range.begin, range.end)
95
+ end
96
+
97
+ def add_optional_child(name, range)
98
+ if range
99
+ _add_optional_child(name, range.begin, range.end)
100
+ else
101
+ _add_optional_no_child(name);
102
+ end
103
+ end
104
+
105
+ def each_optional_key(&block)
106
+ if block
107
+ _optional_keys.uniq.each(&block)
108
+ else
109
+ enum_for(:each_optional_key)
110
+ end
111
+ end
112
+
113
+ def each_required_key(&block)
114
+ if block
115
+ _required_keys.uniq.each(&block)
116
+ else
117
+ enum_for(:each_required_key)
118
+ end
119
+ end
120
+ end
121
+ end
data/lib/rbs/locator.rb CHANGED
@@ -172,16 +172,19 @@ module RBS
172
172
 
173
173
  def find_in_loc(pos, location:, array:)
174
174
  if test_loc(pos, location: location)
175
- if location.is_a?(Location::WithChildren)
176
- location.optional_children.each do |key, range|
177
- if range === pos
178
- array.unshift(key)
179
- return true
175
+ if location.is_a?(Location)
176
+ location.each_optional_key do |key|
177
+ if loc = location[key]
178
+ if loc.range === pos
179
+ array.unshift(key)
180
+ return true
181
+ end
180
182
  end
181
183
  end
182
184
 
183
- location.required_children.each do |key, range|
184
- if range === pos
185
+ location.each_required_key do |key|
186
+ loc = location[key] or raise
187
+ if loc.range === pos
185
188
  array.unshift(key)
186
189
  return true
187
190
  end
@@ -0,0 +1,31 @@
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
+ SyntaxError = ParsingError
25
+ SemanticsError = ParsingError
26
+ LexerError = ParsingError
27
+
28
+ class LocatedValue
29
+ end
30
+ end
31
+ end
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.key?(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.key?(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.0"
2
+ VERSION = "1.7.0.beta.2"
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
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