rbs 0.12.1 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.gitignore +0 -1
- data/CHANGELOG.md +31 -0
- data/Gemfile +3 -0
- data/README.md +8 -2
- data/Rakefile +2 -2
- data/Steepfile +1 -0
- data/bin/annotate-with-rdoc +1 -1
- data/bin/setup +0 -2
- data/docs/CONTRIBUTING.md +1 -0
- data/docs/syntax.md +50 -6
- data/goodcheck.yml +22 -5
- data/lib/rbs/ast/comment.rb +1 -1
- data/lib/rbs/cli.rb +12 -4
- data/lib/rbs/constant.rb +1 -1
- data/lib/rbs/constant_table.rb +9 -8
- data/lib/rbs/definition_builder.rb +6 -7
- data/lib/rbs/environment.rb +5 -1
- data/lib/rbs/environment_loader.rb +12 -12
- data/lib/rbs/namespace.rb +1 -1
- data/lib/rbs/parser.rb +3148 -0
- data/lib/rbs/parser.y +10 -3
- data/lib/rbs/prototype/rb.rb +38 -6
- data/lib/rbs/prototype/runtime.rb +17 -7
- data/lib/rbs/test/hook.rb +2 -0
- data/lib/rbs/test/setup_helper.rb +4 -4
- data/lib/rbs/test/tester.rb +4 -1
- data/lib/rbs/test/type_check.rb +12 -6
- data/lib/rbs/type_name.rb +1 -1
- data/lib/rbs/variance_calculator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +25 -15
- data/sig/constant.rbs +21 -0
- data/sig/constant_table.rbs +30 -0
- data/sig/declarations.rbs +2 -2
- data/sig/definition.rbs +2 -2
- data/sig/definition_builder.rbs +4 -5
- data/sig/environment_loader.rbs +54 -0
- data/sig/members.rbs +2 -2
- data/sig/method_types.rbs +1 -1
- data/sig/namespace.rbs +4 -4
- data/sig/parser.rbs +25 -0
- data/sig/substitution.rbs +3 -3
- data/sig/typename.rbs +1 -1
- data/sig/types.rbs +1 -1
- data/sig/version.rbs +3 -0
- data/sig/writer.rbs +40 -0
- data/stdlib/base64/base64.rbs +1 -1
- data/stdlib/benchmark/benchmark.rbs +2 -2
- data/stdlib/builtin/array.rbs +124 -120
- data/stdlib/builtin/basic_object.rbs +54 -54
- data/stdlib/builtin/binding.rbs +42 -42
- data/stdlib/builtin/builtin.rbs +28 -0
- data/stdlib/builtin/class.rbs +33 -33
- data/stdlib/builtin/complex.rbs +90 -90
- data/stdlib/builtin/encoding.rbs +33 -33
- data/stdlib/builtin/enumerable.rbs +58 -52
- data/stdlib/builtin/enumerator.rbs +35 -35
- data/stdlib/builtin/errors.rbs +2 -2
- data/stdlib/builtin/exception.rbs +50 -50
- data/stdlib/builtin/false_class.rbs +6 -6
- data/stdlib/builtin/fiber.rbs +14 -14
- data/stdlib/builtin/fiber_error.rbs +1 -1
- data/stdlib/builtin/float.rbs +161 -161
- data/stdlib/builtin/gc.rbs +3 -3
- data/stdlib/builtin/hash.rbs +7 -7
- data/stdlib/builtin/io.rbs +88 -88
- data/stdlib/builtin/kernel.rbs +71 -153
- data/stdlib/builtin/match_data.rbs +1 -1
- data/stdlib/builtin/method.rbs +19 -19
- data/stdlib/builtin/module.rbs +13 -13
- data/stdlib/builtin/nil_class.rbs +20 -20
- data/stdlib/builtin/numeric.rbs +101 -101
- data/stdlib/builtin/object.rbs +173 -173
- data/stdlib/builtin/proc.rbs +91 -91
- data/stdlib/builtin/random.rbs +1 -1
- data/stdlib/builtin/range.rbs +3 -5
- data/stdlib/builtin/rational.rbs +83 -83
- data/stdlib/builtin/signal.rbs +7 -7
- data/stdlib/builtin/string.rbs +10 -10
- data/stdlib/builtin/string_io.rbs +8 -8
- data/stdlib/builtin/struct.rbs +1 -1
- data/stdlib/builtin/symbol.rbs +1 -1
- data/stdlib/builtin/thread.rbs +189 -189
- data/stdlib/builtin/thread_group.rbs +2 -2
- data/stdlib/builtin/true_class.rbs +10 -10
- data/stdlib/builtin/warning.rbs +1 -1
- data/stdlib/coverage/coverage.rbs +2 -2
- data/stdlib/csv/csv.rbs +1 -1
- data/stdlib/date/date.rbs +4 -4
- data/stdlib/date/date_time.rbs +1 -1
- data/stdlib/find/find.rbs +12 -12
- data/stdlib/logger/log_device.rbs +1 -1
- data/stdlib/logger/logger.rbs +1 -1
- data/stdlib/pathname/pathname.rbs +41 -39
- data/stdlib/pstore/pstore.rbs +287 -0
- data/stdlib/pty/pty.rbs +5 -29
- data/stdlib/tmpdir/tmpdir.rbs +12 -12
- data/stdlib/uri/generic.rbs +2 -2
- data/stdlib/uri/http.rbs +158 -0
- data/stdlib/uri/https.rbs +108 -0
- data/stdlib/uri/ldap.rbs +224 -0
- data/stdlib/uri/ldaps.rbs +108 -0
- data/steep/Gemfile.lock +13 -17
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5348f41dbf169228104d4ba79ad88098ec3e8e83656b48b0b1c5877fab2e8cb7
|
4
|
+
data.tar.gz: c79ce48144a85642f974b0973e22f8ed97a072d98ce98e2b62aebf639c8d04f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efb99d0e6476b83dbd1994a71526adab4b5b6aab2fc231a1685407739bb9a3e2f1268fb3effcbe701fa033608a0b872fd3f0011d046c599457bf47a3c3fcdb97
|
7
|
+
data.tar.gz: 87d13112f6abce7b7ead4e95302978d17c7c08eaf94485bf27c00c5d91e08f8c10458344661b73d518caff095787323d3694512d76796f2d20da8c2bad2e101f
|
data/.github/workflows/ruby.yml
CHANGED
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,37 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.15.0 (2020-11-2)
|
6
|
+
|
7
|
+
* Signature updates for `Kernel`, `PStore`, `Enumerable`, and `Array` ([#450](https://github.com/ruby/rbs/pull/450), [#443](https://github.com/ruby/rbs/pull/443), [#438](https://github.com/ruby/rbs/pull/438), [#437](https://github.com/ruby/rbs/pull/437), [#433](https://github.com/ruby/rbs/pull/433), [#432](https://github.com/ruby/rbs/pull/432))
|
8
|
+
* Add helper interfaces ([#434](https://github.com/ruby/rbs/pull/434), [#428](https://github.com/ruby/rbs/pull/428))
|
9
|
+
* Change `bool` type semantics ([#456](https://github.com/ruby/rbs/pull/456))
|
10
|
+
* Support alias in `rbs prototype rb` ([#457](https://github.com/ruby/rbs/pull/457))
|
11
|
+
* Runtime testing improvements ([#455](https://github.com/ruby/rbs/pull/455), [#447](https://github.com/ruby/rbs/pull/447), [#444](https://github.com/ruby/rbs/pull/444), [#431](https://github.com/ruby/rbs/pull/431))
|
12
|
+
* Fix proc type parsing ([#451](https://github.com/ruby/rbs/pull/451))
|
13
|
+
* Fix type variable parsing ([#442](https://github.com/ruby/rbs/pull/442))
|
14
|
+
|
15
|
+
|
16
|
+
## 0.14.0 (2020-10-17)
|
17
|
+
|
18
|
+
* Allow keyword names ending with `?` and `!` ([#417](https://github.com/ruby/rbs/pull/417))
|
19
|
+
* Make `Range[T]` covariant ([#418](https://github.com/ruby/rbs/pull/418))
|
20
|
+
|
21
|
+
## 0.13.1 (2020-10-09)
|
22
|
+
|
23
|
+
* Fix test for CI of ruby/ruby ([#412](https://github.com/ruby/rbs/pull/412))
|
24
|
+
|
25
|
+
## 0.13.0 (2020-10-09)
|
26
|
+
|
27
|
+
* Signature updates for `URI` classes.
|
28
|
+
* Fix tests ([#410](https://github.com/ruby/rbs/pull/410))
|
29
|
+
* Add `--silent` option for `rbs validate` ([#411](https://github.com/ruby/rbs/pull/411))
|
30
|
+
|
31
|
+
## 0.12.2 (2020-09-17)
|
32
|
+
|
33
|
+
* Minor signature update for `pty`
|
34
|
+
* Fix `PTY` stdlib test
|
35
|
+
|
5
36
|
## 0.12.1 (2020-09-16)
|
6
37
|
|
7
38
|
This version is to improve Ruby 3 testing compatibility. Nothing changed for users.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -74,7 +74,7 @@ $ rbs method Object then
|
|
74
74
|
|
75
75
|
## Library
|
76
76
|
|
77
|
-
There are two important concepts, _environment_ and _definition_.
|
77
|
+
There are two important concepts, _environment_ and _definition_.
|
78
78
|
|
79
79
|
An _environment_ is a dictionary that keeps track of all declarations. What is the declaration associated with `String` class? An _environment_ will give you the answer.
|
80
80
|
|
@@ -104,8 +104,14 @@ builder = RBS::DefinitionBuilder.new(env: environment)
|
|
104
104
|
|
105
105
|
# Definition of instance of String
|
106
106
|
instance = builder.build_instance(string)
|
107
|
-
|
107
|
+
|
108
|
+
# Print the types of `gsub` method:
|
108
109
|
puts instance.methods[:gsub].method_types.join("\n")
|
110
|
+
# Ouputs =>
|
111
|
+
# (::Regexp | ::string pattern, ::string replacement) -> ::String
|
112
|
+
# (::Regexp | ::string pattern, ::Hash[::String, ::String] hash) -> ::String
|
113
|
+
# (::Regexp | ::string pattern) { (::String match) -> ::_ToS } -> ::String
|
114
|
+
# (::Regexp | ::string pattern) -> ::Enumerator[::String, self]
|
109
115
|
|
110
116
|
# Definition of singleton of String
|
111
117
|
singleton = builder.build_singleton(string)
|
data/Rakefile
CHANGED
@@ -25,11 +25,11 @@ task :test_doc => :parser do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
task :validate => :parser do
|
28
|
-
sh "#{ruby} #{rbs} validate"
|
28
|
+
sh "#{ruby} #{rbs} validate --silent"
|
29
29
|
|
30
30
|
FileList["stdlib/*"].each do |path|
|
31
31
|
next if path =~ %r{stdlib/builtin}
|
32
|
-
sh "#{ruby} #{rbs} -r#{File.basename(path)} validate"
|
32
|
+
sh "#{ruby} #{rbs} -r#{File.basename(path)} validate --silent"
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
data/Steepfile
CHANGED
data/bin/annotate-with-rdoc
CHANGED
data/bin/setup
CHANGED
data/docs/CONTRIBUTING.md
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
- Use `rbs prototype runtime --merge CLASS_NAME` command to generate the missing method definitions.
|
18
18
|
- Committing the auto generated signatures is recommended.
|
19
19
|
5. Annotate with RDoc.
|
20
|
+
- You'll need RDoc installed. Rvm users should use `rvm docs generate` first.
|
20
21
|
- Use `bin/annotate-with-rdoc stdlib/path/to/signature.rbs` to annotate the RBS files.
|
21
22
|
- Committing the generated annotations is recommended.
|
22
23
|
6. Fix method types and comments.
|
data/docs/syntax.md
CHANGED
@@ -179,7 +179,7 @@ Proc type denotes type of procedures, `Proc` instances.
|
|
179
179
|
|
180
180
|
`instance` denotes the type of instance of the class. `class` is the singleton of the class.
|
181
181
|
|
182
|
-
`bool` is an
|
182
|
+
`bool` is an alias of `true | false`.
|
183
183
|
|
184
184
|
`untyped` is for _a type without type checking_. It is `?` in gradual typing, _dynamic_ in some languages like C#, and _any_ in TypeScript. It is both subtype _and_ supertype of all of the types. (The type was `any` but renamed to `untyped`.)
|
185
185
|
|
@@ -193,15 +193,34 @@ Proc type denotes type of procedures, `Proc` instances.
|
|
193
193
|
|
194
194
|
We recommend using `nil`.
|
195
195
|
|
196
|
-
#### `bool` or `
|
196
|
+
#### `bool` or `boolish`
|
197
197
|
|
198
|
-
We
|
198
|
+
We have a builtin type alias called `boolish`.
|
199
|
+
It is an alias of `top` type, and you can use `boolish` if we want to allow any object of any type.
|
199
200
|
|
200
|
-
|
201
|
+
We can see an example at the definition of `Enumerable#find`:
|
202
|
+
|
203
|
+
```
|
204
|
+
module Enumerable[Elem, Return]
|
205
|
+
def find: () { (Elem) -> boolish } -> Elem?
|
206
|
+
...
|
207
|
+
end
|
208
|
+
```
|
209
|
+
|
210
|
+
We want to write something like:
|
211
|
+
|
212
|
+
```
|
213
|
+
array.find {|x| x && x.some_test? } # The block will return (bool | nil)
|
214
|
+
```
|
215
|
+
|
216
|
+
We recommend using `boolish` for method arguments and block return values, if you only use the values for conditions.
|
217
|
+
You can write `bool` if you strictly want `true | false`.
|
218
|
+
|
219
|
+
#### `void`, `boolish`, or `top`?
|
201
220
|
|
202
221
|
They are all equivalent for the type system; they are all _top type_.
|
203
222
|
|
204
|
-
`void` tells developers a hint that _the value should not be used_. `
|
223
|
+
`void` tells developers a hint that _the value should not be used_. `boolish` implies the value is used as a truth value. `top` is anything else.
|
205
224
|
|
206
225
|
## Method Types
|
207
226
|
|
@@ -433,8 +452,10 @@ _global-name_ ::= /$[a-zA-Z]\w+/ | ...
|
|
433
452
|
_module-type-parameters_ ::= # Empty
|
434
453
|
| `[` _module-type-parameter_ `,` ... `]`
|
435
454
|
|
436
|
-
_module-type-parameter_ ::= _variance_ _type-variable_
|
455
|
+
_module-type-parameter_ ::= _check_ _variance_ _type-variable_
|
437
456
|
_variance_ ::= `out` | `in`
|
457
|
+
_check_ ::= # Empty
|
458
|
+
| `unchecked`
|
438
459
|
```
|
439
460
|
|
440
461
|
### Class declaration
|
@@ -448,6 +469,29 @@ class Ref[A] < Object
|
|
448
469
|
end
|
449
470
|
```
|
450
471
|
|
472
|
+
For classes with type parameters, you may specify if they are "invariant" (default), "covariant" (`out`) or "contravariant" (`in`). See [this definition of covariance and contravariance](https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)).
|
473
|
+
|
474
|
+
For example, an `Array` of `String` can almost be considered to be an `Array` of `Object`, but not the reverse, so we can think of:
|
475
|
+
|
476
|
+
```
|
477
|
+
class Array[out T]
|
478
|
+
# ...
|
479
|
+
end
|
480
|
+
```
|
481
|
+
|
482
|
+
There's a limitation with this is for mutable objects (like arrays): a mutation could invalidate this.
|
483
|
+
If an array of String is passed to a method as an array of Objects, and that method adds an Integer to the array, the promise is broken.
|
484
|
+
|
485
|
+
In those cases, one must use the `unchecked` keyword:
|
486
|
+
|
487
|
+
```
|
488
|
+
class Array[unchecked out T]
|
489
|
+
# ...
|
490
|
+
end
|
491
|
+
```
|
492
|
+
|
493
|
+
This is how `Array` is actually defined in RBS.
|
494
|
+
|
451
495
|
### Module declaration
|
452
496
|
|
453
497
|
Module declaration takes optional _self type_ parameter, which defines a constraint about a class when the module is mixed.
|
data/goodcheck.yml
CHANGED
@@ -6,12 +6,12 @@ rules:
|
|
6
6
|
- "stdlib/**/*.rbs"
|
7
7
|
fail:
|
8
8
|
- |
|
9
|
-
# arglists 💪👽🚨 << Delete this section
|
10
|
-
# File.absolute_path?(file_name) -> true or false
|
9
|
+
# arglists 💪👽🚨 << Delete this section
|
10
|
+
# File.absolute_path?(file_name) -> true or false
|
11
11
|
#
|
12
12
|
|
13
13
|
- id: rbs.no_arg
|
14
|
-
pattern:
|
14
|
+
pattern:
|
15
15
|
regexp: arg\d+
|
16
16
|
message: |
|
17
17
|
Stop using parameter names like `arg0` or `arg1`
|
@@ -23,7 +23,7 @@ rules:
|
|
23
23
|
- Documents (comments) may contain that pattern.
|
24
24
|
glob:
|
25
25
|
- "stdlib/**/*.rbs"
|
26
|
-
fail:
|
26
|
+
fail:
|
27
27
|
- "def `send`: (String | Symbol arg0, *untyped arg1) -> untyped"
|
28
28
|
pass:
|
29
29
|
- "def `send`: (String | Symbol, *untyped) -> untyped"
|
@@ -62,4 +62,21 @@ rules:
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
|
65
|
+
- id: no_trailing_whitespace
|
66
|
+
pattern:
|
67
|
+
regexp: '[ \t]+$'
|
68
|
+
message: |
|
69
|
+
Trim trailing whitespaces
|
70
|
+
glob:
|
71
|
+
- '**/*.rb'
|
72
|
+
- '**/*.rbs'
|
73
|
+
- '**/*.md'
|
74
|
+
justification:
|
75
|
+
- Let the maintainers know if it is an autogenerated files.
|
76
|
+
pass:
|
77
|
+
- "Hello world"
|
78
|
+
- "Hello\nworld"
|
79
|
+
- "Hello\n\nworld"
|
80
|
+
fail:
|
81
|
+
- "Hello world "
|
82
|
+
- "Hello \nworld"
|
data/lib/rbs/ast/comment.rb
CHANGED
data/lib/rbs/cli.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "open3"
|
1
2
|
require "optparse"
|
2
3
|
require "shellwords"
|
3
4
|
|
@@ -383,6 +384,11 @@ Examples:
|
|
383
384
|
|
384
385
|
$ rbs validate
|
385
386
|
EOU
|
387
|
+
|
388
|
+
opts.on("--silent") do
|
389
|
+
require "stringio"
|
390
|
+
@stdout = StringIO.new
|
391
|
+
end
|
386
392
|
end.parse!(args)
|
387
393
|
|
388
394
|
loader = EnvironmentLoader.new()
|
@@ -488,7 +494,7 @@ Show paths to directories where the RBS files are loaded from.
|
|
488
494
|
Examples:
|
489
495
|
|
490
496
|
$ rbs paths
|
491
|
-
$
|
497
|
+
$ rbs -r set paths
|
492
498
|
EOU
|
493
499
|
end.parse!(args)
|
494
500
|
|
@@ -543,7 +549,7 @@ EOU
|
|
543
549
|
Usage: rbs prototype runtime [options...] [pattern...]
|
544
550
|
|
545
551
|
Generate RBS prototype based on runtime introspection.
|
546
|
-
It loads Ruby code specified in [options] and generates RBS prototypes for classes matches to [pattern].
|
552
|
+
It loads Ruby code specified in [options] and generates RBS prototypes for classes matches to [pattern].
|
547
553
|
|
548
554
|
Examples:
|
549
555
|
|
@@ -808,8 +814,10 @@ EOB
|
|
808
814
|
'RBS_TEST_TARGET' => (targets.join(',') unless targets.empty?)
|
809
815
|
}
|
810
816
|
|
811
|
-
|
812
|
-
|
817
|
+
out, err, status = Open3.capture3(env_hash, *args)
|
818
|
+
stdout.print(out)
|
819
|
+
stderr.print(err)
|
820
|
+
status
|
813
821
|
end
|
814
822
|
end
|
815
823
|
end
|
data/lib/rbs/constant.rb
CHANGED
data/lib/rbs/constant_table.rb
CHANGED
@@ -47,6 +47,8 @@ module RBS
|
|
47
47
|
|
48
48
|
head, *tail = split_name(name)
|
49
49
|
|
50
|
+
raise unless head
|
51
|
+
|
50
52
|
head_constant = case
|
51
53
|
when name.absolute?
|
52
54
|
name_to_constant(TypeName.new(name: head, namespace: Namespace.root))
|
@@ -57,11 +59,13 @@ module RBS
|
|
57
59
|
resolve_constant_reference_inherit(head, scopes: constant_scopes(context.first.to_type_name))
|
58
60
|
end
|
59
61
|
|
60
|
-
|
61
|
-
|
62
|
-
resolve_constant_reference_inherit
|
63
|
-
|
64
|
-
|
62
|
+
tail.inject(head_constant) do |constant, name|
|
63
|
+
if constant
|
64
|
+
resolve_constant_reference_inherit(
|
65
|
+
name,
|
66
|
+
scopes: constant_scopes(constant.name),
|
67
|
+
no_object: constant.name != BuiltinNames::Object.name
|
68
|
+
)
|
65
69
|
end
|
66
70
|
end
|
67
71
|
end
|
@@ -150,9 +154,6 @@ module RBS
|
|
150
154
|
when Environment::ModuleEntry
|
151
155
|
constant_scopes0 BuiltinNames::Module.name, scopes: scopes
|
152
156
|
constant_scopes_module name, scopes: scopes
|
153
|
-
|
154
|
-
else
|
155
|
-
raise "Unexpected declaration: #{name} (#{entry.class})"
|
156
157
|
end
|
157
158
|
|
158
159
|
scopes
|
@@ -40,7 +40,7 @@ module RBS
|
|
40
40
|
if s = super_class
|
41
41
|
yield s
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
self_types&.each(&block)
|
45
45
|
included_modules&.each(&block)
|
46
46
|
prepended_modules&.each(&block)
|
@@ -303,7 +303,7 @@ module RBS
|
|
303
303
|
mod_ancestors = instance_ancestors(name, building_ancestors: building_ancestors)
|
304
304
|
ancestors.unshift(*mod_ancestors.apply(arg_types, location: entry.primary.decl.location))
|
305
305
|
end
|
306
|
-
end
|
306
|
+
end
|
307
307
|
end
|
308
308
|
|
309
309
|
ancestors.unshift(self_ancestor)
|
@@ -316,7 +316,7 @@ module RBS
|
|
316
316
|
mod_ancestors = instance_ancestors(name, building_ancestors: building_ancestors)
|
317
317
|
ancestors.unshift(*mod_ancestors.apply(arg_types, location: entry.primary.decl.location))
|
318
318
|
end
|
319
|
-
end
|
319
|
+
end
|
320
320
|
end
|
321
321
|
|
322
322
|
building_ancestors.pop
|
@@ -814,8 +814,7 @@ module RBS
|
|
814
814
|
|
815
815
|
methods.each do |name, method|
|
816
816
|
method.method_types.each do |method_type|
|
817
|
-
|
818
|
-
when MethodType
|
817
|
+
unless name == :initialize
|
819
818
|
result = calculator.in_method_type(method_type: method_type, variables: param_names)
|
820
819
|
|
821
820
|
validate_params_with type_params, result: result do |param|
|
@@ -941,8 +940,8 @@ module RBS
|
|
941
940
|
Definition::Method::TypeDef.new(
|
942
941
|
type: method_type,
|
943
942
|
member: initialize_def.member,
|
944
|
-
defined_in:
|
945
|
-
implemented_in:
|
943
|
+
defined_in: initialize_def.defined_in,
|
944
|
+
implemented_in: initialize_def.implemented_in
|
946
945
|
)
|
947
946
|
end,
|
948
947
|
accessibility: :public,
|
data/lib/rbs/environment.rb
CHANGED
@@ -13,7 +13,7 @@ module RBS
|
|
13
13
|
def context
|
14
14
|
@context ||= begin
|
15
15
|
(outer + [decl]).each.with_object([Namespace.root]) do |decl, array|
|
16
|
-
first = array.first or raise
|
16
|
+
first = array.first or raise
|
17
17
|
array.unshift(first + decl.name.to_namespace)
|
18
18
|
end
|
19
19
|
end
|
@@ -258,6 +258,8 @@ module RBS
|
|
258
258
|
outer: outer_,
|
259
259
|
prefix: prefix_
|
260
260
|
)
|
261
|
+
else
|
262
|
+
raise
|
261
263
|
end
|
262
264
|
end,
|
263
265
|
location: decl.location,
|
@@ -288,6 +290,8 @@ module RBS
|
|
288
290
|
outer: outer_,
|
289
291
|
prefix: prefix_
|
290
292
|
)
|
293
|
+
else
|
294
|
+
raise
|
291
295
|
end
|
292
296
|
end,
|
293
297
|
location: decl.location,
|