rbs 1.1.0 → 1.3.0
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 +67 -20
- 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/rubygems.rbs +2 -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? ==
|
@@ -134,25 +132,36 @@ module RBS
|
|
134
132
|
def self.build: (Symbol) -> Variable
|
135
133
|
| (Array[Symbol]) -> Array[Variable]
|
136
134
|
|
137
|
-
|
135
|
+
# Returns fresh type variable with prefix (if given.)
|
136
|
+
#
|
137
|
+
# Variable.fresh(:S) # => S@1
|
138
|
+
# Variable.fresh(:S) # => S@2
|
139
|
+
# Variable.fresh() # => T@3
|
140
|
+
#
|
141
|
+
def self.fresh: (?Symbol prefix) -> Variable
|
138
142
|
end
|
139
143
|
|
140
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
|
+
|
141
151
|
attr_reader name: TypeName
|
142
152
|
|
143
|
-
|
153
|
+
attr_reader location: loc?
|
144
154
|
|
145
|
-
|
155
|
+
include _TypeBase
|
156
|
+
include NoFreeVariables
|
157
|
+
include NoSubst
|
158
|
+
include EmptyEachType
|
146
159
|
|
147
160
|
def ==: (untyped other) -> bool
|
148
161
|
|
149
162
|
alias eql? ==
|
150
163
|
|
151
164
|
def hash: () -> Integer
|
152
|
-
|
153
|
-
include NoFreeVariables
|
154
|
-
include NoSubst
|
155
|
-
include EmptyEachType
|
156
165
|
end
|
157
166
|
|
158
167
|
module Application
|
@@ -174,11 +183,20 @@ module RBS
|
|
174
183
|
end
|
175
184
|
|
176
185
|
class Interface
|
177
|
-
|
186
|
+
# _Foo
|
187
|
+
# ^^^^ => name
|
188
|
+
#
|
189
|
+
# _Foo[Bar, Baz]
|
190
|
+
# ^^^^ => name
|
191
|
+
# ^^^^^^^^^^ => args
|
192
|
+
type loc = Location::WithChildren[:name, :args]
|
178
193
|
|
179
|
-
def initialize: (name: TypeName, args: Array[t], location:
|
194
|
+
def initialize: (name: TypeName, args: Array[t], location: loc?) -> void
|
180
195
|
|
196
|
+
include Application
|
181
197
|
include _TypeBase
|
198
|
+
|
199
|
+
attr_reader location: loc?
|
182
200
|
end
|
183
201
|
|
184
202
|
# ClassInstance represents a type of an instance of a class.
|
@@ -190,7 +208,17 @@ module RBS
|
|
190
208
|
class ClassInstance
|
191
209
|
include Application
|
192
210
|
|
193
|
-
|
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?
|
194
222
|
|
195
223
|
include _TypeBase
|
196
224
|
end
|
@@ -204,6 +232,8 @@ module RBS
|
|
204
232
|
include NoFreeVariables
|
205
233
|
include NoSubst
|
206
234
|
include EmptyEachType
|
235
|
+
|
236
|
+
attr_reader location: Location?
|
207
237
|
end
|
208
238
|
|
209
239
|
class Tuple
|
@@ -212,6 +242,8 @@ module RBS
|
|
212
242
|
def initialize: (types: Array[t], location: Location?) -> void
|
213
243
|
|
214
244
|
include _TypeBase
|
245
|
+
|
246
|
+
attr_reader location: Location?
|
215
247
|
end
|
216
248
|
|
217
249
|
class Record
|
@@ -220,6 +252,8 @@ module RBS
|
|
220
252
|
def initialize: (fields: Hash[Symbol, t], location: Location?) -> void
|
221
253
|
|
222
254
|
include _TypeBase
|
255
|
+
|
256
|
+
attr_reader location: Location?
|
223
257
|
end
|
224
258
|
|
225
259
|
class Optional
|
@@ -228,6 +262,8 @@ module RBS
|
|
228
262
|
def initialize: (type: t, location: Location?) -> void
|
229
263
|
|
230
264
|
include _TypeBase
|
265
|
+
|
266
|
+
attr_reader location: Location?
|
231
267
|
end
|
232
268
|
|
233
269
|
class Union
|
@@ -237,6 +273,8 @@ module RBS
|
|
237
273
|
|
238
274
|
include _TypeBase
|
239
275
|
|
276
|
+
attr_reader location: Location?
|
277
|
+
|
240
278
|
def map_type: () { (t) -> t } -> Union
|
241
279
|
| () -> Enumerator[t, Union]
|
242
280
|
end
|
@@ -248,16 +286,21 @@ module RBS
|
|
248
286
|
|
249
287
|
include _TypeBase
|
250
288
|
|
289
|
+
attr_reader location: Location?
|
290
|
+
|
251
291
|
def map_type: () { (t) -> t } -> Intersection
|
252
292
|
| () -> Enumerator[t, Intersection]
|
253
293
|
end
|
254
294
|
|
255
295
|
class Function
|
256
296
|
class Param
|
297
|
+
type loc = Location::WithChildren[bot, :name]
|
298
|
+
|
257
299
|
attr_reader type: t
|
258
300
|
attr_reader name: Symbol?
|
301
|
+
attr_reader location: loc?
|
259
302
|
|
260
|
-
def initialize: (type: t, name: Symbol?) -> void
|
303
|
+
def initialize: (type: t, name: Symbol?, ?location: loc?) -> void
|
261
304
|
|
262
305
|
def map_type: { (t) -> t } -> Param
|
263
306
|
| -> Enumerator[t, Param]
|
@@ -294,7 +337,7 @@ module RBS
|
|
294
337
|
def each_param: () { (Param) -> void } -> void
|
295
338
|
| -> Enumerator[Param, void]
|
296
339
|
|
297
|
-
|
340
|
+
include _ToJson
|
298
341
|
|
299
342
|
def sub: (Substitution) -> Function
|
300
343
|
|
@@ -330,7 +373,7 @@ module RBS
|
|
330
373
|
|
331
374
|
def ==: (untyped other) -> bool
|
332
375
|
|
333
|
-
|
376
|
+
include _ToJson
|
334
377
|
|
335
378
|
def sub: (Substitution) -> Block
|
336
379
|
|
@@ -344,6 +387,8 @@ module RBS
|
|
344
387
|
def initialize: (location: Location?, type: Function, block: Block?) -> void
|
345
388
|
|
346
389
|
include _TypeBase
|
390
|
+
|
391
|
+
attr_reader location: Location?
|
347
392
|
end
|
348
393
|
|
349
394
|
class Literal
|
@@ -358,6 +403,8 @@ module RBS
|
|
358
403
|
include NoSubst
|
359
404
|
include EmptyEachType
|
360
405
|
include NoTypeName
|
406
|
+
|
407
|
+
attr_reader location: Location?
|
361
408
|
end
|
362
409
|
end
|
363
410
|
end
|