Skip to content

Commit e3eb8ff

Browse files
authored
Merge pull request #1379 from ruby/backport-to-3.1
Backport to 3.1
2 parents 600daa6 + 8e79cb9 commit e3eb8ff

File tree

11 files changed

+208
-34
lines changed

11 files changed

+208
-34
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ gem "dbm"
1818
gem 'digest'
1919
gem 'tempfile'
2020
gem "prime"
21-
gem "rdoc", "< 6.5.0"
21+
gem "rdoc", "~> 6.4.0"
2222

2323
# Test gems
2424
gem "rbs-amber", path: "test/assets/test-gem"

Gemfile.lock

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ GEM
1515
public_suffix (>= 2.0.2, < 6.0)
1616
ast (2.4.2)
1717
dbm (1.1.0)
18-
debase (0.2.5.beta2)
19-
debase-ruby_core_source (>= 0.10.12)
20-
debase-ruby_core_source (3.2.0)
2118
diff-lcs (1.5.0)
2219
digest (3.1.1)
2320
forwardable (1.3.2)
@@ -29,25 +26,29 @@ GEM
2926
json (2.6.3)
3027
json-schema (4.0.0)
3128
addressable (>= 2.8)
29+
language_server-protocol (3.17.0.3)
3230
marcel (1.0.2)
3331
minitest (5.18.0)
34-
parallel (1.22.1)
35-
parser (3.2.2.0)
32+
parallel (1.23.0)
33+
parser (3.2.2.3)
3634
ast (~> 2.4.1)
37-
power_assert (2.0.2)
35+
racc
36+
power_assert (2.0.3)
37+
prettier_print (1.2.1)
3838
prime (0.1.2)
3939
forwardable
4040
singleton
4141
psych (4.0.6)
4242
stringio
4343
public_suffix (5.0.1)
44+
racc (1.7.1)
4445
rainbow (3.1.1)
4546
rake (13.0.6)
46-
rake-compiler (1.2.1)
47+
rake-compiler (1.2.2)
4748
rake
4849
rdoc (6.4.0)
4950
psych (>= 4.0.0)
50-
regexp_parser (2.8.0)
51+
regexp_parser (2.8.1)
5152
rexml (3.2.5)
5253
rspec (3.12.0)
5354
rspec-core (~> 3.12.0)
@@ -62,29 +63,34 @@ GEM
6263
diff-lcs (>= 1.2.0, < 2.0)
6364
rspec-support (~> 3.12.0)
6465
rspec-support (3.12.0)
65-
rubocop (1.50.2)
66+
rubocop (1.52.1)
6667
json (~> 2.3)
6768
parallel (~> 1.10)
68-
parser (>= 3.2.0.0)
69+
parser (>= 3.2.2.3)
6970
rainbow (>= 2.2.2, < 4.0)
7071
regexp_parser (>= 1.8, < 3.0)
7172
rexml (>= 3.2.5, < 4.0)
7273
rubocop-ast (>= 1.28.0, < 2.0)
7374
ruby-progressbar (~> 1.7)
7475
unicode-display_width (>= 2.4.0, < 3.0)
75-
rubocop-ast (1.28.0)
76+
rubocop-ast (1.29.0)
7677
parser (>= 3.2.1.0)
7778
rubocop-rubycw (0.1.6)
7879
rubocop (~> 1.0)
79-
ruby-debug-ide (0.7.3)
80-
rake (>= 0.8.1)
80+
ruby-lsp (0.5.1)
81+
language_server-protocol (~> 3.17.0)
82+
sorbet-runtime
83+
syntax_tree (>= 6.1.1, < 7)
8184
ruby-progressbar (1.13.0)
8285
singleton (0.1.1)
86+
sorbet-runtime (0.5.10827)
8387
stackprof (0.2.25)
84-
stringio (3.0.4)
88+
stringio (3.0.7)
8589
strong_json (2.1.2)
90+
syntax_tree (6.1.1)
91+
prettier_print (>= 1.2.0)
8692
tempfile (0.1.3)
87-
test-unit (3.5.7)
93+
test-unit (3.5.9)
8894
power_assert
8995
unicode-display_width (2.4.2)
9096

@@ -94,7 +100,6 @@ PLATFORMS
94100

95101
DEPENDENCIES
96102
dbm
97-
debase (>= 0.2.5.beta2)
98103
digest
99104
goodcheck
100105
json
@@ -105,11 +110,11 @@ DEPENDENCIES
105110
rake-compiler
106111
rbs!
107112
rbs-amber!
108-
rdoc (< 6.5.0)
113+
rdoc (~> 6.4.0)
109114
rspec
110115
rubocop
111116
rubocop-rubycw
112-
ruby-debug-ide
117+
ruby-lsp
113118
stackprof
114119
tempfile
115120
test-unit

core/file.rbs

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,67 +1971,171 @@ File::SEPARATOR: String
19711971
#
19721972
File::Separator: String
19731973

1974+
# <!-- rdoc-file=file.c -->
1975+
# File::Constants provides file-related constants. All possible file constants
1976+
# are listed in the documentation but they may not all be present on your
1977+
# platform.
1978+
#
1979+
# If the underlying platform doesn't define a constant the corresponding Ruby
1980+
# constant is not defined.
1981+
#
1982+
# Your platform documentations (e.g. man open(2)) may describe more detailed
1983+
# information.
1984+
#
19741985
module File::Constants
19751986
end
19761987

1988+
# <!-- rdoc-file=file.c -->
1989+
# append on each write
1990+
#
19771991
File::Constants::APPEND: Integer
19781992

1993+
# <!-- rdoc-file=file.c -->
1994+
# disable line code conversion
1995+
#
19791996
File::Constants::BINARY: Integer
19801997

1998+
# <!-- rdoc-file=file.c -->
1999+
# create file if it does not exist
2000+
#
19812001
File::Constants::CREAT: Integer
19822002

2003+
# <!-- rdoc-file=file.c -->
2004+
# Try to minimize cache effects of the I/O to and from this file.
2005+
#
19832006
File::Constants::DIRECT: Integer
19842007

2008+
# <!-- rdoc-file=file.c -->
2009+
# any write operation perform synchronously except some meta data
2010+
#
19852011
File::Constants::DSYNC: Integer
19862012

2013+
# <!-- rdoc-file=file.c -->
2014+
# error if CREAT and the file exists
2015+
#
19872016
File::Constants::EXCL: Integer
19882017

2018+
# <!-- rdoc-file=dir.c -->
2019+
# Makes File.fnmatch patterns case insensitive (but not Dir.glob patterns).
2020+
#
19892021
File::Constants::FNM_CASEFOLD: Integer
19902022

2023+
# <!-- rdoc-file=dir.c -->
2024+
# The '*' wildcard matches filenames starting with "." in File.fnmatch and
2025+
# Dir.glob patterns
2026+
#
19912027
File::Constants::FNM_DOTMATCH: Integer
19922028

2029+
# <!-- rdoc-file=dir.c -->
2030+
# Allows file globbing through "{a,b}" in File.fnmatch patterns.
2031+
#
19932032
File::Constants::FNM_EXTGLOB: Integer
19942033

2034+
# <!-- rdoc-file=dir.c -->
2035+
# Disables escapes in File.fnmatch and Dir.glob patterns
2036+
#
19952037
File::Constants::FNM_NOESCAPE: Integer
19962038

2039+
# <!-- rdoc-file=dir.c -->
2040+
# Wildcards in File.fnmatch and Dir.glob patterns do not match directory
2041+
# separators
2042+
#
19972043
File::Constants::FNM_PATHNAME: Integer
19982044

2045+
# <!-- rdoc-file=dir.c -->
2046+
# Makes patterns to match short names if existing. Valid only on Microsoft
2047+
# Windows.
2048+
#
19992049
File::Constants::FNM_SHORTNAME: Integer
20002050

2051+
# <!-- rdoc-file=dir.c -->
2052+
# System default case insensitiveness, equals to FNM_CASEFOLD or 0.
2053+
#
20012054
File::Constants::FNM_SYSCASE: Integer
20022055

2056+
# <!-- rdoc-file=file.c -->
2057+
# exclusive lock. see File#flock
2058+
#
20032059
File::Constants::LOCK_EX: Integer
20042060

2061+
# <!-- rdoc-file=file.c -->
2062+
# non-blocking lock. used with LOCK_SH or LOCK_EX. see File#flock
2063+
#
20052064
File::Constants::LOCK_NB: Integer
20062065

2066+
# <!-- rdoc-file=file.c -->
2067+
# shared lock. see File#flock
2068+
#
20072069
File::Constants::LOCK_SH: Integer
20082070

2071+
# <!-- rdoc-file=file.c -->
2072+
# unlock. see File#flock
2073+
#
20092074
File::Constants::LOCK_UN: Integer
20102075

2076+
# <!-- rdoc-file=file.c -->
2077+
# do not change atime
2078+
#
20112079
File::Constants::NOATIME: Integer
20122080

2081+
# <!-- rdoc-file=file.c -->
2082+
# not to make opened IO the controlling terminal device
2083+
#
20132084
File::Constants::NOCTTY: Integer
20142085

2086+
# <!-- rdoc-file=file.c -->
2087+
# do not follow symlinks
2088+
#
20152089
File::Constants::NOFOLLOW: Integer
20162090

2091+
# <!-- rdoc-file=file.c -->
2092+
# do not block on open or for data to become available
2093+
#
20172094
File::Constants::NONBLOCK: Integer
20182095

2096+
# <!-- rdoc-file=file.c -->
2097+
# Name of the null device
2098+
#
20192099
File::Constants::NULL: String
20202100

2101+
# <!-- rdoc-file=file.c -->
2102+
# open for reading only
2103+
#
20212104
File::Constants::RDONLY: Integer
20222105

2106+
# <!-- rdoc-file=file.c -->
2107+
# open for reading and writing
2108+
#
20232109
File::Constants::RDWR: Integer
20242110

2111+
# <!-- rdoc-file=file.c -->
2112+
# any read operation perform synchronously. used with SYNC or DSYNC.
2113+
#
20252114
File::Constants::RSYNC: Integer
20262115

2116+
# <!-- rdoc-file=file.c -->
2117+
# can delete opened file
2118+
#
20272119
File::Constants::SHARE_DELETE: Integer
20282120

2121+
# <!-- rdoc-file=file.c -->
2122+
# any write operation perform synchronously
2123+
#
20292124
File::Constants::SYNC: Integer
20302125

2126+
# <!-- rdoc-file=file.c -->
2127+
# Create an unnamed temporary file
2128+
#
20312129
File::Constants::TMPFILE: Integer
20322130

2131+
# <!-- rdoc-file=file.c -->
2132+
# truncate size to 0
2133+
#
20332134
File::Constants::TRUNC: Integer
20342135

2136+
# <!-- rdoc-file=file.c -->
2137+
# open for writing only
2138+
#
20352139
File::Constants::WRONLY: Integer
20362140

20372141
# <!-- rdoc-file=file.c -->

core/gc.rbs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,6 @@ module GC
234234
#
235235
def self.verify_internal_consistency: () -> nil
236236

237-
# <!--
238-
# rdoc-file=gc.c
239-
# - verify_transient_heap_internal_consistency()
240-
# -->
241-
#
242-
def self.verify_transient_heap_internal_consistency: () -> nil
243-
244237
# <!--
245238
# rdoc-file=gc.rb
246239
# - GC.latest_gc_info -> hash

core/process.rbs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,6 +1645,9 @@ module Process::UID
16451645
def self.eid=: (Integer user) -> Integer
16461646
end
16471647

1648+
# <!-- rdoc-file=process.c -->
1649+
# Placeholder for rusage
1650+
#
16481651
class Process::Tms < Struct[Float]
16491652
end
16501653

lib/rbs/collection/config/lockfile_generator.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,14 @@ def generate
133133
end
134134
end
135135

136-
gem_hash[name].dependencies.each do |dep|
137-
if spec = gem_hash[dep.name]
138-
assign_gem(name: dep.name, version: spec.version, src_data: nil, ignored_gems: ignored_gems)
136+
if spec = gem_hash.fetch(name, nil)
137+
spec.dependencies.each do |dep|
138+
if dep_spec = gem_hash[dep.name]
139+
assign_gem(name: dep.name, version: dep_spec.version, src_data: nil, ignored_gems: ignored_gems)
140+
end
139141
end
142+
else
143+
RBS.logger.warn "Cannot find `#{name}` gem. Using incorrect Bundler context? (#{definition.lockfile})"
140144
end
141145
end
142146

lib/rdoc/discover.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
begin
4-
gem 'rdoc', '~> 6.4.0'
4+
gem 'rdoc', '~> 6.4'
55
require 'rdoc_plugin/parser'
66
module RDoc
77
class Parser

sig/shims/rubygems.rbs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ module Gem
1212
class Dependency
1313
def name: () -> String
1414
end
15+
16+
module ::Kernel
17+
def self?.gem: (String, *String) -> void
18+
end
1519
end

0 commit comments

Comments
 (0)