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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f16a35868e75e53f28b6c63c095c60190f14e3eecb9d30b87046d184646176dd
4
- data.tar.gz: 123998b67c9b926af173e64adeb0e9437ff784d13d960d50219274f472c36973
3
+ metadata.gz: 79b2c9781565a156da1f9a40c4e5facddac2112036a8a225fff739b647b3ff87
4
+ data.tar.gz: 6477d9d8ebd4eecbae21449c267a62d62835787570880fcc57cebe8da24d2670
5
5
  SHA512:
6
- metadata.gz: f9ba3b43d4dbf19239b4ece9443d5da88ff2ca62cf73bfa102464537ecad3a3893b2d6de97679e51d25c2abd5bc43cfb69d608227aa779b6352a9a9ae78c1cac
7
- data.tar.gz: cdec18fab9146ce955a5b10b74f9c068a8ebec8a229bf9019ec2772d99e47b57ece38342cb71a8b9b2740d99106151b6fa91e3a6c2c80685a386f58c63eb5757
6
+ metadata.gz: 6d1775cf14742b238334c2269c95446f0d7940a8ca33053cda9fe9bea6ed4a0f2dd3c4e8dee7090e2b469360af0391c01a4eb31bb9a1077df930410dc2e90161
7
+ data.tar.gz: '074178e6adf827eff91b13774ac77f45737d143ccc0679874ff9bafde373c606fdb052dea25cf7daa1d5ff8dfd05102be98c4398129a8db8c409752326ef5385'
@@ -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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rbs (2.3.0)
4
+ rbs (2.3.1)
5
5
 
6
6
  PATH
7
7
  remote: test/assets/test-gem
@@ -1,4 +1,4 @@
1
1
  require 'mkmf'
2
2
  $INCFLAGS << " -I$(top_srcdir)" if $extmk
3
- $CFLAGS += " -std=c99 -Wold-style-definition"
3
+ append_cflags ['-std=c99', '-Wold-style-definition']
4
4
  create_makefile 'rbs_extension'
@@ -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
- rbs_abort();
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
  }
@@ -398,6 +398,7 @@ module RBS
398
398
 
399
399
  one_ancestors = one_instance_ancestors(type_name)
400
400
 
401
+ # @type var ancestors: Array[::RBS::Definition::Ancestor::t]
401
402
  ancestors = []
402
403
 
403
404
  case entry
@@ -542,7 +542,7 @@ module RBS
542
542
  when :freeze, :tap, :itself, :dup, :clone, :taint, :untaint, :extend
543
543
  literal_to_type(receiver)
544
544
  else
545
- default
545
+ untyped
546
546
  end
547
547
  else
548
548
  untyped
@@ -106,10 +106,10 @@ module RBS
106
106
  # @type var consts: Hash[Symbol, Constant]
107
107
  consts = {}
108
108
 
109
- if context
110
- if last = context[1]
111
- constants_from_ancestors(last, constants: consts)
112
- end
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.each do |ancestor|
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.ancestor_builder.instance_ancestors(module_name).ancestors.each do |ancestor|
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
@@ -1,3 +1,3 @@
1
1
  module RBS
2
- VERSION = "2.3.0"
2
+ VERSION = "2.3.1"
3
3
  end
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.0)
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.2.2)
27
- steep (0.50.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.2.0)
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.0
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-01 00:00:00.000000000 Z
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.