rbs 2.3.0 → 2.3.1
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 +18 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +1 -1
- data/ext/rbs_extension/extconf.rb +1 -1
- data/ext/rbs_extension/parser.c +5 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +1 -0
- data/lib/rbs/prototype/rb.rb +1 -1
- data/lib/rbs/resolver/constant_resolver.rb +27 -8
- data/lib/rbs/version.rb +1 -1
- data/steep/Gemfile.lock +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79b2c9781565a156da1f9a40c4e5facddac2112036a8a225fff739b647b3ff87
|
4
|
+
data.tar.gz: 6477d9d8ebd4eecbae21449c267a62d62835787570880fcc57cebe8da24d2670
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d1775cf14742b238334c2269c95446f0d7940a8ca33053cda9fe9bea6ed4a0f2dd3c4e8dee7090e2b469360af0391c01a4eb31bb9a1077df930410dc2e90161
|
7
|
+
data.tar.gz: '074178e6adf827eff91b13774ac77f45737d143ccc0679874ff9bafde373c606fdb052dea25cf7daa1d5ff8dfd05102be98c4398129a8db8c409752326ef5385'
|
data/.github/workflows/ruby.yml
CHANGED
@@ -66,3 +66,21 @@ jobs:
|
|
66
66
|
- name: Run test
|
67
67
|
run: |
|
68
68
|
bundle exec rake ${{ matrix.job }}
|
69
|
+
|
70
|
+
windows:
|
71
|
+
runs-on: ${{ matrix.os }}
|
72
|
+
strategy:
|
73
|
+
fail-fast: false
|
74
|
+
matrix:
|
75
|
+
os: [ windows-2019, windows-2022 ]
|
76
|
+
ruby: [ ucrt, mswin ]
|
77
|
+
steps:
|
78
|
+
- uses: actions/checkout@v3
|
79
|
+
- name: load ruby
|
80
|
+
uses: ruby/setup-ruby@v1
|
81
|
+
with:
|
82
|
+
ruby-version: ${{ matrix.ruby }}
|
83
|
+
- name: rake-compiler
|
84
|
+
run: gem install rake-compiler
|
85
|
+
- name: compile
|
86
|
+
run: rake compile
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 2.3.1 (2022-04-05)
|
6
|
+
|
7
|
+
### Library changes
|
8
|
+
|
9
|
+
* Fix mswin build, use `append_cflags`, add Windows 'compile only' CI ([\#964](https://github.com/ruby/rbs/pull/964))
|
10
|
+
* Raise `RBS::SyntaxError` from `parse_record_attributes` ([\#966](https://github.com/ruby/rbs/pull/966))
|
11
|
+
* Toplevel constant must have the lowest precedence ([\#967](https://github.com/ruby/rbs/pull/967))
|
12
|
+
|
13
|
+
#### rbs prototype
|
14
|
+
|
15
|
+
* Use default value also for `literal_to_type` ([\#962](https://github.com/ruby/rbs/pull/962))
|
16
|
+
|
5
17
|
## 2.3.0 (2022-04-01)
|
6
18
|
|
7
19
|
### Signature updates
|
data/Gemfile.lock
CHANGED
data/ext/rbs_extension/parser.c
CHANGED
@@ -684,7 +684,11 @@ VALUE parse_record_attributes(parserstate *state) {
|
|
684
684
|
key = rb_funcall(parse_type(state), rb_intern("literal"), 0);
|
685
685
|
break;
|
686
686
|
default:
|
687
|
-
|
687
|
+
raise_syntax_error(
|
688
|
+
state,
|
689
|
+
state->next_token,
|
690
|
+
"unexpected record key token"
|
691
|
+
);
|
688
692
|
}
|
689
693
|
parser_advance_assert(state, pFATARROW);
|
690
694
|
}
|
data/lib/rbs/prototype/rb.rb
CHANGED
@@ -106,10 +106,10 @@ module RBS
|
|
106
106
|
# @type var consts: Hash[Symbol, Constant]
|
107
107
|
consts = {}
|
108
108
|
|
109
|
-
if context
|
110
|
-
|
111
|
-
|
112
|
-
|
109
|
+
if last = context&.[](1)
|
110
|
+
constants_from_ancestors(last, constants: consts)
|
111
|
+
else
|
112
|
+
constants_from_ancestors(BuiltinNames::Object.name, constants: consts)
|
113
113
|
end
|
114
114
|
constants_from_context(context, constants: consts) or return
|
115
115
|
constants_itself(context, constants: consts)
|
@@ -122,7 +122,7 @@ module RBS
|
|
122
122
|
constants = {}
|
123
123
|
|
124
124
|
if table.children(name)
|
125
|
-
builder.ancestor_builder.instance_ancestors(name).ancestors.
|
125
|
+
builder.ancestor_builder.instance_ancestors(name).ancestors.reverse_each do |ancestor|
|
126
126
|
if ancestor.is_a?(Definition::Ancestor::Instance)
|
127
127
|
if ancestor.name == BuiltinNames::Object.name
|
128
128
|
if name != BuiltinNames::Object.name
|
@@ -152,19 +152,38 @@ module RBS
|
|
152
152
|
consts = table.children(last) or return false
|
153
153
|
constants.merge!(consts)
|
154
154
|
end
|
155
|
-
else
|
156
|
-
constants.merge!(table.toplevel)
|
157
155
|
end
|
158
156
|
|
159
157
|
true
|
160
158
|
end
|
161
159
|
|
162
160
|
def constants_from_ancestors(module_name, constants:)
|
163
|
-
builder.
|
161
|
+
if (entry = builder.env.class_decls[module_name]).is_a?(Environment::ModuleEntry)
|
162
|
+
self_types = entry.self_types
|
163
|
+
if self_types.empty?
|
164
|
+
self_types << AST::Declarations::Module::Self.new(
|
165
|
+
name: BuiltinNames::Object.name,
|
166
|
+
args: [],
|
167
|
+
location: nil
|
168
|
+
)
|
169
|
+
end
|
170
|
+
|
171
|
+
self_types.each do |self_type|
|
172
|
+
if self_type.name.class?
|
173
|
+
constants_from_ancestors(self_type.name, constants: constants)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
builder.ancestor_builder.instance_ancestors(module_name).ancestors.reverse_each do |ancestor|
|
164
179
|
if ancestor.is_a?(Definition::Ancestor::Instance)
|
165
180
|
case ancestor.source
|
166
181
|
when AST::Members::Include, :super, nil
|
167
182
|
consts = table.children(ancestor.name) or raise
|
183
|
+
if ancestor.name == BuiltinNames::Object.name
|
184
|
+
# Insert toplevel constants as ::Object's constants
|
185
|
+
consts.merge!(table.toplevel)
|
186
|
+
end
|
168
187
|
constants.merge!(consts)
|
169
188
|
end
|
170
189
|
end
|
data/lib/rbs/version.rb
CHANGED
data/steep/Gemfile.lock
CHANGED
@@ -16,22 +16,22 @@ GEM
|
|
16
16
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
17
17
|
rb-inotify (~> 0.9, >= 0.9.10)
|
18
18
|
minitest (5.15.0)
|
19
|
-
parallel (1.22.
|
19
|
+
parallel (1.22.1)
|
20
20
|
parser (3.1.1.0)
|
21
21
|
ast (~> 2.4.1)
|
22
22
|
rainbow (3.1.1)
|
23
23
|
rb-fsevent (0.11.1)
|
24
24
|
rb-inotify (0.10.1)
|
25
25
|
ffi (~> 1.0)
|
26
|
-
rbs (2.
|
27
|
-
steep (0.
|
26
|
+
rbs (2.3.0)
|
27
|
+
steep (0.51.0)
|
28
28
|
activesupport (>= 5.1)
|
29
29
|
language_server-protocol (>= 3.15, < 4.0)
|
30
30
|
listen (~> 3.0)
|
31
31
|
parallel (>= 1.0.0)
|
32
32
|
parser (>= 3.0)
|
33
33
|
rainbow (>= 2.2.2, < 4.0)
|
34
|
-
rbs (>= 2.
|
34
|
+
rbs (>= 2.3.0)
|
35
35
|
terminal-table (>= 2, < 4)
|
36
36
|
terminal-table (3.0.2)
|
37
37
|
unicode-display_width (>= 1.1.1, < 3)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: RBS is the language for type signatures for Ruby and standard library
|
14
14
|
definitions.
|