rbs 3.5.0.pre.2 → 3.5.1.pre.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: 7f44e3b32818bb9240af1bb6bd91f58734e5208c0742b1f64d1d71e1ed7a127e
4
- data.tar.gz: c15589b32e1bb581de63f7351262a3f481c66300b55cb5ee077012377ec209ed
3
+ metadata.gz: 15842c05830277f680d570af8724cfe962c63c1188e125b899904d43633a013c
4
+ data.tar.gz: 4676d5718267865fb19c432a15769c1b8a0f1ca41efc28da0be3fec59abc8fc7
5
5
  SHA512:
6
- metadata.gz: b61721ff795900726316403d7dc03bd6458eca0f5bcacacb8760f0b1c637fcd75f5b72dd6ddf0adfee610e7dded1f89e2a762dc4883210b335e54350c6a0554f
7
- data.tar.gz: 85a2b874ee557c4c9a20441b1ea3413b215432c23834240b99f9444dee281c4f9d459047f59a833e6409ef170bc913acbdd142919e42a351118519db1c2653c0
6
+ metadata.gz: 2d23e68eb43cdc67695fb289a052c0580be90859211fca4580497dea2ad9a88ad76730a74c054d54ccfd0805a3b49032db611af1c66739f36b6ea2b1a82e7bc0
7
+ data.tar.gz: a0f1246404e79a4b7e49f56d460edc57271846249ee5fc0548525727e4850f2c0cdd733e06a5034ddff4af3f1ea0e226880efe68f4000f19406073365f87a8fc
@@ -1,13 +1,21 @@
1
1
  version: 2
2
2
  updates:
3
- - package-ecosystem: "bundler"
3
+ - package-ecosystem: bundler
4
4
  directory: "/"
5
5
  schedule:
6
- interval: "daily"
7
- - package-ecosystem: "bundler"
6
+ interval: daily
7
+ open-pull-requests-limit: 3
8
+ allow:
9
+ - dependency-type: all
10
+
11
+ - package-ecosystem: bundler
8
12
  directory: "/steep"
9
13
  schedule:
10
- interval: "daily"
14
+ interval: daily
15
+ open-pull-requests-limit: 3
16
+ allow:
17
+ - dependency-type: all
18
+
11
19
  - package-ecosystem: 'github-actions'
12
20
  directory: '/'
13
21
  schedule:
@@ -0,0 +1,26 @@
1
+ name: Merge dependabot PRs automatically
2
+ on: pull_request_target
3
+
4
+ permissions:
5
+ pull-requests: write
6
+ contents: write
7
+
8
+ env:
9
+ blocker_files: rbs.gemspec Gemfile steep/Gemfile
10
+
11
+ jobs:
12
+ dependabot:
13
+ runs-on: ubuntu-latest
14
+ if: ${{ github.actor == 'dependabot[bot]' }}
15
+ steps:
16
+ - name: Checkout repository
17
+ uses: actions/checkout@v4
18
+ with:
19
+ fetch-depth: 0
20
+ - name: Abort if blocker files are changed
21
+ run: git diff --exit-code ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} ${{ env.blocker_files }}
22
+ - name: Enable auto-merge for Dependabot PRs
23
+ run: gh pr merge --auto --merge "$PR_URL"
24
+ env:
25
+ PR_URL: ${{github.event.pull_request.html_url}}
26
+ GH_TOKEN: ${{secrets.DEPENDABOT_MERGE_GH_TOKEN}}
@@ -31,7 +31,9 @@ jobs:
31
31
  - ruby: "3.3"
32
32
  job: lexer compile confirm_lexer
33
33
  - ruby: "3.3"
34
- job: rubocop validate test_doc build test_generate_stdlib
34
+ job: rubocop validate test_doc build test_generate_stdlib raap
35
+ - ruby: "3.3"
36
+ job: typecheck_test
35
37
  steps:
36
38
  - uses: actions/checkout@v4
37
39
  - uses: ruby/setup-ruby@v1
@@ -64,6 +66,10 @@ jobs:
64
66
  echo "NO_MINITEST=true" >> $GITHUB_ENV
65
67
  bundle config set --local without 'minitest'
66
68
  if: ${{ contains(matrix.ruby, 'head') }}
69
+ - name: Skip installing type checkers
70
+ if: ${{ ! contains(matrix.job, 'typecheck_test') }}
71
+ run: |
72
+ bundle config set without 'typecheck_test'
67
73
  - name: bin/setup
68
74
  run: |
69
75
  bin/setup
data/CHANGELOG.md CHANGED
@@ -1,6 +1,107 @@
1
1
  # CHANGELOG
2
2
 
3
- ## master
3
+ ## 3.5.0 (2024-06-06)
4
+
5
+ ### Signature updates
6
+
7
+ * `net-http` headers ([#1750](https://github.com/ruby/rbs/pull/1750))
8
+ * `CSV.foreach` ([#1738](https://github.com/ruby/rbs/pull/1738))
9
+ * `Enumerator#initialize` ([#1801](https://github.com/ruby/rbs/pull/1801))
10
+ * `Float#divmod`, `Rational#divmod` ([#1868](https://github.com/ruby/rbs/pull/1868))
11
+ * `GC` ([#1530](https://github.com/ruby/rbs/pull/1530))
12
+ * `Integer#pow` ([#1706](https://github.com/ruby/rbs/pull/1706))
13
+ * `Kernel.rand` ([#1783](https://github.com/ruby/rbs/pull/1783))
14
+ * `Kernel#extend` ([#1769](https://github.com/ruby/rbs/pull/1769))
15
+ * `Module#include`, `Module#prepend` ([#1769](https://github.com/ruby/rbs/pull/1769))
16
+ * `Proc#parameters` ([#1819](https://github.com/ruby/rbs/pull/1819))
17
+ * `Range#step` ([#1709](https://github.com/ruby/rbs/pull/1709))
18
+ * `Regexp.union` ([#1809](https://github.com/ruby/rbs/pull/1809))
19
+ * `RubyVM::YJIT.enable` ([#1812](https://github.com/ruby/rbs/pull/1812))
20
+ * `RubyVM::YJIT`, `RubyVM::RJIT` ([#1746](https://github.com/ruby/rbs/pull/1746))
21
+ * `String#bytesplice` ([#1793](https://github.com/ruby/rbs/pull/1793))
22
+ * `String#gsub!` ([#1768](https://github.com/ruby/rbs/pull/1768))
23
+ * `Symbol#=~` ([#1704](https://github.com/ruby/rbs/pull/1704))
24
+ * `Time#initialize` ([#1771](https://github.com/ruby/rbs/pull/1771))
25
+ * `Time#zone` ([#1770](https://github.com/ruby/rbs/pull/1770))
26
+ * `Timeout::ExitException` ([#1803](https://github.com/ruby/rbs/pull/1803))
27
+ * `URI::MailTo` ([#1858](https://github.com/ruby/rbs/pull/1858))
28
+ * Update docs ([#1811](https://github.com/ruby/rbs/pull/1811), [#1699](https://github.com/ruby/rbs/pull/1699))
29
+
30
+ ### Language updates
31
+
32
+ * Fix proc type syntax ([#1807](https://github.com/ruby/rbs/pull/1807))
33
+ * Function types with untyped parameter ([#1806](https://github.com/ruby/rbs/pull/1806))
34
+ * Fix record type ([#1732](https://github.com/ruby/rbs/pull/1732))
35
+ * parser: enable record types with optional fields ([#1717](https://github.com/ruby/rbs/pull/1717))
36
+
37
+ ### Library changes
38
+
39
+ * Drop dependency on `abbrev` ([#1866](https://github.com/ruby/rbs/pull/1866))
40
+ * Fix source display ([#1832](https://github.com/ruby/rbs/pull/1832))
41
+ * Include trivia tokens to lex result ([#1831](https://github.com/ruby/rbs/pull/1831))
42
+ * Implement token list API ([#1829](https://github.com/ruby/rbs/pull/1829))
43
+ * Fix memory leak when ParsingError ([#1830](https://github.com/ruby/rbs/pull/1830))
44
+ * [rbs diff] Fix error when empty manifest.yaml ([#1762](https://github.com/ruby/rbs/pull/1762))
45
+ * Remove deprecated API since RBS v1 ([#1805](https://github.com/ruby/rbs/pull/1805))
46
+ * Use array instead of linked list for rbs location's child ([#1786](https://github.com/ruby/rbs/pull/1786))
47
+ * Fix SEGV with parse negative position ([#1790](https://github.com/ruby/rbs/pull/1790))
48
+ * Add location for attribute ([#1787](https://github.com/ruby/rbs/pull/1787))
49
+ * Always be private ([#1774](https://github.com/ruby/rbs/pull/1774))
50
+ * Prevent resource leak with type/method-type parser when reaching EOF. ([#1742](https://github.com/ruby/rbs/pull/1742))
51
+ * Allow loading RBS from different version of a gem ([#1731](https://github.com/ruby/rbs/pull/1731))
52
+ * Fix method name tag on assertion ([#1705](https://github.com/ruby/rbs/pull/1705))
53
+ * Improve interface check by method parameters ([#1698](https://github.com/ruby/rbs/pull/1698))
54
+
55
+ #### rbs prototype
56
+
57
+ * Fix prototype for ruby-3.4 ([#1760](https://github.com/ruby/rbs/pull/1760))
58
+ * Fix 3.4 `prototype rb` failure ([#1713](https://github.com/ruby/rbs/pull/1713))
59
+ * Add Numeric Node's check for parse rbs ([#1711](https://github.com/ruby/rbs/pull/1711))
60
+
61
+ #### rbs collection
62
+
63
+ * Fix RBS loading precedence ([#1720](https://github.com/ruby/rbs/pull/1720))
64
+ * Refactor Git source by using `git?` method ([#1701](https://github.com/ruby/rbs/pull/1701))
65
+
66
+ ### Miscellaneous
67
+
68
+ * Introduce RaaP for testing of signature ([#1810](https://github.com/ruby/rbs/pull/1810))
69
+ * Revise .gemspec to remove `Gemfile` and `Gemfile.lock` ([#1856](https://github.com/ruby/rbs/pull/1856))
70
+ * Add link to gem_rbs_collection to README ([#1827](https://github.com/ruby/rbs/pull/1827))
71
+ * Remove `Gemfile.lock` from the gem package ([#1823](https://github.com/ruby/rbs/pull/1823))
72
+ * Modify template to use TestHelper ([#1776](https://github.com/ruby/rbs/pull/1776))
73
+ * Should focus on `String.new` not `String#initialize`. ([#1789](https://github.com/ruby/rbs/pull/1789))
74
+ * Make the test suite compatible with `--enable-frozen-string-literal` ([#1767](https://github.com/ruby/rbs/pull/1767))
75
+ * Stop reusing `fd` ([#1752](https://github.com/ruby/rbs/pull/1752))
76
+ * Fix test failures on Ruby 3.4 ([#1734](https://github.com/ruby/rbs/pull/1734))
77
+ * Stop trace object allocations during test ([#1724](https://github.com/ruby/rbs/pull/1724))
78
+ * Fix head test fails ([#1719](https://github.com/ruby/rbs/pull/1719))
79
+
80
+ ## 3.4.4 (2024-02-08)
81
+
82
+ ### Miscellaneous
83
+
84
+ * Backport [#1752](https://github.com/ruby/rbs/pull/1752) ([#1753](https://github.com/ruby/rbs/pull/1753))
85
+
86
+ ## 3.4.3 (2024-01-25)
87
+
88
+ ### Library changes
89
+
90
+ #### rbs collection
91
+
92
+ * Backport [#1731](https://github.com/ruby/rbs/pull/1731) ([#1735](https://github.com/ruby/rbs/pull/1735))
93
+
94
+ ## 3.4.2 (2024-01-19)
95
+
96
+ ### Miscellaneous
97
+
98
+ * Backport [#1724](https://github.com/ruby/rbs/pull/1724) ([#1726](https://github.com/ruby/rbs/pull/1726))
99
+
100
+ ## 3.4.1 (2023-12-26)
101
+
102
+ ### Signature updates
103
+
104
+ * Update embedded RDoc based on ruby-3.3.0 (Backport #1699) ([#1700](https://github.com/ruby/rbs/pull/1700))
4
105
 
5
106
  ## 3.4.0 (2023-12-21)
6
107
 
data/README.md CHANGED
@@ -69,7 +69,7 @@ gem "rbs"
69
69
 
70
70
  The gem ships with the `rbs` command line tool to demonstrate what it can do and help develop RBS.
71
71
 
72
- ```bash
72
+ ```console
73
73
  $ rbs version
74
74
  $ rbs list
75
75
  $ rbs ancestors ::Object
@@ -98,7 +98,7 @@ end
98
98
 
99
99
  Running prototype on the above will automatically generate
100
100
 
101
- ```
101
+ ```console
102
102
  $ rbs prototype rb person.rb
103
103
  class Person
104
104
  @name: untyped
@@ -190,6 +190,7 @@ Here is a list of some places you can talk with active maintainers.
190
190
 
191
191
  - [Ruby Discord Server (invite link)](https://discord.gg/ad2acQFtkh) -- We have `rbs` channel in Ruby Discord server.
192
192
  - [ruby-jp Slack Workspace (in Japanese)](https://ruby-jp.github.io/) -- We have `types` channel in ruby-jp slack workspace.
193
+ - [gem_rbs_collection](https://github.com/ruby/gem_rbs_collection) -- We have a repository of third-party RBS type definitions, for the case your dependency doesn't ship with RBS files.
193
194
 
194
195
  ## Development
195
196
 
data/Rakefile CHANGED
@@ -19,7 +19,7 @@ Rake::TestTask.new(:test => :compile) do |t|
19
19
  end
20
20
  end
21
21
 
22
- multitask :default => [:test, :stdlib_test, :rubocop, :validate, :test_doc]
22
+ multitask :default => [:test, :stdlib_test, :typecheck_test, :rubocop, :validate, :test_doc]
23
23
 
24
24
  task :lexer do
25
25
  sh "re2c -W --no-generation-date -o ext/rbs_extension/lexer.c ext/rbs_extension/lexer.re"
@@ -92,6 +92,23 @@ task :stdlib_test => :compile do
92
92
  sh "#{ruby} -Ilib #{bin}/test_runner.rb test/stdlib/Encoding_test.rb"
93
93
  end
94
94
 
95
+ task :typecheck_test => :compile do
96
+ FileList["test/typecheck/*"].each do |test|
97
+ Dir.chdir(test) do
98
+ expectations = File.join(test, "steep_expectations.yml")
99
+ if File.exist?(expectations)
100
+ sh "steep check --with_expectations"
101
+ else
102
+ sh "steep check"
103
+ end
104
+ end
105
+ end
106
+ end
107
+
108
+ task :raap => :compile do
109
+ sh %q[cat test/raap.txt | egrep -v '^#|^$' | xargs bundle exec raap]
110
+ end
111
+
95
112
  task :rubocop do
96
113
  sh "rubocop --parallel"
97
114
  end
data/Steepfile CHANGED
@@ -8,7 +8,7 @@ target :lib do
8
8
  # "lib/rbs/test.rb"
9
9
  )
10
10
 
11
- library "pathname", "json", "logger", "monitor", "tsort", "uri", 'dbm', 'pstore', 'singleton', 'shellwords', 'fileutils', 'find', 'digest', 'abbrev', 'prettyprint', 'yaml', "psych", "securerandom"
11
+ library "pathname", "json", "logger", "monitor", "tsort", "uri", 'dbm', 'pstore', 'singleton', 'shellwords', 'fileutils', 'find', 'digest', 'prettyprint', 'yaml', "psych", "securerandom"
12
12
  signature "stdlib/strscan/0/"
13
13
  signature "stdlib/optparse/0/"
14
14
  signature "stdlib/rdoc/0/"
data/core/float.rbs CHANGED
@@ -442,7 +442,8 @@ class Float < Numeric
442
442
  # 13.0.divmod(4.0) # => [3, 1.0]
443
443
  # 13.0.divmod(Rational(4, 1)) # => [3, 1.0]
444
444
  #
445
- def divmod: (Numeric) -> [ Numeric, Numeric ]
445
+ def divmod: (Integer | Float | Rational) -> [ Integer, Float ]
446
+ | (Numeric) -> [ Numeric, Numeric ]
446
447
 
447
448
  def dup: () -> self
448
449
 
data/core/integer.rbs CHANGED
@@ -766,7 +766,8 @@ class Integer < Numeric
766
766
  # 13.divmod(Rational(4, 1)) # => [3, (1/1)]
767
767
  #
768
768
  def divmod: (Integer) -> [ Integer, Integer ]
769
- | (Float) -> [ Float, Float ]
769
+ | (Float) -> [ Integer, Float ]
770
+ | (Rational) -> [ Integer, Rational ]
770
771
  | (Numeric) -> [ Numeric, Numeric ]
771
772
 
772
773
  # <!--
data/core/proc.rbs CHANGED
@@ -602,7 +602,7 @@ class Proc < Object
602
602
  # prc = lambda{|x, y=42, *other|}
603
603
  # prc.parameters(lambda: false) #=> [[:opt, :x], [:opt, :y], [:rest, :other]]
604
604
  #
605
- def parameters: (lambda: boolish) -> ::Array[[ Symbol, Symbol ]]
605
+ def parameters: (?lambda: boolish) -> ::Array[[ Symbol, Symbol ]]
606
606
 
607
607
  # <!--
608
608
  # rdoc-file=proc.c
data/core/rational.rbs CHANGED
@@ -245,7 +245,8 @@ class Rational < Numeric
245
245
 
246
246
  def div: (Numeric) -> Integer
247
247
 
248
- def divmod: (Numeric) -> [ Numeric, Numeric ]
248
+ def divmod: (Integer | Float | Rational) -> [ Integer, Rational ]
249
+ | (Numeric) -> [ Numeric, Numeric ]
249
250
 
250
251
  def dup: () -> self
251
252
 
data/core/ruby_vm.rbs CHANGED
@@ -309,9 +309,13 @@ module RubyVM::YJIT
309
309
  # rdoc-file=yjit.rb
310
310
  # - enable(stats: false)
311
311
  # -->
312
- # Enable YJIT compilation.
312
+ # Enable YJIT compilation. `stats` option decides whether to enable YJIT stats
313
+ # or not.
314
+ # * `false`: Disable stats.
315
+ # * `true`: Enable stats. Print stats at exit.
316
+ # * `:quiet`: Enable stats. Do not print stats at exit.
313
317
  #
314
- def self.enable: () -> void
318
+ def self.enable: (?stats: false | true | :quiet) -> void
315
319
 
316
320
  # <!--
317
321
  # rdoc-file=yjit.rb
@@ -482,7 +482,7 @@ module Gem
482
482
  # rdoc-file=lib/rubygems.rb
483
483
  # - find_unresolved_default_spec(path)
484
484
  # -->
485
- # Find a Gem::Specification of default gem from `path`
485
+ # Find an unresolved Gem::Specification of default gem from `path`
486
486
  #
487
487
  def self.find_unresolved_default_spec: (String path) -> Specification?
488
488
 
data/core/set.rbs CHANGED
@@ -415,7 +415,7 @@ class Set[unchecked out A]
415
415
  # Equivalent to Set#delete_if, but returns nil if no changes were
416
416
  # made. Returns an enumerator if no block is given.
417
417
  #
418
- def reject!: () { (A) -> untyped } -> self
418
+ def reject!: () { (A) -> untyped } -> self?
419
419
 
420
420
  # <!--
421
421
  # rdoc-file=lib/set.rb
@@ -437,7 +437,7 @@ class Set[unchecked out A]
437
437
  # Set[1, 2, 3].disjoint? [3, 4] #=> false
438
438
  # Set[1, 2, 3].disjoint? 4..5 #=> true
439
439
  #
440
- def disjoint?: (_Each[A]) -> bool
440
+ def disjoint?: (Set[A] | Enumerable[A]) -> bool
441
441
 
442
442
  # <!--
443
443
  # rdoc-file=lib/set.rb
@@ -458,8 +458,8 @@ class Set[unchecked out A]
458
458
  #
459
459
  # Returns an enumerator if no block is given.
460
460
  #
461
- def divide: () { (A, A) -> untyped } -> Set[self]
462
- | () { (A) -> untyped } -> Set[self]
461
+ def divide: () { (A, A) -> Hash::_Key } -> Set[self]
462
+ | () { (A) -> Hash::_Key } -> Set[self]
463
463
 
464
464
  # <!--
465
465
  # rdoc-file=lib/set.rb
@@ -500,7 +500,7 @@ class Set[unchecked out A]
500
500
  # Set[1, 2, 3].intersect? 4..5 #=> false
501
501
  # Set[1, 2, 3].intersect? [3, 4] #=> true
502
502
  #
503
- def intersect?: (_Each[A]) -> bool
503
+ def intersect?: (Set[A] | Enumerable[A]) -> bool
504
504
 
505
505
  # <!--
506
506
  # rdoc-file=lib/set.rb
@@ -534,7 +534,7 @@ class Set[unchecked out A]
534
534
  # Merges the elements of the given enumerable objects to the set and
535
535
  # returns self.
536
536
  #
537
- def merge: (_Each[A]) -> self
537
+ def merge: (*_Each[A]) -> self
538
538
 
539
539
  # <!--
540
540
  # rdoc-file=lib/set.rb
@@ -544,7 +544,13 @@ class Set[unchecked out A]
544
544
  #
545
545
  def subset?: (self) -> bool
546
546
 
547
- def proper_subst?: (self) -> bool
547
+ # <!--
548
+ # rdoc-file=lib/set.rb
549
+ # - proper_subset?(set)
550
+ # -->
551
+ # Returns true if the set is a proper subset of the given set.
552
+ #
553
+ def proper_subset?: (self) -> bool
548
554
 
549
555
  # <!--
550
556
  # rdoc-file=lib/set.rb
data/docs/gem.md CHANGED
@@ -31,7 +31,6 @@ Assume you have three RBS files in your gem package:
31
31
 
32
32
  ```yaml
33
33
  dependencies:
34
- - name: abbrev
35
34
  - name: json
36
35
  - name: logger
37
36
  - name: optparse