rbs 2.2.2 → 2.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/dependabot.yml +4 -0
- data/.github/workflows/comments.yml +2 -2
- data/.github/workflows/ruby.yml +1 -1
- data/.gitignore +0 -1
- data/CHANGELOG.md +43 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +117 -0
- data/Rakefile +1 -1
- data/core/dir.rbs +1 -1
- data/core/enumerator.rbs +1 -1
- data/core/false_class.rbs +1 -1
- data/core/integer.rbs +4 -4
- data/core/io/wait.rbs +1 -1
- data/core/module.rbs +21 -2
- data/core/nil_class.rbs +7 -5
- data/core/object.rbs +9 -0
- data/core/trace_point.rbs +42 -3
- data/core/true_class.rbs +1 -1
- data/ext/rbs_extension/constants.c +1 -1
- data/ext/rbs_extension/extconf.rb +1 -1
- data/ext/rbs_extension/location.c +1 -1
- data/ext/rbs_extension/parser.c +4 -3
- data/ext/rbs_extension/parserstate.c +2 -2
- data/ext/rbs_extension/unescape.c +1 -1
- data/lib/rbs/ast/members.rb +2 -1
- data/lib/rbs/collection/installer.rb +4 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +4 -2
- data/lib/rbs/definition_builder/method_builder.rb +1 -1
- data/lib/rbs/definition_builder.rb +2 -2
- data/lib/rbs/environment.rb +24 -12
- data/lib/rbs/locator.rb +24 -15
- data/lib/rbs/prototype/rb.rb +17 -6
- data/lib/rbs/resolver/constant_resolver.rb +192 -0
- data/lib/rbs/resolver/type_name_resolver.rb +55 -0
- data/lib/rbs/type_name.rb +15 -0
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +2 -0
- data/schema/members.json +4 -1
- data/sig/environment.rbs +28 -21
- data/sig/environment_loader.rbs +23 -23
- data/sig/locator.rbs +2 -0
- data/sig/manifest.yaml +8 -0
- data/sig/resolver/constant_resolver.rbs +93 -0
- data/sig/resolver/context.rbs +34 -0
- data/sig/resolver/type_name_resolver.rbs +31 -0
- data/sig/typename.rbs +9 -3
- data/stdlib/bigdecimal/0/big_decimal.rbs +135 -0
- data/stdlib/erb/0/erb.rbs +237 -0
- data/stdlib/optparse/0/optparse.rbs +20 -18
- data/stdlib/prime/0/prime.rbs +115 -4
- data/stdlib/rubygems/0/version.rbs +159 -1
- data/steep/Gemfile.lock +13 -15
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f16a35868e75e53f28b6c63c095c60190f14e3eecb9d30b87046d184646176dd
|
4
|
+
data.tar.gz: 123998b67c9b926af173e64adeb0e9437ff784d13d960d50219274f472c36973
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9ba3b43d4dbf19239b4ece9443d5da88ff2ca62cf73bfa102464537ecad3a3893b2d6de97679e51d25c2abd5bc43cfb69d608227aa779b6352a9a9ae78c1cac
|
7
|
+
data.tar.gz: cdec18fab9146ce955a5b10b74f9c068a8ebec8a229bf9019ec2772d99e47b57ece38342cb71a8b9b2740d99106151b6fa91e3a6c2c80685a386f58c63eb5757
|
data/.github/dependabot.yml
CHANGED
@@ -12,11 +12,11 @@ jobs:
|
|
12
12
|
container:
|
13
13
|
image: rubylang/ruby:3.1-focal
|
14
14
|
steps:
|
15
|
-
- uses: actions/checkout@
|
15
|
+
- uses: actions/checkout@v3
|
16
16
|
- name: Install dependencies
|
17
17
|
run: |
|
18
18
|
apt-get update
|
19
|
-
apt-get install -y libdb-dev
|
19
|
+
apt-get install -y libdb-dev curl
|
20
20
|
- name: Update rubygems & bundler
|
21
21
|
run: |
|
22
22
|
ruby -v
|
data/.github/workflows/ruby.yml
CHANGED
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,49 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 2.3.0 (2022-04-01)
|
6
|
+
|
7
|
+
### Signature updates
|
8
|
+
|
9
|
+
* `Enumerator` ([\#931](https://github.com/ruby/rbs/pull/931))
|
10
|
+
* `FalseClass` ([\#931](https://github.com/ruby/rbs/pull/931))
|
11
|
+
* `Integer` ([\#914](https://github.com/ruby/rbs/pull/914))
|
12
|
+
* `Module` ([\#931](https://github.com/ruby/rbs/pull/931))
|
13
|
+
* `NilClass` ([\#931](https://github.com/ruby/rbs/pull/931))
|
14
|
+
* `Object` ([\#931](https://github.com/ruby/rbs/pull/931))
|
15
|
+
* `Prime` ([\#934](https://github.com/ruby/rbs/pull/934))
|
16
|
+
* `TracePoint` ([\#941](https://github.com/ruby/rbs/pull/941))
|
17
|
+
* `TrueClass` ([\#931](https://github.com/ruby/rbs/pull/931))
|
18
|
+
* `#to_d` ([\#936](https://github.com/ruby/rbs/pull/936))
|
19
|
+
* `IO#wait_writable` ([\#943](https://github.com/ruby/rbs/pull/943))
|
20
|
+
|
21
|
+
### Library changes
|
22
|
+
|
23
|
+
* Add `Resolver::ConstantResolver` and `Resolver::TypeNameResolver` ([\#938](https://github.com/ruby/rbs/pull/938))
|
24
|
+
* Fix RBS::Locator ([\#930](https://github.com/ruby/rbs/pull/930))
|
25
|
+
* Trying to preserve more locations ([\#915](https://github.com/ruby/rbs/pull/915))
|
26
|
+
* Add visibility modifier to method definition json ([\#923](https://github.com/ruby/rbs/pull/923), [\#928](https://github.com/ruby/rbs/pull/928))
|
27
|
+
* Add manifest.yaml for rbs gem ([\#921](https://github.com/ruby/rbs/pull/921))
|
28
|
+
* Fix Environment type checking ([\#929](https://github.com/ruby/rbs/pull/929))
|
29
|
+
* Fix memory violation in C extension ([\#952](https://github.com/ruby/rbs/pull/952))
|
30
|
+
* Fix warnings in C extension ([\#954](https://github.com/ruby/rbs/pull/954))
|
31
|
+
|
32
|
+
#### rbs prototype
|
33
|
+
|
34
|
+
* Better typing for known `self`-returning method calls ([\#932](https://github.com/ruby/rbs/pull/932))
|
35
|
+
* Let constants have literal types ([\#937](https://github.com/ruby/rbs/pull/937))
|
36
|
+
|
37
|
+
#### rbs collection
|
38
|
+
|
39
|
+
* Fix error message to tell gem name when source is not found ([\#927](https://github.com/ruby/rbs/pull/927))
|
40
|
+
|
41
|
+
### Miscellaneous
|
42
|
+
|
43
|
+
* Fix `bin/sort` for constants ([\#919](https://github.com/ruby/rbs/pull/919))
|
44
|
+
* Use actions/checkout@v3 ([\#944](https://github.com/ruby/rbs/pull/944))
|
45
|
+
* Added actions ecosystem for dependabot ([\#946](https://github.com/ruby/rbs/pull/946))
|
46
|
+
* Confirm RDoc is up to date ([\#945](https://github.com/ruby/rbs/pull/945))
|
47
|
+
|
5
48
|
## 2.2.2 (2022-02-22)
|
6
49
|
|
7
50
|
### Signature updates
|
data/Gemfile
CHANGED
@@ -8,7 +8,6 @@ gem "rake"
|
|
8
8
|
gem "rake-compiler"
|
9
9
|
gem "test-unit"
|
10
10
|
gem "rspec"
|
11
|
-
gem "racc"
|
12
11
|
gem "rubocop"
|
13
12
|
gem "rubocop-rubycw"
|
14
13
|
gem "json"
|
@@ -18,6 +17,8 @@ gem "goodcheck"
|
|
18
17
|
gem "dbm"
|
19
18
|
gem 'digest'
|
20
19
|
gem 'tempfile'
|
20
|
+
gem "prime"
|
21
|
+
gem "rdoc"
|
21
22
|
|
22
23
|
# Test gems
|
23
24
|
gem "rbs-amber", path: "test/assets/test-gem"
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rbs (2.3.0)
|
5
|
+
|
6
|
+
PATH
|
7
|
+
remote: test/assets/test-gem
|
8
|
+
specs:
|
9
|
+
rbs-amber (1.0.0)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
addressable (2.8.0)
|
15
|
+
public_suffix (>= 2.0.2, < 5.0)
|
16
|
+
ast (2.4.2)
|
17
|
+
dbm (1.1.0)
|
18
|
+
debase (0.2.5.beta2)
|
19
|
+
debase-ruby_core_source (>= 0.10.12)
|
20
|
+
debase-ruby_core_source (0.10.14)
|
21
|
+
diff-lcs (1.5.0)
|
22
|
+
digest (3.1.0)
|
23
|
+
forwardable (1.3.2)
|
24
|
+
goodcheck (3.1.0)
|
25
|
+
marcel (>= 1.0, < 2.0)
|
26
|
+
psych (>= 3.1, < 5.0)
|
27
|
+
rainbow (>= 3.0, < 4.0)
|
28
|
+
strong_json (>= 1.1, < 2.2)
|
29
|
+
json (2.6.1)
|
30
|
+
json-schema (2.8.1)
|
31
|
+
addressable (>= 2.4)
|
32
|
+
marcel (1.0.2)
|
33
|
+
minitest (5.15.0)
|
34
|
+
parallel (1.22.1)
|
35
|
+
parser (3.1.1.0)
|
36
|
+
ast (~> 2.4.1)
|
37
|
+
power_assert (2.0.1)
|
38
|
+
prime (0.1.2)
|
39
|
+
forwardable
|
40
|
+
singleton
|
41
|
+
psych (4.0.3)
|
42
|
+
stringio
|
43
|
+
public_suffix (4.0.6)
|
44
|
+
rainbow (3.1.1)
|
45
|
+
rake (13.0.6)
|
46
|
+
rake-compiler (1.1.9)
|
47
|
+
rake
|
48
|
+
rdoc (6.4.0)
|
49
|
+
psych (>= 4.0.0)
|
50
|
+
regexp_parser (2.2.1)
|
51
|
+
rexml (3.2.5)
|
52
|
+
rspec (3.11.0)
|
53
|
+
rspec-core (~> 3.11.0)
|
54
|
+
rspec-expectations (~> 3.11.0)
|
55
|
+
rspec-mocks (~> 3.11.0)
|
56
|
+
rspec-core (3.11.0)
|
57
|
+
rspec-support (~> 3.11.0)
|
58
|
+
rspec-expectations (3.11.0)
|
59
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
60
|
+
rspec-support (~> 3.11.0)
|
61
|
+
rspec-mocks (3.11.1)
|
62
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
63
|
+
rspec-support (~> 3.11.0)
|
64
|
+
rspec-support (3.11.0)
|
65
|
+
rubocop (1.26.1)
|
66
|
+
parallel (~> 1.10)
|
67
|
+
parser (>= 3.1.0.0)
|
68
|
+
rainbow (>= 2.2.2, < 4.0)
|
69
|
+
regexp_parser (>= 1.8, < 3.0)
|
70
|
+
rexml
|
71
|
+
rubocop-ast (>= 1.16.0, < 2.0)
|
72
|
+
ruby-progressbar (~> 1.7)
|
73
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
74
|
+
rubocop-ast (1.16.0)
|
75
|
+
parser (>= 3.1.1.0)
|
76
|
+
rubocop-rubycw (0.1.6)
|
77
|
+
rubocop (~> 1.0)
|
78
|
+
ruby-debug-ide (0.7.3)
|
79
|
+
rake (>= 0.8.1)
|
80
|
+
ruby-progressbar (1.11.0)
|
81
|
+
singleton (0.1.1)
|
82
|
+
stackprof (0.2.19)
|
83
|
+
stringio (3.0.1)
|
84
|
+
strong_json (2.1.2)
|
85
|
+
tempfile (0.1.2)
|
86
|
+
test-unit (3.5.3)
|
87
|
+
power_assert
|
88
|
+
unicode-display_width (2.1.0)
|
89
|
+
|
90
|
+
PLATFORMS
|
91
|
+
ruby
|
92
|
+
x86_64-darwin-20
|
93
|
+
|
94
|
+
DEPENDENCIES
|
95
|
+
dbm
|
96
|
+
debase (>= 0.2.5.beta2)
|
97
|
+
digest
|
98
|
+
goodcheck
|
99
|
+
json
|
100
|
+
json-schema
|
101
|
+
minitest
|
102
|
+
prime
|
103
|
+
rake
|
104
|
+
rake-compiler
|
105
|
+
rbs!
|
106
|
+
rbs-amber!
|
107
|
+
rdoc
|
108
|
+
rspec
|
109
|
+
rubocop
|
110
|
+
rubocop-rubycw
|
111
|
+
ruby-debug-ide
|
112
|
+
stackprof
|
113
|
+
tempfile
|
114
|
+
test-unit
|
115
|
+
|
116
|
+
BUNDLED WITH
|
117
|
+
2.2.32
|
data/Rakefile
CHANGED
data/core/dir.rbs
CHANGED
@@ -406,7 +406,7 @@ class Dir
|
|
406
406
|
# Dir.glob("*.[^r]*") #=> ["config.h"]
|
407
407
|
# Dir.glob("*.{rb,h}") #=> ["main.rb", "config.h"]
|
408
408
|
# Dir.glob("*") #=> ["config.h", "main.rb"]
|
409
|
-
# Dir.glob("*", File::FNM_DOTMATCH) #=> [".", "
|
409
|
+
# Dir.glob("*", File::FNM_DOTMATCH) #=> [".", "config.h", "main.rb"]
|
410
410
|
# Dir.glob(["*.rb", "*.h"]) #=> ["main.rb", "config.h"]
|
411
411
|
#
|
412
412
|
# Dir.glob("**/*.rb") #=> ["main.rb",
|
data/core/enumerator.rbs
CHANGED
data/core/false_class.rbs
CHANGED
data/core/integer.rbs
CHANGED
@@ -857,8 +857,8 @@ class Integer < Numeric
|
|
857
857
|
#
|
858
858
|
# With no block given, returns an Enumerator.
|
859
859
|
#
|
860
|
-
def downto: (
|
861
|
-
| (
|
860
|
+
def downto: (Numeric limit) { (Integer) -> void } -> Integer
|
861
|
+
| (Numeric limit) -> ::Enumerator[Integer, self]
|
862
862
|
|
863
863
|
def dup: () -> self
|
864
864
|
|
@@ -1432,8 +1432,8 @@ class Integer < Numeric
|
|
1432
1432
|
#
|
1433
1433
|
# With no block given, returns an Enumerator.
|
1434
1434
|
#
|
1435
|
-
def upto: (
|
1436
|
-
| (
|
1435
|
+
def upto: (Numeric limit) { (Integer) -> void } -> Integer
|
1436
|
+
| (Numeric limit) -> ::Enumerator[Integer, self]
|
1437
1437
|
|
1438
1438
|
# <!--
|
1439
1439
|
# rdoc-file=numeric.rb
|
data/core/io/wait.rbs
CHANGED
data/core/module.rbs
CHANGED
@@ -363,7 +363,7 @@ class Module < Object
|
|
363
363
|
#
|
364
364
|
# Hello there!
|
365
365
|
#
|
366
|
-
def class_exec: (*untyped args) { () ->
|
366
|
+
def class_exec: [U] (*untyped args) { () -> U } -> U
|
367
367
|
|
368
368
|
# <!--
|
369
369
|
# rdoc-file=object.c
|
@@ -676,6 +676,25 @@ class Module < Object
|
|
676
676
|
def define_method: (Symbol | String arg0, ?Proc | Method | UnboundMethod arg1) -> Symbol
|
677
677
|
| (Symbol | String arg0) { () -> untyped } -> Symbol
|
678
678
|
|
679
|
+
# <!--
|
680
|
+
# rdoc-file=object.c
|
681
|
+
# - mod.deprecate_constant(symbol, ...) => mod
|
682
|
+
# -->
|
683
|
+
# Makes a list of existing constants deprecated. Attempt to refer to them will
|
684
|
+
# produce a warning.
|
685
|
+
#
|
686
|
+
# module HTTP
|
687
|
+
# NotFound = Exception.new
|
688
|
+
# NOT_FOUND = NotFound # previous version of the library used this name
|
689
|
+
#
|
690
|
+
# deprecate_constant :NOT_FOUND
|
691
|
+
# end
|
692
|
+
#
|
693
|
+
# HTTP::NOT_FOUND
|
694
|
+
# # warning: constant HTTP::NOT_FOUND is deprecated
|
695
|
+
#
|
696
|
+
def deprecate_constant: (*Symbol) -> self
|
697
|
+
|
679
698
|
def eql?: (untyped other) -> bool
|
680
699
|
|
681
700
|
def equal?: (untyped other) -> bool
|
@@ -1025,7 +1044,7 @@ class Module < Object
|
|
1025
1044
|
#
|
1026
1045
|
# Hello there!
|
1027
1046
|
#
|
1028
|
-
def module_exec: (*untyped args) { () ->
|
1047
|
+
def module_exec: [U] (*untyped args) { (*untyped args) -> U } -> U
|
1029
1048
|
|
1030
1049
|
# <!--
|
1031
1050
|
# rdoc-file=vm_method.c
|
data/core/nil_class.rbs
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
class NilClass
|
5
5
|
public
|
6
6
|
|
7
|
+
def !: () -> true
|
8
|
+
|
7
9
|
# <!--
|
8
10
|
# rdoc-file=object.c
|
9
11
|
# - false & obj -> false
|
@@ -12,7 +14,7 @@ class NilClass
|
|
12
14
|
# And---Returns `false`. *obj* is always evaluated as it is the argument to a
|
13
15
|
# method call---there is no short-circuit evaluation in this case.
|
14
16
|
#
|
15
|
-
def &: (untyped obj) ->
|
17
|
+
def &: (untyped obj) -> false
|
16
18
|
|
17
19
|
# <!--
|
18
20
|
# rdoc-file=object.c
|
@@ -23,7 +25,7 @@ class NilClass
|
|
23
25
|
# statements.
|
24
26
|
#
|
25
27
|
def ===: (nil) -> true
|
26
|
-
| (untyped obj) ->
|
28
|
+
| (untyped obj) -> false
|
27
29
|
|
28
30
|
# <!--
|
29
31
|
# rdoc-file=object.c
|
@@ -43,7 +45,7 @@ class NilClass
|
|
43
45
|
#
|
44
46
|
def ^: (nil) -> false
|
45
47
|
| (false) -> false
|
46
|
-
| (untyped obj) ->
|
48
|
+
| (untyped obj) -> true
|
47
49
|
|
48
50
|
# <!--
|
49
51
|
# rdoc-file=object.c
|
@@ -59,7 +61,7 @@ class NilClass
|
|
59
61
|
# -->
|
60
62
|
# Only the object *nil* responds `true` to `nil?`.
|
61
63
|
#
|
62
|
-
def nil?: () ->
|
64
|
+
def nil?: () -> true
|
63
65
|
|
64
66
|
# <!--
|
65
67
|
# rdoc-file=rational.c
|
@@ -142,7 +144,7 @@ class NilClass
|
|
142
144
|
#
|
143
145
|
def |: (nil) -> false
|
144
146
|
| (false) -> false
|
145
|
-
| (untyped obj) ->
|
147
|
+
| (untyped obj) -> true
|
146
148
|
|
147
149
|
def clone: (?freeze: true?) -> self
|
148
150
|
end
|
data/core/object.rbs
CHANGED
@@ -912,6 +912,15 @@ class Object < BasicObject
|
|
912
912
|
#
|
913
913
|
def public_method: (name name) -> Method
|
914
914
|
|
915
|
+
# <!--
|
916
|
+
# rdoc-file=object.c
|
917
|
+
# - obj.public_methods(all=true) -> array
|
918
|
+
# -->
|
919
|
+
# Returns the list of public methods accessible to *obj*. If the *all* parameter
|
920
|
+
# is set to `false`, only those methods in the receiver will be listed.
|
921
|
+
#
|
922
|
+
def public_methods: (?boolish all) -> Array[Symbol]
|
923
|
+
|
915
924
|
# <!--
|
916
925
|
# rdoc-file=vm_eval.c
|
917
926
|
# - obj.public_send(symbol [, args...]) -> obj
|
data/core/trace_point.rbs
CHANGED
@@ -304,8 +304,8 @@ class TracePoint < Object
|
|
304
304
|
# trace.enable { p tp.lineno }
|
305
305
|
# #=> RuntimeError: access from outside
|
306
306
|
#
|
307
|
-
def enable: () -> bool
|
308
|
-
| () { () ->
|
307
|
+
def enable: (?target: (Method | UnboundMethod | Proc)?, ?target_line: Integer?, ?target_thread: Thread?) -> bool
|
308
|
+
| [R] (?target: (Method | UnboundMethod | Proc)?, ?target_line: Integer?, ?target_thread: Thread?) { () -> R } -> R
|
309
309
|
|
310
310
|
# <!--
|
311
311
|
# rdoc-file=trace_point.rb
|
@@ -315,6 +315,16 @@ class TracePoint < Object
|
|
315
315
|
#
|
316
316
|
def enabled?: () -> bool
|
317
317
|
|
318
|
+
# <!--
|
319
|
+
# rdoc-file=trace_point.rb
|
320
|
+
# - event()
|
321
|
+
# -->
|
322
|
+
# Type of event
|
323
|
+
#
|
324
|
+
# See TracePoint@Events for more information.
|
325
|
+
#
|
326
|
+
def event: () -> ::Symbol
|
327
|
+
|
318
328
|
# <!--
|
319
329
|
# rdoc-file=trace_point.rb
|
320
330
|
# - trace.inspect -> string
|
@@ -347,6 +357,15 @@ class TracePoint < Object
|
|
347
357
|
#
|
348
358
|
def path: () -> String
|
349
359
|
|
360
|
+
# <!--
|
361
|
+
# rdoc-file=trace_point.rb
|
362
|
+
# - parameters()
|
363
|
+
# -->
|
364
|
+
# Return the parameters definition of the method or block that the current hook
|
365
|
+
# belongs to. Format is the same as for Method#parameters
|
366
|
+
#
|
367
|
+
def parameters: () -> ::Array[[ :req | :opt | :rest | :keyreq | :key | :keyrest | :block, Symbol ] | [ :rest | :keyrest ]]
|
368
|
+
|
350
369
|
# <!--
|
351
370
|
# rdoc-file=trace_point.rb
|
352
371
|
# - raised_exception()
|
@@ -374,5 +393,25 @@ class TracePoint < Object
|
|
374
393
|
#
|
375
394
|
# trace.binding.eval('self')
|
376
395
|
#
|
377
|
-
def self: () ->
|
396
|
+
def self: () -> untyped
|
397
|
+
|
398
|
+
# <!--
|
399
|
+
# rdoc-file=trace_point.rb
|
400
|
+
# - eval_script()
|
401
|
+
# -->
|
402
|
+
# Compiled source code (String) on *eval methods on the `:script_compiled`
|
403
|
+
# event. If loaded from a file, it will return nil.
|
404
|
+
#
|
405
|
+
def eval_script: () -> String?
|
406
|
+
|
407
|
+
# <!--
|
408
|
+
# rdoc-file=trace_point.rb
|
409
|
+
# - instruction_sequence()
|
410
|
+
# -->
|
411
|
+
# Compiled instruction sequence represented by a RubyVM::InstructionSequence
|
412
|
+
# instance on the `:script_compiled` event.
|
413
|
+
#
|
414
|
+
# Note that this method is MRI specific.
|
415
|
+
#
|
416
|
+
def instruction_sequence: () -> RubyVM::InstructionSequence
|
378
417
|
end
|
data/core/true_class.rbs
CHANGED
@@ -276,7 +276,7 @@ VALUE rbs_location_pp(VALUE buffer, const position *start_pos, const position *e
|
|
276
276
|
return rbs_new_location(buffer, rg);
|
277
277
|
}
|
278
278
|
|
279
|
-
void rbs__init_location() {
|
279
|
+
void rbs__init_location(void) {
|
280
280
|
RBS_Location = rb_define_class_under(RBS, "Location", rb_cObject);
|
281
281
|
rb_define_alloc_func(RBS_Location, location_s_allocate);
|
282
282
|
rb_define_private_method(RBS_Location, "initialize", location_initialize, 3);
|
data/ext/rbs_extension/parser.c
CHANGED
@@ -77,7 +77,7 @@ static VALUE string_of_loc(parserstate *state, position start, position end) {
|
|
77
77
|
/**
|
78
78
|
* Raises RuntimeError with "Unexpected error " messsage.
|
79
79
|
* */
|
80
|
-
static NORETURN(void) rbs_abort() {
|
80
|
+
static NORETURN(void) rbs_abort(void) {
|
81
81
|
rb_raise(
|
82
82
|
rb_eRuntimeError,
|
83
83
|
"Unexpected error"
|
@@ -1046,7 +1046,6 @@ VALUE parse_type_params(parserstate *state, range *rg, bool module_type_params)
|
|
1046
1046
|
|
1047
1047
|
parser_advance_assert(state, tUIDENT);
|
1048
1048
|
name_range = state->current_token.range;
|
1049
|
-
param_range.end = state->current_token.range.end;
|
1050
1049
|
|
1051
1050
|
ID id = INTERN_TOKEN(state, state->current_token);
|
1052
1051
|
name = ID2SYM(id);
|
@@ -1065,6 +1064,8 @@ VALUE parse_type_params(parserstate *state, range *rg, bool module_type_params)
|
|
1065
1064
|
}
|
1066
1065
|
}
|
1067
1066
|
|
1067
|
+
param_range.end = state->current_token.range.end;
|
1068
|
+
|
1068
1069
|
VALUE location = rbs_new_location(state->buffer, param_range);
|
1069
1070
|
rbs_loc *loc = rbs_check_location(location);
|
1070
1071
|
rbs_loc_add_required_child(loc, rb_intern("name"), name_range);
|
@@ -2495,7 +2496,7 @@ rbsparser_parse_signature(VALUE self, VALUE buffer, VALUE line, VALUE column)
|
|
2495
2496
|
return signature;
|
2496
2497
|
}
|
2497
2498
|
|
2498
|
-
void rbs__init_parser() {
|
2499
|
+
void rbs__init_parser(void) {
|
2499
2500
|
RBS_Parser = rb_define_class_under(RBS, "Parser", rb_cObject);
|
2500
2501
|
rb_define_singleton_method(RBS_Parser, "_parse_type", rbsparser_parse_type, 4);
|
2501
2502
|
rb_define_singleton_method(RBS_Parser, "_parse_method_type", rbsparser_parse_method_type, 4);
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
#define RESET_TABLE_P(table) (table->size == 0)
|
4
4
|
|
5
|
-
id_table *alloc_empty_table() {
|
5
|
+
id_table *alloc_empty_table(void) {
|
6
6
|
id_table *table = malloc(sizeof(id_table));
|
7
7
|
table->size = 10;
|
8
8
|
table->count = 0;
|
@@ -11,7 +11,7 @@ id_table *alloc_empty_table() {
|
|
11
11
|
return table;
|
12
12
|
}
|
13
13
|
|
14
|
-
id_table *alloc_reset_table() {
|
14
|
+
id_table *alloc_reset_table(void) {
|
15
15
|
id_table *table = malloc(sizeof(id_table));
|
16
16
|
table->size = 0;
|
17
17
|
|
@@ -19,6 +19,7 @@ void rbs_unescape_string(VALUE string) {
|
|
19
19
|
|
20
20
|
if (!HASH) {
|
21
21
|
HASH = rb_hash_new();
|
22
|
+
rb_global_variable(&HASH);
|
22
23
|
rb_hash_aset(HASH, rb_str_new_literal("\\a"), rb_str_new_literal("\a"));
|
23
24
|
rb_hash_aset(HASH, rb_str_new_literal("\\b"), rb_str_new_literal("\b"));
|
24
25
|
rb_hash_aset(HASH, rb_str_new_literal("\\e"), rb_str_new_literal("\e"));
|
@@ -29,7 +30,6 @@ void rbs_unescape_string(VALUE string) {
|
|
29
30
|
rb_hash_aset(HASH, rb_str_new_literal("\\t"), rb_str_new_literal("\t"));
|
30
31
|
rb_hash_aset(HASH, rb_str_new_literal("\\v"), rb_str_new_literal("\v"));
|
31
32
|
rb_hash_aset(HASH, rb_str_new_literal("\\\""), rb_str_new_literal("\""));
|
32
|
-
rb_global_variable(&HASH);
|
33
33
|
}
|
34
34
|
|
35
35
|
rb_funcall(string, gsub, 2, REGEXP, HASH);
|
data/lib/rbs/ast/members.rb
CHANGED
@@ -20,7 +20,10 @@ module RBS
|
|
20
20
|
|
21
21
|
private def source_for(config_entry)
|
22
22
|
@source_for ||= {}
|
23
|
-
key = config_entry['source']
|
23
|
+
key = config_entry['source']
|
24
|
+
unless key
|
25
|
+
raise "Cannot find source of '#{config_entry['name']}' gem"
|
26
|
+
end
|
24
27
|
@source_for[key] ||= Sources.from_config_entry(key)
|
25
28
|
end
|
26
29
|
end
|
@@ -367,7 +367,7 @@ module RBS
|
|
367
367
|
|
368
368
|
align_params = Substitution.build(
|
369
369
|
decl.type_params.each.map(&:name),
|
370
|
-
Types::Variable.
|
370
|
+
entry.type_params.map {|param| Types::Variable.new(name: param.name, location: param.location) }
|
371
371
|
)
|
372
372
|
|
373
373
|
mixin_ancestors0(decl,
|
@@ -386,7 +386,9 @@ module RBS
|
|
386
386
|
|
387
387
|
entry = env.class_decls[type_name] or raise "Unknown name for instance_ancestors: #{type_name}"
|
388
388
|
params = entry.type_params.each.map(&:name)
|
389
|
-
args =
|
389
|
+
args = entry.type_params.map do |type_param|
|
390
|
+
Types::Variable.new(name: type_param.name, location: type_param.location)
|
391
|
+
end
|
390
392
|
self_ancestor = Definition::Ancestor::Instance.new(name: type_name, args: args, source: nil)
|
391
393
|
|
392
394
|
RecursiveAncestorError.check!(self_ancestor,
|
@@ -98,7 +98,7 @@ module RBS
|
|
98
98
|
instance_methods[type_name] ||=
|
99
99
|
begin
|
100
100
|
entry = env.class_decls[type_name]
|
101
|
-
args = Types::Variable.
|
101
|
+
args = entry.type_params.map {|param| Types::Variable.new(name: param.name, location: param.location) }
|
102
102
|
type = Types::ClassInstance.new(name: type_name, args: args, location: nil)
|
103
103
|
Methods.new(type: type).tap do |methods|
|
104
104
|
entry.decls.each do |d|
|