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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +18 -3
- data/.gitignore +10 -1
- data/CHANGELOG.md +25 -0
- data/Gemfile +1 -0
- data/Rakefile +22 -22
- data/core/enumerator.rbs +1 -0
- data/core/io.rbs +1 -1
- data/core/kernel.rbs +4 -4
- data/core/trace_point.rbs +1 -1
- data/ext/rbs_extension/constants.c +139 -0
- data/ext/rbs_extension/constants.h +72 -0
- data/ext/rbs_extension/extconf.rb +3 -0
- data/ext/rbs_extension/lexer.c +2533 -0
- data/ext/rbs_extension/lexer.h +161 -0
- data/ext/rbs_extension/lexer.re +140 -0
- data/ext/rbs_extension/lexstate.c +139 -0
- data/ext/rbs_extension/location.c +295 -0
- data/ext/rbs_extension/location.h +59 -0
- data/ext/rbs_extension/main.c +9 -0
- data/ext/rbs_extension/parser.c +2390 -0
- data/ext/rbs_extension/parser.h +18 -0
- data/ext/rbs_extension/parserstate.c +313 -0
- data/ext/rbs_extension/parserstate.h +141 -0
- data/ext/rbs_extension/rbs_extension.h +40 -0
- data/ext/rbs_extension/ruby_objs.c +521 -0
- data/ext/rbs_extension/ruby_objs.h +46 -0
- data/ext/rbs_extension/unescape.c +65 -0
- data/goodcheck.yml +1 -1
- data/lib/rbs/ast/comment.rb +0 -12
- data/lib/rbs/buffer.rb +4 -0
- data/lib/rbs/cli.rb +5 -8
- data/lib/rbs/collection/installer.rb +1 -0
- data/lib/rbs/collection/sources/git.rb +18 -3
- data/lib/rbs/errors.rb +28 -1
- data/lib/rbs/location.rb +221 -217
- data/lib/rbs/location_aux.rb +121 -0
- data/lib/rbs/locator.rb +10 -7
- data/lib/rbs/parser_aux.rb +63 -0
- data/lib/rbs/parser_compat/lexer_error.rb +4 -0
- data/lib/rbs/parser_compat/located_value.rb +5 -0
- data/lib/rbs/parser_compat/semantics_error.rb +4 -0
- data/lib/rbs/parser_compat/syntax_error.rb +4 -0
- data/lib/rbs/types.rb +2 -3
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +4 -2
- data/lib/rbs.rb +14 -7
- data/rbs.gemspec +2 -1
- data/sig/ancestor_builder.rbs +2 -2
- data/sig/annotation.rbs +2 -2
- data/sig/comment.rbs +7 -7
- data/sig/constant_table.rbs +1 -1
- data/sig/declarations.rbs +9 -9
- data/sig/definition.rbs +1 -1
- data/sig/definition_builder.rbs +2 -2
- data/sig/errors.rbs +40 -25
- data/sig/location.rbs +46 -78
- data/sig/locator.rbs +2 -2
- data/sig/members.rbs +7 -7
- data/sig/method_types.rbs +3 -3
- data/sig/parser.rbs +15 -20
- data/sig/rbs.rbs +4 -0
- data/sig/types.rbs +45 -27
- data/sig/writer.rbs +1 -1
- data/stdlib/io-console/0/io-console.rbs +137 -0
- data/stdlib/json/0/json.rbs +3 -3
- data/stdlib/net-http/0/net-http.rbs +2 -1
- data/stdlib/tempfile/0/tempfile.rbs +4 -6
- metadata +32 -7
- data/lib/rbs/parser.rb +0 -3614
data/sig/location.rbs
CHANGED
@@ -1,17 +1,27 @@
|
|
1
1
|
module RBS
|
2
2
|
# Location is the range on buffer, `start_pos..end_pos`.
|
3
3
|
# The index is based on characters.
|
4
|
-
|
4
|
+
#
|
5
|
+
# A location can have _child_ locations.
|
6
|
+
#
|
7
|
+
# ```
|
8
|
+
#
|
9
|
+
# ```
|
10
|
+
#
|
11
|
+
class Location[RequiredChildKeys, OptionalChildKeys]
|
5
12
|
# The buffer this location points on.
|
6
|
-
attr_reader buffer: Buffer
|
13
|
+
attr_reader buffer (): Buffer
|
7
14
|
|
8
15
|
# The index of character the range starts from.
|
9
|
-
attr_reader start_pos: Integer
|
16
|
+
attr_reader start_pos (): Integer
|
10
17
|
|
11
18
|
# The index of character the range ends at.
|
12
|
-
attr_reader end_pos: Integer
|
19
|
+
attr_reader end_pos (): Integer
|
13
20
|
|
14
|
-
def initialize: (
|
21
|
+
def initialize: (Buffer, Integer start_pos, Integer end_pos) -> void
|
22
|
+
|
23
|
+
def self.new: (Buffer, Integer start_pos, Integer end_pos) -> instance
|
24
|
+
| (buffer: Buffer, start_pos: Integer, end_pos: Integer) -> instance
|
15
25
|
|
16
26
|
def inspect: () -> String
|
17
27
|
|
@@ -19,22 +29,22 @@ module RBS
|
|
19
29
|
def name: () -> untyped
|
20
30
|
|
21
31
|
# Line of the `start_pos` (1 origin)
|
22
|
-
|
32
|
+
attr_reader start_line (): Integer
|
23
33
|
|
24
34
|
# Column of the `start_pos` (0 origin)
|
25
|
-
|
35
|
+
attr_reader start_column (): Integer
|
26
36
|
|
27
37
|
# Line of the `end_pos` (1 origin)
|
28
|
-
|
38
|
+
attr_reader end_line (): Integer
|
29
39
|
|
30
40
|
# Column of the `end_pos` (0 origin)
|
31
|
-
|
41
|
+
attr_reader end_column (): Integer
|
32
42
|
|
33
|
-
|
43
|
+
attr_reader start_loc (): Buffer::loc
|
34
44
|
|
35
|
-
|
45
|
+
attr_reader end_loc (): Buffer::loc
|
36
46
|
|
37
|
-
|
47
|
+
attr_reader range (): Range[Integer]
|
38
48
|
|
39
49
|
# A substring of buffer associated to the location.
|
40
50
|
def source: () -> String
|
@@ -46,88 +56,46 @@ module RBS
|
|
46
56
|
# Location.to_string(loc) # => a.rb:1:0...3:4
|
47
57
|
# Location.to_string(nil) # => *:*:*..*:*
|
48
58
|
#
|
49
|
-
def self.to_string: (Location? location, ?default: ::String default) -> String
|
59
|
+
def self.to_string: (Location[untyped, untyped]? location, ?default: ::String default) -> String
|
50
60
|
|
51
61
|
def ==: (untyped other) -> bool
|
52
62
|
|
53
|
-
# Returns a new location with starting positionof `self` and ending position of `other`.
|
54
|
-
#
|
55
|
-
# l1 = Location.new(buffer: buffer, start_pos: 0, end_pox: x)
|
56
|
-
# l2 = Location.new(buffer: buffer, start_pos: y, end_pos: 20)
|
57
|
-
# l1 + l2 # => Location.new(buffer: buffer, start_pos: 0, end_pos: 20)
|
58
|
-
#
|
59
|
-
def +: (Location other) -> Location
|
60
|
-
|
61
|
-
# Returns true if `loc` is exact predecessor of `self`.
|
62
|
-
#
|
63
|
-
# l1 = Location.new(...) # 0..10
|
64
|
-
# l2 = Location.new(...) # 10..13
|
65
|
-
# l3 = Location.new(...) # 13..20
|
66
|
-
#
|
67
|
-
# l1.pred?(l2) # => true
|
68
|
-
# l2.pred?(l3) # => true
|
69
|
-
# l1.pred?(l3) # => false
|
70
|
-
#
|
71
|
-
def pred?: (Location loc) -> bool
|
72
|
-
|
73
63
|
include _ToJson
|
74
64
|
|
75
|
-
|
76
|
-
#
|
77
|
-
def concat: (*Location?) -> Location
|
78
|
-
|
79
|
-
# Inplace version of `+`.
|
80
|
-
#
|
81
|
-
def <<: (Location?) -> Location
|
65
|
+
def add_optional_child: (OptionalChildKeys name, Range[Integer]? range) -> void
|
82
66
|
|
83
|
-
|
84
|
-
#
|
85
|
-
# location.with_children(
|
86
|
-
# required: { name: name.location },
|
87
|
-
# optional: { args: nil }
|
88
|
-
# )
|
89
|
-
#
|
90
|
-
def with_children: [R, O](?required: Hash[R, Range[Integer] | Location], ?optional: Hash[O, Range[Integer] | Location | nil]) -> WithChildren[R, O]
|
67
|
+
def add_required_child: (RequiredChildKeys name, Range[Integer] range) -> void
|
91
68
|
|
92
|
-
# Location
|
69
|
+
# Returns `Location` instance for given _child_ name.
|
93
70
|
#
|
94
|
-
# # Array[String]
|
95
|
-
# # ^^^^^ <= name
|
96
|
-
# # ^^^^^^^^ <= args
|
97
|
-
# #
|
98
71
|
# # @type var loc: Location::WithChildren[:name, :args]
|
99
|
-
# loc
|
100
|
-
# loc
|
101
|
-
# loc = loc.merge_optional({ args: 5...13 })
|
72
|
+
# loc[:name] # => Location
|
73
|
+
# loc[:args] # => may be nil
|
102
74
|
#
|
103
|
-
#
|
104
|
-
#
|
75
|
+
# Note that passing unknown symbol raises an error even if the child is _optional_.
|
76
|
+
# You need explicitly set `nil` for absent optional children.
|
105
77
|
#
|
106
|
-
|
107
|
-
|
78
|
+
def []: (RequiredChildKeys) -> Location[bot, bot]
|
79
|
+
| (OptionalChildKeys) -> Location[bot, bot]?
|
80
|
+
| (Symbol) -> Location[bot, bot]?
|
108
81
|
|
109
|
-
|
82
|
+
def each_optional_key: () { (Symbol) -> void } -> void
|
83
|
+
| () -> Enumerator[Symbol, void]
|
110
84
|
|
111
|
-
|
85
|
+
def each_required_key: () { (Symbol) -> void } -> void
|
86
|
+
| () -> Enumerator[Symbol, void]
|
112
87
|
|
113
|
-
|
88
|
+
private
|
114
89
|
|
115
|
-
|
116
|
-
|
117
|
-
# # @type var loc: Location::WithChildren[:name, :args]
|
118
|
-
# loc[:name] # => Location
|
119
|
-
# loc[:args] # => may be nil
|
120
|
-
#
|
121
|
-
# Note that passing unknown symbol raises an error even if the child is _optional_.
|
122
|
-
# You need explicitly set `nil` for absent optional children.
|
123
|
-
#
|
124
|
-
def []: (RequiredChildKeys) -> Location
|
125
|
-
| (OptionalChildKeys) -> Location?
|
126
|
-
| (Symbol) -> Location?
|
90
|
+
def _start_loc: () -> Buffer::loc?
|
91
|
+
def _end_loc: () -> Buffer::loc?
|
127
92
|
|
128
|
-
|
93
|
+
def _add_required_child: (RequiredChildKeys name, Integer start_pos, Integer end_pos) -> void
|
94
|
+
def _add_optional_child: (OptionalChildKeys name, Integer start_pos, Integer end_pos) -> void
|
95
|
+
def _add_optional_no_child: (OptionalChildKeys name) -> void
|
96
|
+
def _optional_keys: () -> Array[Symbol]
|
97
|
+
def _required_keys: () -> Array[Symbol]
|
129
98
|
|
130
|
-
|
131
|
-
end
|
99
|
+
WithChildren: singleton(Location)
|
132
100
|
end
|
133
101
|
end
|
data/sig/locator.rbs
CHANGED
@@ -37,8 +37,8 @@ module RBS
|
|
37
37
|
|
38
38
|
def find_in_type: (Integer pos, type: Types::t, array: Array[component]) -> bool
|
39
39
|
|
40
|
-
def find_in_loc: (Integer pos, location: Location
|
40
|
+
def find_in_loc: (Integer pos, location: Location[untyped, untyped]?, array: Array[component]) -> bool
|
41
41
|
|
42
|
-
def test_loc: (Integer pos, location: Location?) -> bool
|
42
|
+
def test_loc: (Integer pos, location: Location[untyped, untyped]?) -> bool
|
43
43
|
end
|
44
44
|
end
|
data/sig/members.rbs
CHANGED
@@ -25,7 +25,7 @@ module RBS
|
|
25
25
|
# ^^^ name
|
26
26
|
# ^^^ overload
|
27
27
|
#
|
28
|
-
type loc = Location
|
28
|
+
type loc = Location[:keyword | :name, :kind | :overload]
|
29
29
|
|
30
30
|
attr_reader name: Symbol
|
31
31
|
attr_reader kind: kind
|
@@ -59,7 +59,7 @@ module RBS
|
|
59
59
|
# ^^^^ name
|
60
60
|
# ^ colon
|
61
61
|
#
|
62
|
-
type loc = Location
|
62
|
+
type loc = Location[:name | :colon, :kind]
|
63
63
|
|
64
64
|
attr_reader name: Symbol
|
65
65
|
attr_reader type: Types::t
|
@@ -97,7 +97,7 @@ module RBS
|
|
97
97
|
# ^ arg_open
|
98
98
|
# ^ arg_close
|
99
99
|
#
|
100
|
-
type loc = Location
|
100
|
+
type loc = Location[:name | :keyword, :args]
|
101
101
|
|
102
102
|
attr_reader name: TypeName
|
103
103
|
attr_reader args: Array[Types::t]
|
@@ -141,7 +141,7 @@ module RBS
|
|
141
141
|
# ^^^^ ivar_name
|
142
142
|
# ^ colon
|
143
143
|
#
|
144
|
-
type loc = Location
|
144
|
+
type loc = Location[:keyword | :name | :colon, :kind | :ivar | :ivar_name]
|
145
145
|
|
146
146
|
attr_reader name: Symbol
|
147
147
|
attr_reader type: Types::t
|
@@ -174,9 +174,9 @@ module RBS
|
|
174
174
|
end
|
175
175
|
|
176
176
|
module LocationOnly
|
177
|
-
attr_reader location: Location?
|
177
|
+
attr_reader location: Location[bot, bot]?
|
178
178
|
|
179
|
-
def initialize: (location: Location?) -> void
|
179
|
+
def initialize: (location: Location[bot, bot]?) -> void
|
180
180
|
|
181
181
|
include _HashEqual
|
182
182
|
end
|
@@ -206,7 +206,7 @@ module RBS
|
|
206
206
|
# ^^^^^ old_kind
|
207
207
|
# ^^^ old_name
|
208
208
|
#
|
209
|
-
type loc = Location
|
209
|
+
type loc = Location[:keyword | :new_name | :old_name, :new_kind | :old_kind]
|
210
210
|
|
211
211
|
attr_reader new_name: Symbol
|
212
212
|
attr_reader old_name: Symbol
|
data/sig/method_types.rbs
CHANGED
@@ -3,9 +3,9 @@ module RBS
|
|
3
3
|
attr_reader type_params: Array[Symbol]
|
4
4
|
attr_reader type: Types::Function
|
5
5
|
attr_reader block: Types::Block?
|
6
|
-
attr_reader location: Location?
|
6
|
+
attr_reader location: Location[untyped, untyped]?
|
7
7
|
|
8
|
-
def initialize: (type_params: Array[Symbol], type: Types::Function, block: Types::Block?, location: Location?) -> void
|
8
|
+
def initialize: (type_params: Array[Symbol], type: Types::Function, block: Types::Block?, location: Location[untyped, untyped]?) -> void
|
9
9
|
|
10
10
|
def ==: (untyped other) -> bool
|
11
11
|
|
@@ -13,7 +13,7 @@ module RBS
|
|
13
13
|
|
14
14
|
def sub: (Substitution) -> MethodType
|
15
15
|
|
16
|
-
def update: (?type_params: Array[Symbol], ?type: Types::Function, ?block: Types::Block?, ?location: Location?) -> MethodType
|
16
|
+
def update: (?type_params: Array[Symbol], ?type: Types::Function, ?block: Types::Block?, ?location: Location[untyped, untyped]?) -> MethodType
|
17
17
|
|
18
18
|
def free_variables: (?Set[Symbol] set) -> Set[Symbol]
|
19
19
|
|
data/sig/parser.rbs
CHANGED
@@ -1,32 +1,27 @@
|
|
1
1
|
module RBS
|
2
2
|
class Parser
|
3
|
-
|
4
|
-
attr_reader token_str: String
|
5
|
-
attr_reader error_value: untyped
|
6
|
-
attr_reader value_stack: untyped?
|
3
|
+
def self.parse_method_type: (Buffer | String, ?line: Integer, ?column: Integer, ?variables: Array[Symbol]) -> MethodType
|
7
4
|
|
8
|
-
|
9
|
-
end
|
5
|
+
def self.parse_type: (Buffer | String, ?line: Integer, ?column: Integer, ?variables: Array[Symbol]) -> Types::t
|
10
6
|
|
11
|
-
|
12
|
-
attr_reader input: String
|
13
|
-
attr_reader location: Location
|
7
|
+
def self.parse_signature: (Buffer | String, ?line: Integer, ?column: Integer) -> Array[AST::Declarations::t]
|
14
8
|
|
15
|
-
|
16
|
-
end
|
9
|
+
KEYWORDS: Set[String]
|
17
10
|
|
18
|
-
|
19
|
-
attr_reader subject: untyped
|
20
|
-
attr_reader location: Location
|
21
|
-
attr_reader original_message: String
|
11
|
+
private
|
22
12
|
|
23
|
-
|
24
|
-
end
|
13
|
+
def self.buffer: (String | Buffer source) -> Buffer
|
25
14
|
|
26
|
-
|
15
|
+
%a{no-defn}
|
16
|
+
def self._parse_type: (Buffer, Integer line, Integer column, Array[Symbol] variables) -> Types::t
|
27
17
|
|
28
|
-
|
18
|
+
%a{no-defn}
|
19
|
+
def self._parse_method_type: (Buffer, Integer line, Integer column, Array[Symbol] variables) -> MethodType
|
29
20
|
|
30
|
-
|
21
|
+
%a{no-defn}
|
22
|
+
def self._parse_signature: (Buffer, Integer line, Integer column) -> Array[AST::Declarations::t]
|
23
|
+
|
24
|
+
class LocatedValue
|
25
|
+
end
|
31
26
|
end
|
32
27
|
end
|
data/sig/rbs.rbs
CHANGED
data/sig/types.rbs
CHANGED
@@ -13,7 +13,7 @@ module RBS
|
|
13
13
|
def sub: (Substitution) -> t
|
14
14
|
|
15
15
|
# Maps type names included in the type and returns new instance of type.
|
16
|
-
def map_type_name: () { (TypeName, Location?, t) -> TypeName } -> t
|
16
|
+
def map_type_name: () { (TypeName, Location[untyped, untyped]?, t) -> TypeName } -> t
|
17
17
|
|
18
18
|
# Yields all direct sub types included in the type.
|
19
19
|
# It doesn't yield the type itself.
|
@@ -58,16 +58,16 @@ module RBS
|
|
58
58
|
end
|
59
59
|
|
60
60
|
module NoTypeName
|
61
|
-
def map_type_name: () { (TypeName, Location?, t) -> TypeName } -> self
|
61
|
+
def map_type_name: () { (TypeName, Location[untyped, untyped]?, t) -> TypeName } -> self
|
62
62
|
end
|
63
63
|
|
64
64
|
module Bases
|
65
65
|
class Base
|
66
66
|
include _TypeBase
|
67
67
|
|
68
|
-
attr_reader location: Location?
|
68
|
+
attr_reader location: Location[bot, bot]?
|
69
69
|
|
70
|
-
def initialize: (location: Location?) -> void
|
70
|
+
def initialize: (location: Location[bot, bot]?) -> void
|
71
71
|
|
72
72
|
def ==: (untyped other) -> bool
|
73
73
|
|
@@ -111,6 +111,8 @@ module RBS
|
|
111
111
|
end
|
112
112
|
|
113
113
|
class Variable
|
114
|
+
type loc = Location[bot, bot]
|
115
|
+
|
114
116
|
attr_reader name: Symbol
|
115
117
|
|
116
118
|
@@count: Integer
|
@@ -119,9 +121,9 @@ module RBS
|
|
119
121
|
include NoTypeName
|
120
122
|
include EmptyEachType
|
121
123
|
|
122
|
-
def initialize: (name: Symbol, location:
|
124
|
+
def initialize: (name: Symbol, location: loc?) -> void
|
123
125
|
|
124
|
-
attr_reader location:
|
126
|
+
attr_reader location: loc?
|
125
127
|
|
126
128
|
def ==: (untyped other) -> bool
|
127
129
|
|
@@ -144,7 +146,7 @@ module RBS
|
|
144
146
|
class ClassSingleton
|
145
147
|
# singleton(::Foo)
|
146
148
|
# ^^^^^ => name
|
147
|
-
type loc = Location
|
149
|
+
type loc = Location[:name, bot]
|
148
150
|
|
149
151
|
def initialize: (name: TypeName, location: loc?) -> void
|
150
152
|
|
@@ -189,7 +191,7 @@ module RBS
|
|
189
191
|
# _Foo[Bar, Baz]
|
190
192
|
# ^^^^ => name
|
191
193
|
# ^^^^^^^^^^ => args
|
192
|
-
type loc = Location
|
194
|
+
type loc = Location[:name, :args]
|
193
195
|
|
194
196
|
def initialize: (name: TypeName, args: Array[t], location: loc?) -> void
|
195
197
|
|
@@ -214,7 +216,8 @@ module RBS
|
|
214
216
|
# Foo[Bar, Baz]
|
215
217
|
# ^^^ => name
|
216
218
|
# ^^^^^^^^^^ => args
|
217
|
-
|
219
|
+
#
|
220
|
+
type loc = Location[:name, :args]
|
218
221
|
|
219
222
|
def initialize: (name: TypeName, args: Array[t], location: loc?) -> void
|
220
223
|
|
@@ -226,54 +229,64 @@ module RBS
|
|
226
229
|
class Alias
|
227
230
|
attr_reader name: TypeName
|
228
231
|
|
229
|
-
|
232
|
+
type loc = Location[bot, bot]
|
233
|
+
|
234
|
+
def initialize: (name: TypeName, location: loc?) -> void
|
230
235
|
|
231
236
|
include _TypeBase
|
232
237
|
include NoFreeVariables
|
233
238
|
include NoSubst
|
234
239
|
include EmptyEachType
|
235
240
|
|
236
|
-
attr_reader location:
|
241
|
+
attr_reader location: loc?
|
237
242
|
end
|
238
243
|
|
239
244
|
class Tuple
|
240
245
|
attr_reader types: Array[t]
|
241
246
|
|
242
|
-
|
247
|
+
type loc = Location[bot, bot]
|
248
|
+
|
249
|
+
def initialize: (types: Array[t], location: loc?) -> void
|
243
250
|
|
244
251
|
include _TypeBase
|
245
252
|
|
246
|
-
attr_reader location:
|
253
|
+
attr_reader location: loc?
|
247
254
|
end
|
248
255
|
|
249
256
|
class Record
|
250
257
|
attr_reader fields: Hash[Symbol, t]
|
251
258
|
|
252
|
-
|
259
|
+
type loc = Location[bot, bot]
|
260
|
+
|
261
|
+
def initialize: (fields: Hash[Symbol, t], location: loc?) -> void
|
253
262
|
|
254
263
|
include _TypeBase
|
255
264
|
|
256
|
-
attr_reader location:
|
265
|
+
attr_reader location: loc?
|
257
266
|
end
|
258
267
|
|
259
268
|
class Optional
|
260
269
|
attr_reader type: t
|
261
270
|
|
262
|
-
|
271
|
+
type loc = Location[bot, bot]
|
272
|
+
|
273
|
+
def initialize: (type: t, location: loc?) -> void
|
263
274
|
|
264
275
|
include _TypeBase
|
265
276
|
|
266
|
-
attr_reader location:
|
277
|
+
attr_reader location: loc?
|
267
278
|
end
|
268
279
|
|
269
280
|
class Union
|
270
281
|
attr_reader types: Array[t]
|
271
282
|
|
272
|
-
|
283
|
+
type loc = Location[bot, bot]
|
284
|
+
|
285
|
+
def initialize: (types: Array[t], location: loc?) -> void
|
273
286
|
|
274
287
|
include _TypeBase
|
275
288
|
|
276
|
-
attr_reader location:
|
289
|
+
attr_reader location: loc?
|
277
290
|
|
278
291
|
def map_type: () { (t) -> t } -> Union
|
279
292
|
| () -> Enumerator[t, Union]
|
@@ -282,11 +295,13 @@ module RBS
|
|
282
295
|
class Intersection
|
283
296
|
attr_reader types: Array[t]
|
284
297
|
|
285
|
-
|
298
|
+
type loc = Location[bot, bot]
|
299
|
+
|
300
|
+
def initialize: (types: Array[t], location: loc?) -> void
|
286
301
|
|
287
302
|
include _TypeBase
|
288
303
|
|
289
|
-
attr_reader location:
|
304
|
+
attr_reader location: loc?
|
290
305
|
|
291
306
|
def map_type: () { (t) -> t } -> Intersection
|
292
307
|
| () -> Enumerator[t, Intersection]
|
@@ -294,7 +309,7 @@ module RBS
|
|
294
309
|
|
295
310
|
class Function
|
296
311
|
class Param
|
297
|
-
type loc = Location
|
312
|
+
type loc = Location[bot, :name]
|
298
313
|
|
299
314
|
attr_reader type: t
|
300
315
|
attr_reader name: Symbol?
|
@@ -329,7 +344,7 @@ module RBS
|
|
329
344
|
def map_type: { (t) -> t } -> Function
|
330
345
|
| -> Enumerator[t, Function]
|
331
346
|
|
332
|
-
def map_type_name: () { (TypeName, Location?, t) -> TypeName } -> Function
|
347
|
+
def map_type_name: () { (TypeName, Location[untyped, untyped]?, t) -> TypeName } -> Function
|
333
348
|
|
334
349
|
def each_type: () { (t) -> void } -> void
|
335
350
|
| -> Enumerator[t, void]
|
@@ -384,19 +399,22 @@ module RBS
|
|
384
399
|
attr_reader type: Function
|
385
400
|
attr_reader block: Block?
|
386
401
|
|
387
|
-
|
402
|
+
type loc = Location[bot, bot]
|
403
|
+
|
404
|
+
def initialize: (location: loc?, type: Function, block: Block?) -> void
|
388
405
|
|
389
406
|
include _TypeBase
|
390
407
|
|
391
|
-
attr_reader location:
|
408
|
+
attr_reader location: loc?
|
392
409
|
end
|
393
410
|
|
394
411
|
class Literal
|
395
412
|
type literal = String | Integer | Symbol | TrueClass | FalseClass
|
413
|
+
type loc = Location[bot, bot]
|
396
414
|
|
397
415
|
attr_reader literal: literal
|
398
416
|
|
399
|
-
def initialize: (literal: literal, location:
|
417
|
+
def initialize: (literal: literal, location: loc?) -> void
|
400
418
|
|
401
419
|
include _TypeBase
|
402
420
|
include NoFreeVariables
|
@@ -404,7 +422,7 @@ module RBS
|
|
404
422
|
include EmptyEachType
|
405
423
|
include NoTypeName
|
406
424
|
|
407
|
-
attr_reader location:
|
425
|
+
attr_reader location: loc?
|
408
426
|
end
|
409
427
|
end
|
410
428
|
end
|
data/sig/writer.rbs
CHANGED
@@ -38,7 +38,7 @@ module RBS
|
|
38
38
|
def attribute: (:reader | :writer | :accessor, AST::Members::Attribute) -> void
|
39
39
|
|
40
40
|
interface _Located
|
41
|
-
def location: () -> Location?
|
41
|
+
def location: () -> Location[untyped, untyped]?
|
42
42
|
end
|
43
43
|
|
44
44
|
def preserve_empty_line: (_Located?, _Located) -> void
|