rbs 3.0.0.dev.3 → 3.0.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: 3311021fa8dd522c500cc5c388590108f4fd0ebf6d6c5c37afc522f37b49d579
4
- data.tar.gz: 832f3b9d95b142a2bb95fe14f5e1bb7919dc441cab94b67458d48411d8dc325f
3
+ metadata.gz: d5446bd15d95ec438ddc215207b15eed171001efaadac1aaca7e42b5d74209bc
4
+ data.tar.gz: 7950d481cc59733b2405310daed5a84409840896a92ea85a0236b7408c29052b
5
5
  SHA512:
6
- metadata.gz: 362ea45210850eddd3fd5eff4b5ba5970a3d736a6c3ef2c86d85ec47d94174649e032e179fc81d486d45df6ae67c1ab9b90bbe1baecae1e4ecb307ea7cc9fc13
7
- data.tar.gz: 118e7afe25837dd3b4d0d0324c5162f35cf1fd973365b5c0b1a009a4b422a584a3db274d38118038ec86fff7f55cfa95703a2214f06d0b8d72f417d2126dfbaf
6
+ metadata.gz: 86f11a00d144618d3378a261903cbccdd763267eaa0e6fee2224c58841ea7baaac758696e03d33f49fe342bf8e83048fd9f1a804f7806c0a7a44ade6e1204cbd
7
+ data.tar.gz: 251d897f651f20614f0b2cb339f1045eda0d2c61bf9b76ad763bf02402d40094b55a02e9d1e40fb55fdc4143ed1a2f67d56f76a38dfbf10c06c22daa2d4ebf17
data/CHANGELOG.md CHANGED
@@ -2,6 +2,79 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 3.0.1 (2023-02-27)
6
+
7
+ ### Library changes
8
+
9
+ * Ignore `set` library on loading ([#1251](https://github.com/ruby/rbs/pull/1251))
10
+
11
+ ## 3.0.0 (2023-02-22)
12
+
13
+ Read [the release note](https://github.com/ruby/rbs/wiki/Release-Note-3.0) for the overview of the changes.
14
+
15
+ ### Signature updates
16
+
17
+ * 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))
18
+ * Ruby 3.2 stdlib updates ([#1240](https://github.com/ruby/rbs/pull/1240))
19
+ * Ruby 3.2 incompatibilities ([#1241](https://github.com/ruby/rbs/pull/1241))
20
+ * ripper ([#1193](https://github.com/ruby/rbs/pull/1193))
21
+ * `RubyVM::AbstractSyntaxTree` ([#1189](https://github.com/ruby/rbs/pull/1189))
22
+ * `Array#zip` ([#1232](https://github.com/ruby/rbs/pull/1232))
23
+ * `Enumerable#zip` ([#1232](https://github.com/ruby/rbs/pull/1232))
24
+ * `Module#attr_*` ([#1218](https://github.com/ruby/rbs/pull/1218), [#1229](https://github.com/ruby/rbs/pull/1229))
25
+ * `Regexp.new` ([#1237](https://github.com/ruby/rbs/pull/1237))
26
+ * `Regexp#=~` ([#1195](https://github.com/ruby/rbs/pull/1195))
27
+ * `Socket.new` ([#1185](https://github.com/ruby/rbs/pull/1185))
28
+ * `Object::name` ([#1204](https://github.com/ruby/rbs/pull/1204))
29
+ * `_ToProc#to_proc` ([#1223](https://github.com/ruby/rbs/pull/1223))
30
+ * Add `implicitly-returns-nil` annotations ([#1226](https://github.com/ruby/rbs/pull/1226))
31
+
32
+ ### Language updates
33
+
34
+ #### Class/module alias declaration
35
+
36
+ * Spec: https://hackmd.io/SAE7AGD6SMSJFnYiR2M5-Q?view
37
+ * Pull requests: [#1219](https://github.com/ruby/rbs/pull/1219), [#1220](https://github.com/ruby/rbs/pull/1220)
38
+
39
+ #### `use` directives
40
+
41
+ * Spec: https://hackmd.io/pQehT1u1RfSj6lBcdgW8hg
42
+ * 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)
43
+
44
+ #### Per-overload annotations
45
+
46
+ * Pull requests: [#1174](https://github.com/ruby/rbs/pull/1174)
47
+
48
+ ### Library changes
49
+
50
+ * `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))
51
+ * Add "Expected one argument." to `rbs ancestors` command ([#1245](https://github.com/ruby/rbs/pull/1245))
52
+ * Implement `#detailed_message` for `ParsingError` ([#1166](https://github.com/ruby/rbs/pull/1166))
53
+ * Support interface in class/module for `Sorter` ([#1191](https://github.com/ruby/rbs/pull/1191))
54
+ * Use `-std=gnu99` instead of `-std=c99` ([#973](https://github.com/ruby/rbs/pull/973))
55
+ * Add `rbs_` prefix to `skip` function ([#1186](https://github.com/ruby/rbs/pull/1186))
56
+ * Better method definition resolution for overload/mixin combination ([#1199](https://github.com/ruby/rbs/pull/1199))
57
+ * Escaping for keywords is no longer necessary ([#1178](https://github.com/ruby/rbs/pull/1178))
58
+ * Fix super-class location ([#1172](https://github.com/ruby/rbs/pull/1172))
59
+
60
+ #### rbs prototype
61
+
62
+ * Introduce new heuristics for block types ([#1180](https://github.com/ruby/rbs/pull/1180))
63
+
64
+ #### rbs collection
65
+
66
+ * Install only *library* dependencies ([#1222](https://github.com/ruby/rbs/pull/1222), [#1228](https://github.com/ruby/rbs/pull/1228))
67
+ * Add *local source* ([#854](https://github.com/ruby/rbs/pull/854))
68
+ * Refactor collection ([#1149](https://github.com/ruby/rbs/pull/1149))
69
+ * Let `#resolved_revision` return the last fetched commit ([#1215](https://github.com/ruby/rbs/pull/1215))
70
+
71
+ ### Miscellaneous
72
+
73
+ * Update `syntax.md` ([#1243](https://github.com/ruby/rbs/pull/1243))
74
+ * Add link to `RBS by Example` to `README.md` [#1225](https://github.com/ruby/rbs/pull/1225)
75
+ * 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))
76
+ * Remove `steep/*` files from `.gem` ([#1214](https://github.com/ruby/rbs/pull/1214), [#1216](https://github.com/ruby/rbs/pull/1216))
77
+
5
78
  ## 2.8.4 (2023-01-20)
6
79
 
7
80
  ### 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.1)
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
@@ -139,12 +139,11 @@ module RBS
139
139
  private def assign_stdlib(name:, from_gem:)
140
140
  return if lockfile.gems.key?(name)
141
141
 
142
- if name == 'rubygems'
143
- if from_gem
144
- RBS.logger.warn "`rubygems` has been moved to core library, so it is always loaded. Remove explicit loading `rubygems` from `#{from_gem}`"
145
- else
146
- RBS.logger.warn '`rubygems` has been moved to core library, so it is always loaded. Remove explicit loading `rubygems`'
147
- end
142
+ case name
143
+ when 'rubygems', 'set'
144
+ msg = "`#{name}` has been moved to core library, so it is always loaded. Remove explicit loading `#{name}`"
145
+ msg << " from `#{from_gem}`" if from_gem
146
+ RBS.logger.warn msg
148
147
 
149
148
  return
150
149
  end
@@ -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.1"
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
data/sig/manifest.yaml CHANGED
@@ -1,6 +1,5 @@
1
1
  dependencies:
2
2
  - name: logger
3
- - name: set
4
3
  - name: pathname
5
4
  - name: json
6
5
  - name: optparse
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.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: 2023-02-17 00:00:00.000000000 Z
11
+ date: 2023-02-27 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,11 +444,11 @@ 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
- rubygems_version: 3.4.6
451
+ rubygems_version: 3.3.7
452
452
  signing_key:
453
453
  specification_version: 4
454
454
  summary: Type signature for Ruby.