rbs 3.0.0.dev.3 → 3.0.0

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: 3311021fa8dd522c500cc5c388590108f4fd0ebf6d6c5c37afc522f37b49d579
4
- data.tar.gz: 832f3b9d95b142a2bb95fe14f5e1bb7919dc441cab94b67458d48411d8dc325f
3
+ metadata.gz: c9546b97619812576e413b751c26e75ad667f97c0540f4b912b4030d851e013f
4
+ data.tar.gz: aff1d7c49fcc8012c6c78567af73ab9373d4ffe19756a8c17abe27c2ae674a3f
5
5
  SHA512:
6
- metadata.gz: 362ea45210850eddd3fd5eff4b5ba5970a3d736a6c3ef2c86d85ec47d94174649e032e179fc81d486d45df6ae67c1ab9b90bbe1baecae1e4ecb307ea7cc9fc13
7
- data.tar.gz: 118e7afe25837dd3b4d0d0324c5162f35cf1fd973365b5c0b1a009a4b422a584a3db274d38118038ec86fff7f55cfa95703a2214f06d0b8d72f417d2126dfbaf
6
+ metadata.gz: e35d66d2260a2dd3264174015a51eaab3a735367755d118d7f4140228369c540ed8c0c9d5f196348593a9983b27ae137b27d8d4cce25b355e31ce393d7e75aee
7
+ data.tar.gz: 2a416a42c26427a9415418124f5196215239fe4a5e37092ede2ed61faf8ff74cf208032a592d6fb65d909b9657820c734d85882ee597de7b316d7aa19f609a40
data/CHANGELOG.md CHANGED
@@ -2,6 +2,73 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 3.0.0 (2023-02-22)
6
+
7
+ Read [the release note](https://github.com/ruby/rbs/wiki/Release-Note-3.0) for the overview of the changes.
8
+
9
+ ### Signature updates
10
+
11
+ * Ruby 3.2 core updates ([#1238](https://github.com/ruby/rbs/pull/1238), [#1246](https://github.com/ruby/rbs/pull/1246), [#1242](https://github.com/ruby/rbs/pull/1242))
12
+ * Ruby 3.2 stdlib updates ([#1240](https://github.com/ruby/rbs/pull/1240))
13
+ * Ruby 3.2 incompatibilities ([#1241](https://github.com/ruby/rbs/pull/1241))
14
+ * ripper ([#1193](https://github.com/ruby/rbs/pull/1193))
15
+ * `RubyVM::AbstractSyntaxTree` ([#1189](https://github.com/ruby/rbs/pull/1189))
16
+ * `Array#zip` ([#1232](https://github.com/ruby/rbs/pull/1232))
17
+ * `Enumerable#zip` ([#1232](https://github.com/ruby/rbs/pull/1232))
18
+ * `Module#attr_*` ([#1218](https://github.com/ruby/rbs/pull/1218), [#1229](https://github.com/ruby/rbs/pull/1229))
19
+ * `Regexp.new` ([#1237](https://github.com/ruby/rbs/pull/1237))
20
+ * `Regexp#=~` ([#1195](https://github.com/ruby/rbs/pull/1195))
21
+ * `Socket.new` ([#1185](https://github.com/ruby/rbs/pull/1185))
22
+ * `Object::name` ([#1204](https://github.com/ruby/rbs/pull/1204))
23
+ * `_ToProc#to_proc` ([#1223](https://github.com/ruby/rbs/pull/1223))
24
+ * Add `implicitly-returns-nil` annotations ([#1226](https://github.com/ruby/rbs/pull/1226))
25
+
26
+ ### Language updates
27
+
28
+ #### Class/module alias declaration
29
+
30
+ * Spec: https://hackmd.io/SAE7AGD6SMSJFnYiR2M5-Q?view
31
+ * Pull requests: [#1219](https://github.com/ruby/rbs/pull/1219), [#1220](https://github.com/ruby/rbs/pull/1220)
32
+
33
+ #### `use` directives
34
+
35
+ * Spec: https://hackmd.io/pQehT1u1RfSj6lBcdgW8hg
36
+ * Pull requests: [#1224](https://github.com/ruby/rbs/pull/1224), [#1234](https://github.com/ruby/rbs/pull/1234), [#1235](https://github.com/ruby/rbs/pull/1235)
37
+
38
+ #### Per-overload annotations
39
+
40
+ * Pull requests: [#1174](https://github.com/ruby/rbs/pull/1174)
41
+
42
+ ### Library changes
43
+
44
+ * `Environment` cleanup ([#1209](https://github.com/ruby/rbs/pull/1209), [#1236](https://github.com/ruby/rbs/pull/1236), [#1247](https://github.com/ruby/rbs/pull/1247))
45
+ * Add "Expected one argument." to `rbs ancestors` command ([#1245](https://github.com/ruby/rbs/pull/1245))
46
+ * Implement `#detailed_message` for `ParsingError` ([#1166](https://github.com/ruby/rbs/pull/1166))
47
+ * Support interface in class/module for `Sorter` ([#1191](https://github.com/ruby/rbs/pull/1191))
48
+ * Use `-std=gnu99` instead of `-std=c99` ([#973](https://github.com/ruby/rbs/pull/973))
49
+ * Add `rbs_` prefix to `skip` function ([#1186](https://github.com/ruby/rbs/pull/1186))
50
+ * Better method definition resolution for overload/mixin combination ([#1199](https://github.com/ruby/rbs/pull/1199))
51
+ * Escaping for keywords is no longer necessary ([#1178](https://github.com/ruby/rbs/pull/1178))
52
+ * Fix super-class location ([#1172](https://github.com/ruby/rbs/pull/1172))
53
+
54
+ #### rbs prototype
55
+
56
+ * Introduce new heuristics for block types ([#1180](https://github.com/ruby/rbs/pull/1180))
57
+
58
+ #### rbs collection
59
+
60
+ * Install only *library* dependencies ([#1222](https://github.com/ruby/rbs/pull/1222), [#1228](https://github.com/ruby/rbs/pull/1228))
61
+ * Add *local source* ([#854](https://github.com/ruby/rbs/pull/854))
62
+ * Refactor collection ([#1149](https://github.com/ruby/rbs/pull/1149))
63
+ * Let `#resolved_revision` return the last fetched commit ([#1215](https://github.com/ruby/rbs/pull/1215))
64
+
65
+ ### Miscellaneous
66
+
67
+ * Update `syntax.md` ([#1243](https://github.com/ruby/rbs/pull/1243))
68
+ * Add link to `RBS by Example` to `README.md` [#1225](https://github.com/ruby/rbs/pull/1225)
69
+ * Make `rake stdlib_test` run with single process ([#1207](https://github.com/ruby/rbs/pull/1207), [#1211](https://github.com/ruby/rbs/pull/1211), [#1231](https://github.com/ruby/rbs/pull/1231))
70
+ * Remove `steep/*` files from `.gem` ([#1214](https://github.com/ruby/rbs/pull/1214), [#1216](https://github.com/ruby/rbs/pull/1216))
71
+
5
72
  ## 2.8.4 (2023-01-20)
6
73
 
7
74
  ### Miscellaneous
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rbs (3.0.0.dev.3)
4
+ rbs (3.0.0)
5
5
 
6
6
  PATH
7
7
  remote: test/assets/test-gem
data/Steepfile CHANGED
@@ -9,11 +9,12 @@ target :lib do
9
9
  "lib/rbs/test.rb"
10
10
  )
11
11
 
12
- library "set", "pathname", "json", "logger", "monitor", "tsort", "uri", 'dbm', 'pstore', 'singleton', 'shellwords', 'fileutils', 'find', 'digest', 'ripper'
12
+ library "set", "pathname", "json", "logger", "monitor", "tsort", "uri", 'dbm', 'pstore', 'singleton', 'shellwords', 'fileutils', 'find', 'digest'
13
13
  signature 'stdlib/yaml/0'
14
14
  signature "stdlib/strscan/0/"
15
15
  signature "stdlib/optparse/0/"
16
16
  signature "stdlib/rdoc/0/"
17
+ signature "stdlib/ripper/0"
17
18
 
18
19
  configure_code_diagnostics do |config|
19
20
  config[D::Ruby::MethodDefinitionMissing] = :hint
@@ -30,7 +30,7 @@ class Enumerator[unchecked out Elem, out Return]
30
30
  #
31
31
  # This type of objects can be created by Enumerator.product.
32
32
  #
33
- class Product[unchecked out Elem] < Enumerator[Elem, Product[Elem]]
33
+ class Product[unchecked out Elem] < Enumerator[Array[Elem], Product[Elem]]
34
34
  # <!--
35
35
  # rdoc-file=enumerator.c
36
36
  # - Enumerator::Product.new(*enums) -> enum
@@ -44,8 +44,6 @@ class Enumerator[unchecked out Elem, out Return]
44
44
  #
45
45
  def initialize: (*_EachEntry[Elem]) -> void
46
46
 
47
- include Enumerable[Elem]
48
-
49
47
  public
50
48
 
51
49
  # <!--
data/lib/rbs/cli.rb CHANGED
@@ -260,6 +260,11 @@ EOU
260
260
  opts.on("--singleton", "Ancestors of singleton of the given type_name") { kind = :singleton }
261
261
  end.order!(args)
262
262
 
263
+ unless args.size == 1
264
+ stdout.puts "Expected one argument."
265
+ return
266
+ end
267
+
263
268
  loader = options.loader()
264
269
 
265
270
  env = Environment.from_loader(loader).resolve_type_names
@@ -10,7 +10,8 @@ module RBS
10
10
  attr_reader :constant_decls
11
11
  attr_reader :global_decls
12
12
  attr_reader :class_alias_decls
13
- attr_reader :buffer_directives
13
+
14
+ attr_reader :signatures
14
15
 
15
16
  module ContextUtil
16
17
  def calculate_context(decls)
@@ -142,7 +143,7 @@ module RBS
142
143
  end
143
144
 
144
145
  def initialize
145
- @buffers = []
146
+ @signatures = {}
146
147
  @declarations = []
147
148
 
148
149
  @class_decls = {}
@@ -152,11 +153,10 @@ module RBS
152
153
  @global_decls = {}
153
154
  @class_alias_decls = {}
154
155
  @normalize_module_name_cache = {}
155
- @buffer_directives = {}
156
156
  end
157
157
 
158
158
  def initialize_copy(other)
159
- @buffers = other.buffers.dup
159
+ @signatures = other.signatures.dup
160
160
  @declarations = other.declarations.dup
161
161
 
162
162
  @class_decls = other.class_decls.dup
@@ -165,7 +165,6 @@ module RBS
165
165
  @constant_decls = other.constant_decls.dup
166
166
  @global_decls = other.global_decls.dup
167
167
  @class_alias_decls = other.class_alias_decls.dup
168
- @buffer_directives = other.buffer_directives.dup
169
168
  end
170
169
 
171
170
  def self.from_loader(loader)
@@ -429,7 +428,7 @@ module RBS
429
428
  end
430
429
 
431
430
  def add_signature(buffer:, directives:, decls:)
432
- buffer_directives[buffer] = directives
431
+ signatures[buffer] = [directives, decls]
433
432
  decls.each do |decl|
434
433
  self << decl
435
434
  end
@@ -452,9 +451,7 @@ module RBS
452
451
  table.known_types.merge(interface_decls.keys)
453
452
  table.compute_children
454
453
 
455
- buffers_decls.each do |buffer, decls|
456
- dirs = buffer_directives.fetch(buffer)
457
-
454
+ signatures.each do |buffer, (dirs, decls)|
458
455
  map = UseMap.new(table: table)
459
456
  dirs.each do |dir|
460
457
  dir.clauses.each do |clause|
@@ -758,28 +755,14 @@ module RBS
758
755
  end
759
756
 
760
757
  def buffers
761
- buffers_decls.keys.compact
762
- end
763
-
764
- def buffers_decls
765
- # @type var hash: Hash[Buffer, Array[AST::Declarations::t]]
766
- hash = {}
767
-
768
- declarations.each do |decl|
769
- location = decl.location or next
770
- (hash[location.buffer] ||= []) << decl
771
- end
772
-
773
- hash
758
+ signatures.keys
774
759
  end
775
760
 
776
761
  def unload(buffers)
777
762
  env = Environment.new
778
763
 
779
- buffers_decls.each do |buf, decls|
764
+ signatures.each do |buf, (dirs, decls)|
780
765
  next if buffers.include?(buf)
781
-
782
- dirs = buffer_directives.fetch(buf)
783
766
  env.add_signature(buffer: buf, directives: dirs, decls: decls)
784
767
  end
785
768
 
data/lib/rbs/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RBS
4
- VERSION = "3.0.0.dev.3"
4
+ VERSION = "3.0.0"
5
5
  end
data/sig/environment.rbs CHANGED
@@ -111,7 +111,9 @@ module RBS
111
111
  # Global declarations
112
112
  attr_reader global_decls: Hash[Symbol, GlobalEntry]
113
113
 
114
- attr_reader buffer_directives: Hash[Buffer, Array[AST::Directives::t]]
114
+ # A hash from Buffer to it's contents
115
+ #
116
+ attr_reader signatures: Hash[Buffer, [Array[AST::Directives::t], Array[AST::Declarations::t]]]
115
117
 
116
118
  def initialize: () -> void
117
119
 
@@ -141,12 +143,8 @@ module RBS
141
143
 
142
144
  def inspect: () -> String
143
145
 
144
- @buffers: Array[Buffer]
145
-
146
146
  def buffers: () -> Array[Buffer]
147
147
 
148
- def buffers_decls: () -> Hash[Buffer, Array[AST::Declarations::t]]
149
-
150
148
  # Remove declarations and directives that are loaded from `buffers`
151
149
  #
152
150
  def unload: (Set[Buffer] buffers) -> Environment
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: 3.0.0.dev.3
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-17 00:00:00.000000000 Z
11
+ date: 2023-02-22 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.
@@ -444,9 +444,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
444
444
  version: '2.6'
445
445
  required_rubygems_version: !ruby/object:Gem::Requirement
446
446
  requirements:
447
- - - ">"
447
+ - - ">="
448
448
  - !ruby/object:Gem::Version
449
- version: 1.3.1
449
+ version: '0'
450
450
  requirements: []
451
451
  rubygems_version: 3.4.6
452
452
  signing_key: