rbs 1.1.1 → 1.3.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 +5 -1
- data/.gitignore +2 -0
- data/CHANGELOG.md +81 -0
- data/README.md +1 -1
- data/Rakefile +11 -0
- data/Steepfile +1 -0
- data/core/array.rbs +2 -2
- data/core/basic_object.rbs +1 -1
- data/core/enumerable.rbs +1 -1
- data/core/hash.rbs +13 -5
- data/core/io.rbs +4 -4
- data/core/kernel.rbs +2 -2
- data/core/marshal.rbs +4 -3
- data/core/module.rbs +1 -1
- data/core/numeric.rbs +10 -0
- data/core/proc.rbs +1 -1
- data/core/random.rbs +4 -2
- data/core/range.rbs +2 -2
- data/core/struct.rbs +3 -2
- data/core/thread.rbs +1 -1
- data/docs/CONTRIBUTING.md +5 -3
- data/docs/rbs_by_example.md +328 -0
- data/docs/sigs.md +21 -2
- data/docs/stdlib.md +1 -1
- data/docs/syntax.md +11 -14
- data/lib/rbs.rb +1 -0
- data/lib/rbs/ast/annotation.rb +2 -2
- data/lib/rbs/ast/comment.rb +2 -2
- data/lib/rbs/ast/declarations.rb +37 -22
- data/lib/rbs/ast/members.rb +26 -26
- data/lib/rbs/cli.rb +3 -0
- data/lib/rbs/constant_table.rb +4 -1
- data/lib/rbs/definition.rb +1 -1
- data/lib/rbs/definition_builder.rb +16 -18
- data/lib/rbs/definition_builder/ancestor_builder.rb +10 -2
- data/lib/rbs/definition_builder/method_builder.rb +4 -2
- data/lib/rbs/errors.rb +36 -0
- data/lib/rbs/location.rb +106 -2
- data/lib/rbs/locator.rb +205 -0
- data/lib/rbs/method_type.rb +2 -2
- data/lib/rbs/parser.rb +1315 -962
- data/lib/rbs/parser.y +411 -75
- data/lib/rbs/prototype/rb.rb +7 -3
- data/lib/rbs/prototype/runtime.rb +118 -42
- data/lib/rbs/test/hook.rb +8 -2
- data/lib/rbs/type_name.rb +2 -3
- data/lib/rbs/type_name_resolver.rb +1 -1
- data/lib/rbs/types.rb +36 -34
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +4 -2
- data/rbs.gemspec +1 -1
- data/sig/ancestor_builder.rbs +2 -0
- data/sig/annotation.rbs +1 -1
- data/sig/cli.rbs +31 -21
- data/sig/comment.rbs +1 -1
- data/sig/declarations.rbs +106 -21
- data/sig/environment.rbs +2 -2
- data/sig/errors.rbs +15 -0
- data/sig/location.rbs +84 -3
- data/sig/locator.rbs +44 -0
- data/sig/members.rbs +76 -12
- data/sig/method_builder.rbs +1 -1
- data/sig/method_types.rbs +1 -1
- data/sig/namespace.rbs +1 -1
- data/sig/polyfill.rbs +4 -17
- data/sig/rbs.rbs +8 -4
- data/sig/typename.rbs +1 -1
- data/sig/types.rbs +60 -19
- data/sig/util.rbs +0 -4
- data/sig/writer.rbs +8 -2
- data/stdlib/dbm/0/dbm.rbs +43 -30
- data/stdlib/mutex_m/0/mutex_m.rbs +1 -1
- data/stdlib/net-http/0/net-http.rbs +1846 -0
- data/stdlib/optparse/0/optparse.rbs +1214 -0
- data/stdlib/resolv/0/resolv.rbs +1504 -0
- data/stdlib/rubygems/0/requirement.rbs +84 -2
- data/stdlib/rubygems/0/version.rbs +2 -1
- data/stdlib/shellwords/0/shellwords.rbs +252 -0
- data/stdlib/socket/0/addrinfo.rbs +469 -0
- data/stdlib/socket/0/basic_socket.rbs +503 -0
- data/stdlib/socket/0/ip_socket.rbs +72 -0
- data/stdlib/socket/0/socket.rbs +2687 -0
- data/stdlib/socket/0/tcp_server.rbs +177 -0
- data/stdlib/socket/0/tcp_socket.rbs +35 -0
- data/stdlib/socket/0/udp_socket.rbs +111 -0
- data/stdlib/socket/0/unix_server.rbs +154 -0
- data/stdlib/socket/0/unix_socket.rbs +132 -0
- data/stdlib/timeout/0/timeout.rbs +5 -0
- data/steep/Gemfile.lock +19 -16
- metadata +18 -11
- data/bin/annotate-with-rdoc +0 -153
- data/bin/console +0 -14
- data/bin/query-rdoc +0 -103
- data/bin/rbs-prof +0 -9
- data/bin/run_in_md.rb +0 -49
- data/bin/setup +0 -8
- data/bin/sort +0 -89
- data/bin/steep +0 -4
- data/bin/test_runner.rb +0 -29
data/sig/locator.rbs
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
module RBS
|
2
|
+
# Locator helps finding RBS elements based on locations in the RBS source text.
|
3
|
+
#
|
4
|
+
class Locator
|
5
|
+
type component = Symbol
|
6
|
+
| Types::t
|
7
|
+
| MethodType
|
8
|
+
| AST::Declarations::t
|
9
|
+
| AST::Members::t
|
10
|
+
| AST::Declarations::ModuleTypeParams::TypeParam
|
11
|
+
| AST::Declarations::Class::Super
|
12
|
+
| AST::Declarations::Module::Self
|
13
|
+
|
14
|
+
# Array of _top-level_ declarations.
|
15
|
+
#
|
16
|
+
attr_reader decls: Array[AST::Declarations::t]
|
17
|
+
|
18
|
+
def initialize: (decls: Array[AST::Declarations::t]) -> void
|
19
|
+
|
20
|
+
def buffer: () -> Buffer
|
21
|
+
|
22
|
+
# Returns list of components.
|
23
|
+
# Inner component comes first.
|
24
|
+
#
|
25
|
+
def find: (line: Integer, column: Integer) -> Array[component]
|
26
|
+
|
27
|
+
# Returns pair of the inner most symbol and outer components.
|
28
|
+
# It ensures the array starts with a AST/type component.
|
29
|
+
#
|
30
|
+
def find2: (line: Integer, column: Integer) -> [Symbol?, Array[component]]?
|
31
|
+
|
32
|
+
def find_in_decl: (Integer pos, decl: AST::Declarations::t, array: Array[component]) -> bool
|
33
|
+
|
34
|
+
def find_in_member: (Integer pos, member: AST::Members::t, array: Array[component]) -> bool
|
35
|
+
|
36
|
+
def find_in_method_type: (Integer pos, method_type: MethodType, array: Array[component]) -> bool
|
37
|
+
|
38
|
+
def find_in_type: (Integer pos, type: Types::t, array: Array[component]) -> bool
|
39
|
+
|
40
|
+
def find_in_loc: (Integer pos, location: Location::WithChildren[untyped, untyped] | Location | nil, array: Array[component]) -> bool
|
41
|
+
|
42
|
+
def test_loc: (Integer pos, location: Location?) -> bool
|
43
|
+
end
|
44
|
+
end
|
data/sig/members.rbs
CHANGED
@@ -15,15 +15,27 @@ module RBS
|
|
15
15
|
class MethodDefinition < Base
|
16
16
|
type kind = :instance | :singleton | :singleton_instance
|
17
17
|
|
18
|
+
# def foo: () -> void
|
19
|
+
# ^^^ keyword
|
20
|
+
# ^^^ name
|
21
|
+
#
|
22
|
+
# def self.bar: () -> void | ...
|
23
|
+
# ^^^ keyword
|
24
|
+
# ^^^^^ kind
|
25
|
+
# ^^^ name
|
26
|
+
# ^^^ overload
|
27
|
+
#
|
28
|
+
type loc = Location::WithChildren[:keyword | :name, :kind | :overload]
|
29
|
+
|
18
30
|
attr_reader name: Symbol
|
19
31
|
attr_reader kind: kind
|
20
32
|
attr_reader types: Array[MethodType]
|
21
33
|
attr_reader annotations: Array[Annotation]
|
22
|
-
attr_reader location:
|
34
|
+
attr_reader location: loc?
|
23
35
|
attr_reader comment: Comment?
|
24
36
|
attr_reader overload: bool
|
25
37
|
|
26
|
-
def initialize: (name: Symbol, kind: kind, types: Array[MethodType], annotations: Array[Annotation], location:
|
38
|
+
def initialize: (name: Symbol, kind: kind, types: Array[MethodType], annotations: Array[Annotation], location: loc?, comment: Comment?, overload: boolish) -> void
|
27
39
|
|
28
40
|
include _HashEqual
|
29
41
|
include _ToJson
|
@@ -34,16 +46,27 @@ module RBS
|
|
34
46
|
|
35
47
|
def overload?: () -> bool
|
36
48
|
|
37
|
-
def update: (?name: Symbol, ?kind: kind, ?types: Array[MethodType], ?annotations: Array[Annotation], ?location:
|
49
|
+
def update: (?name: Symbol, ?kind: kind, ?types: Array[MethodType], ?annotations: Array[Annotation], ?location: loc?, ?comment: Comment?, ?overload: boolish) -> MethodDefinition
|
38
50
|
end
|
39
51
|
|
40
52
|
module Var
|
53
|
+
# @foo: String
|
54
|
+
# ^^^^ name
|
55
|
+
# ^ colon
|
56
|
+
#
|
57
|
+
# self.@all: Array[String]
|
58
|
+
# ^^^^^ kind
|
59
|
+
# ^^^^ name
|
60
|
+
# ^ colon
|
61
|
+
#
|
62
|
+
type loc = Location::WithChildren[:name | :colon, :kind]
|
63
|
+
|
41
64
|
attr_reader name: Symbol
|
42
65
|
attr_reader type: Types::t
|
43
|
-
attr_reader location:
|
66
|
+
attr_reader location: loc?
|
44
67
|
attr_reader comment: Comment?
|
45
68
|
|
46
|
-
def initialize: (name: Symbol, type: Types::t, location:
|
69
|
+
def initialize: (name: Symbol, type: Types::t, location: loc?, comment: Comment?) -> void
|
47
70
|
|
48
71
|
include _HashEqual
|
49
72
|
end
|
@@ -64,13 +87,25 @@ module RBS
|
|
64
87
|
end
|
65
88
|
|
66
89
|
module Mixin
|
90
|
+
# include Foo
|
91
|
+
# ^^^^^^^ keyword
|
92
|
+
# ^^^ name
|
93
|
+
#
|
94
|
+
# include Array[String]
|
95
|
+
# ^^^^^^^ keyword
|
96
|
+
# ^^^^^ name
|
97
|
+
# ^ arg_open
|
98
|
+
# ^ arg_close
|
99
|
+
#
|
100
|
+
type loc = Location::WithChildren[:name | :keyword, :args]
|
101
|
+
|
67
102
|
attr_reader name: TypeName
|
68
103
|
attr_reader args: Array[Types::t]
|
69
104
|
attr_reader annotations: Array[Annotation]
|
70
|
-
attr_reader location:
|
105
|
+
attr_reader location: loc?
|
71
106
|
attr_reader comment: Comment?
|
72
107
|
|
73
|
-
def initialize: (name: TypeName, args: Array[Types::t], annotations: Array[Annotation], location:
|
108
|
+
def initialize: (name: TypeName, args: Array[Types::t], annotations: Array[Annotation], location: loc?, comment: Comment?) -> void
|
74
109
|
|
75
110
|
include _HashEqual
|
76
111
|
end
|
@@ -93,19 +128,34 @@ module RBS
|
|
93
128
|
module Attribute
|
94
129
|
type kind = :instance | :singleton
|
95
130
|
|
131
|
+
# attr_reader name: String
|
132
|
+
# ^^^^^^^^^^^ keyword
|
133
|
+
# ^^^^ name
|
134
|
+
# ^ colon
|
135
|
+
#
|
136
|
+
# attr_accessor self.name (@foo) : String
|
137
|
+
# ^^^^^^^^^^^^^ keyword
|
138
|
+
# ^^^^^ kind
|
139
|
+
# ^^^^ name
|
140
|
+
# ^^^^^^ ivar
|
141
|
+
# ^^^^ ivar_name
|
142
|
+
# ^ colon
|
143
|
+
#
|
144
|
+
type loc = Location::WithChildren[:keyword | :name | :colon, :kind | :ivar | :ivar_name]
|
145
|
+
|
96
146
|
attr_reader name: Symbol
|
97
147
|
attr_reader type: Types::t
|
98
148
|
attr_reader kind: kind
|
99
149
|
attr_reader ivar_name: Symbol | false | nil
|
100
150
|
attr_reader annotations: Array[Annotation]
|
101
|
-
attr_reader location:
|
151
|
+
attr_reader location: loc?
|
102
152
|
attr_reader comment: Comment?
|
103
153
|
|
104
|
-
def initialize: (name: Symbol, type: Types::t, ivar_name: Symbol | false | nil, kind: kind, annotations: Array[Annotation], location:
|
154
|
+
def initialize: (name: Symbol, type: Types::t, ivar_name: Symbol | false | nil, kind: kind, annotations: Array[Annotation], location: loc?, comment: Comment?) -> void
|
105
155
|
|
106
156
|
include _HashEqual
|
107
157
|
|
108
|
-
def update: (?name: Symbol, ?type: Types::t, ?ivar_name: Symbol | false | nil, ?kind: kind, ?annotations: Array[Annotation], ?location:
|
158
|
+
def update: (?name: Symbol, ?type: Types::t, ?ivar_name: Symbol | false | nil, ?kind: kind, ?annotations: Array[Annotation], ?location: loc?, ?comment: Comment?) -> instance
|
109
159
|
end
|
110
160
|
|
111
161
|
class AttrReader < Base
|
@@ -144,14 +194,28 @@ module RBS
|
|
144
194
|
class Alias < Base
|
145
195
|
type kind = :instance | :singleton
|
146
196
|
|
197
|
+
# alias foo bar
|
198
|
+
# ^^^^^ keyword
|
199
|
+
# ^^^ new_name
|
200
|
+
# ^^^ old_name
|
201
|
+
#
|
202
|
+
# alias self.foo self.bar
|
203
|
+
# ^^^^^ keyword
|
204
|
+
# ^^^^^ new_kind
|
205
|
+
# ^^^ new_name
|
206
|
+
# ^^^^^ old_kind
|
207
|
+
# ^^^ old_name
|
208
|
+
#
|
209
|
+
type loc = Location::WithChildren[:keyword | :new_name | :old_name, :new_kind | :old_kind]
|
210
|
+
|
147
211
|
attr_reader new_name: Symbol
|
148
212
|
attr_reader old_name: Symbol
|
149
213
|
attr_reader kind: kind
|
150
214
|
attr_reader annotations: Array[Annotation]
|
151
|
-
attr_reader location:
|
215
|
+
attr_reader location: loc?
|
152
216
|
attr_reader comment: Comment?
|
153
217
|
|
154
|
-
def initialize: (new_name: Symbol, old_name: Symbol, kind: kind, annotations: Array[Annotation], location:
|
218
|
+
def initialize: (new_name: Symbol, old_name: Symbol, kind: kind, annotations: Array[Annotation], location: loc?, comment: Comment?) -> void
|
155
219
|
|
156
220
|
include _HashEqual
|
157
221
|
include _ToJson
|
data/sig/method_builder.rbs
CHANGED
data/sig/method_types.rbs
CHANGED
data/sig/namespace.rbs
CHANGED
@@ -13,7 +13,7 @@ module RBS
|
|
13
13
|
# RBS::Types::Union
|
14
14
|
# ^^^^^^^^^^^^ Namespace
|
15
15
|
#
|
16
|
-
# Note that `Namespace` is
|
16
|
+
# Note that `Namespace` is an RBS specific concept and there is no corresponding concept in Ruby.
|
17
17
|
#
|
18
18
|
# There are _absolute_ and _relative_ namespaces.
|
19
19
|
#
|
data/sig/polyfill.rbs
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
module Kernel
|
2
|
-
def to_json: (*untyped) -> String
|
3
2
|
end
|
4
3
|
|
5
4
|
module Gem
|
@@ -12,20 +11,8 @@ module Gem
|
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
15
|
-
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
attr_accessor version: String
|
21
|
-
|
22
|
-
attr_accessor banner: String
|
23
|
-
|
24
|
-
def order!: (Array[String]) -> void
|
25
|
-
|
26
|
-
def parse!: (Array[String]) -> void
|
27
|
-
|
28
|
-
def ver: () -> String
|
29
|
-
|
30
|
-
def help: () -> String
|
14
|
+
module Enumerable[unchecked out Elem]
|
15
|
+
def flat_map: [U] () { (Elem) -> Array[U] } -> Array[U]
|
16
|
+
| [U] () { (Elem) -> U } -> Array[U]
|
17
|
+
| ...
|
31
18
|
end
|
data/sig/rbs.rbs
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
module RBS
|
2
2
|
def self.logger: () -> Logger
|
3
|
-
|
3
|
+
|
4
4
|
def self.logger_level: () -> untyped
|
5
|
-
|
5
|
+
|
6
6
|
def self.logger_level=: (untyped) -> untyped
|
7
|
-
|
7
|
+
|
8
8
|
def self.logger_output: () -> IO
|
9
|
-
|
9
|
+
|
10
10
|
def self.logger_output=: (IO) -> IO
|
11
11
|
end
|
12
|
+
|
13
|
+
module Ruby
|
14
|
+
Signature: singleton(RBS)
|
15
|
+
end
|
data/sig/typename.rbs
CHANGED
data/sig/types.rbs
CHANGED
@@ -3,11 +3,6 @@ module RBS
|
|
3
3
|
# _TypeBase interface represents the operations common to all of the types.
|
4
4
|
#
|
5
5
|
interface _TypeBase
|
6
|
-
# Location for types in the RBS source code.
|
7
|
-
# `nil` means there is no RBS source code for the type.
|
8
|
-
#
|
9
|
-
def location: () -> Location?
|
10
|
-
|
11
6
|
# Returns names of free variables of a type.
|
12
7
|
# You can pass a Set instance to add the free variables to the set to avoid Set object allocation.
|
13
8
|
#
|
@@ -32,7 +27,7 @@ module RBS
|
|
32
27
|
|
33
28
|
# Returns a JSON representation.
|
34
29
|
#
|
35
|
-
|
30
|
+
include _ToJson
|
36
31
|
|
37
32
|
# Returns a String representation.
|
38
33
|
# `level` is used internally.
|
@@ -70,6 +65,8 @@ module RBS
|
|
70
65
|
class Base
|
71
66
|
include _TypeBase
|
72
67
|
|
68
|
+
attr_reader location: Location?
|
69
|
+
|
73
70
|
def initialize: (location: Location?) -> void
|
74
71
|
|
75
72
|
def ==: (untyped other) -> bool
|
@@ -119,12 +116,13 @@ module RBS
|
|
119
116
|
@@count: Integer
|
120
117
|
|
121
118
|
include _TypeBase
|
122
|
-
|
123
119
|
include NoTypeName
|
124
120
|
include EmptyEachType
|
125
121
|
|
126
122
|
def initialize: (name: Symbol, location: Location?) -> void
|
127
123
|
|
124
|
+
attr_reader location: Location?
|
125
|
+
|
128
126
|
def ==: (untyped other) -> bool
|
129
127
|
|
130
128
|
alias eql? ==
|
@@ -144,21 +142,26 @@ module RBS
|
|
144
142
|
end
|
145
143
|
|
146
144
|
class ClassSingleton
|
145
|
+
# singleton(::Foo)
|
146
|
+
# ^^^^^ => name
|
147
|
+
type loc = Location::WithChildren[:name, bot]
|
148
|
+
|
149
|
+
def initialize: (name: TypeName, location: loc?) -> void
|
150
|
+
|
147
151
|
attr_reader name: TypeName
|
148
152
|
|
149
|
-
|
153
|
+
attr_reader location: loc?
|
150
154
|
|
151
|
-
|
155
|
+
include _TypeBase
|
156
|
+
include NoFreeVariables
|
157
|
+
include NoSubst
|
158
|
+
include EmptyEachType
|
152
159
|
|
153
160
|
def ==: (untyped other) -> bool
|
154
161
|
|
155
162
|
alias eql? ==
|
156
163
|
|
157
164
|
def hash: () -> Integer
|
158
|
-
|
159
|
-
include NoFreeVariables
|
160
|
-
include NoSubst
|
161
|
-
include EmptyEachType
|
162
165
|
end
|
163
166
|
|
164
167
|
module Application
|
@@ -180,11 +183,20 @@ module RBS
|
|
180
183
|
end
|
181
184
|
|
182
185
|
class Interface
|
183
|
-
|
186
|
+
# _Foo
|
187
|
+
# ^^^^ => name
|
188
|
+
#
|
189
|
+
# _Foo[Bar, Baz]
|
190
|
+
# ^^^^ => name
|
191
|
+
# ^^^^^^^^^^ => args
|
192
|
+
type loc = Location::WithChildren[:name, :args]
|
184
193
|
|
185
|
-
def initialize: (name: TypeName, args: Array[t], location:
|
194
|
+
def initialize: (name: TypeName, args: Array[t], location: loc?) -> void
|
186
195
|
|
196
|
+
include Application
|
187
197
|
include _TypeBase
|
198
|
+
|
199
|
+
attr_reader location: loc?
|
188
200
|
end
|
189
201
|
|
190
202
|
# ClassInstance represents a type of an instance of a class.
|
@@ -196,7 +208,17 @@ module RBS
|
|
196
208
|
class ClassInstance
|
197
209
|
include Application
|
198
210
|
|
199
|
-
|
211
|
+
# Foo
|
212
|
+
# ^^^ => name
|
213
|
+
#
|
214
|
+
# Foo[Bar, Baz]
|
215
|
+
# ^^^ => name
|
216
|
+
# ^^^^^^^^^^ => args
|
217
|
+
type loc = Location::WithChildren[:name, :args]
|
218
|
+
|
219
|
+
def initialize: (name: TypeName, args: Array[t], location: loc?) -> void
|
220
|
+
|
221
|
+
attr_reader location: loc?
|
200
222
|
|
201
223
|
include _TypeBase
|
202
224
|
end
|
@@ -210,6 +232,8 @@ module RBS
|
|
210
232
|
include NoFreeVariables
|
211
233
|
include NoSubst
|
212
234
|
include EmptyEachType
|
235
|
+
|
236
|
+
attr_reader location: Location?
|
213
237
|
end
|
214
238
|
|
215
239
|
class Tuple
|
@@ -218,6 +242,8 @@ module RBS
|
|
218
242
|
def initialize: (types: Array[t], location: Location?) -> void
|
219
243
|
|
220
244
|
include _TypeBase
|
245
|
+
|
246
|
+
attr_reader location: Location?
|
221
247
|
end
|
222
248
|
|
223
249
|
class Record
|
@@ -226,6 +252,8 @@ module RBS
|
|
226
252
|
def initialize: (fields: Hash[Symbol, t], location: Location?) -> void
|
227
253
|
|
228
254
|
include _TypeBase
|
255
|
+
|
256
|
+
attr_reader location: Location?
|
229
257
|
end
|
230
258
|
|
231
259
|
class Optional
|
@@ -234,6 +262,8 @@ module RBS
|
|
234
262
|
def initialize: (type: t, location: Location?) -> void
|
235
263
|
|
236
264
|
include _TypeBase
|
265
|
+
|
266
|
+
attr_reader location: Location?
|
237
267
|
end
|
238
268
|
|
239
269
|
class Union
|
@@ -243,6 +273,8 @@ module RBS
|
|
243
273
|
|
244
274
|
include _TypeBase
|
245
275
|
|
276
|
+
attr_reader location: Location?
|
277
|
+
|
246
278
|
def map_type: () { (t) -> t } -> Union
|
247
279
|
| () -> Enumerator[t, Union]
|
248
280
|
end
|
@@ -254,16 +286,21 @@ module RBS
|
|
254
286
|
|
255
287
|
include _TypeBase
|
256
288
|
|
289
|
+
attr_reader location: Location?
|
290
|
+
|
257
291
|
def map_type: () { (t) -> t } -> Intersection
|
258
292
|
| () -> Enumerator[t, Intersection]
|
259
293
|
end
|
260
294
|
|
261
295
|
class Function
|
262
296
|
class Param
|
297
|
+
type loc = Location::WithChildren[bot, :name]
|
298
|
+
|
263
299
|
attr_reader type: t
|
264
300
|
attr_reader name: Symbol?
|
301
|
+
attr_reader location: loc?
|
265
302
|
|
266
|
-
def initialize: (type: t, name: Symbol?) -> void
|
303
|
+
def initialize: (type: t, name: Symbol?, ?location: loc?) -> void
|
267
304
|
|
268
305
|
def map_type: { (t) -> t } -> Param
|
269
306
|
| -> Enumerator[t, Param]
|
@@ -300,7 +337,7 @@ module RBS
|
|
300
337
|
def each_param: () { (Param) -> void } -> void
|
301
338
|
| -> Enumerator[Param, void]
|
302
339
|
|
303
|
-
|
340
|
+
include _ToJson
|
304
341
|
|
305
342
|
def sub: (Substitution) -> Function
|
306
343
|
|
@@ -336,7 +373,7 @@ module RBS
|
|
336
373
|
|
337
374
|
def ==: (untyped other) -> bool
|
338
375
|
|
339
|
-
|
376
|
+
include _ToJson
|
340
377
|
|
341
378
|
def sub: (Substitution) -> Block
|
342
379
|
|
@@ -350,6 +387,8 @@ module RBS
|
|
350
387
|
def initialize: (location: Location?, type: Function, block: Block?) -> void
|
351
388
|
|
352
389
|
include _TypeBase
|
390
|
+
|
391
|
+
attr_reader location: Location?
|
353
392
|
end
|
354
393
|
|
355
394
|
class Literal
|
@@ -364,6 +403,8 @@ module RBS
|
|
364
403
|
include NoSubst
|
365
404
|
include EmptyEachType
|
366
405
|
include NoTypeName
|
406
|
+
|
407
|
+
attr_reader location: Location?
|
367
408
|
end
|
368
409
|
end
|
369
410
|
end
|