Skip to content

Commit 1693080

Browse files
authored
Merge branch 'master' into enumerator-chain
2 parents 635b689 + b9f044f commit 1693080

37 files changed

+504
-160
lines changed

.github/workflows/windows.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ jobs:
2727
run: |
2828
ruby -e '
2929
exit if "${{ matrix.ruby }}" != "ucrt" && "${{ matrix.ruby }}" != "mswin"
30-
bundled_gems = Dir.glob("D:/ruby-${{ matrix.ruby }}/lib/ruby/gems/*/cache/*.gem")
31-
.map { |path| File.basename(path, ".gem")[/^(.+)-[^-]+$/, 1] }
30+
31+
require "open-uri"
32+
require "json"
33+
34+
res = URI.parse("https://stdgems.org/bundled_gems.json").read
35+
bundled_gems = JSON.parse(res)["gems"].map{_1["gem"]}
3236
system "gem uninstall #{bundled_gems.join(" ")}", exception: true
3337
'
3438
- name: bundle install

.rubocop.yml

+4
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,16 @@ RBS/Style:
4646
- 'test/**/*'
4747
RBS/Style/BlockReturnBoolish:
4848
Enabled: true
49+
RBS/Style/ClassWithSingleton:
50+
Enabled: true
4951
RBS/Style/DuplicatedType:
5052
Enabled: true
5153
RBS/Style/EmptyArgument:
5254
Enabled: true
5355
RBS/Style/InitializeReturnType:
5456
Enabled: true
57+
RBS/Style/InstanceWithInstance:
58+
Enabled: true
5559
RBS/Style/OptionalNil:
5660
Enabled: true
5761
RBS/Style/RedundantParentheses:

Gemfile.lock

+20-17
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ GEM
3636
connection_pool (2.5.0)
3737
csv (3.3.2)
3838
dbm (1.1.0)
39-
diff-lcs (1.5.1)
39+
diff-lcs (1.6.0)
4040
digest (3.2.0)
4141
drb (2.2.1)
4242
ffi (1.17.1)
@@ -48,27 +48,28 @@ GEM
4848
strong_json (>= 1.1, < 2.2)
4949
i18n (1.14.7)
5050
concurrent-ruby (~> 1.0)
51-
json (2.9.1)
51+
json (2.10.1)
5252
json-schema (5.1.1)
5353
addressable (~> 2.8)
5454
bigdecimal (~> 3.1)
5555
language_server-protocol (3.17.0.4)
56+
lint_roller (1.1.0)
5657
listen (3.9.0)
5758
rb-fsevent (~> 0.10, >= 0.10.3)
5859
rb-inotify (~> 0.9, >= 0.9.10)
59-
logger (1.6.5)
60+
logger (1.6.6)
6061
marcel (1.0.4)
6162
memory_profiler (1.1.0)
6263
minitest (5.25.4)
6364
mutex_m (0.3.0)
6465
net-protocol (0.2.2)
6566
timeout
66-
net-smtp (0.5.0)
67+
net-smtp (0.5.1)
6768
net-protocol
6869
nkf (0.2.0)
6970
ostruct (0.6.1)
7071
parallel (1.26.3)
71-
parser (3.3.7.0)
72+
parser (3.3.7.1)
7273
ast (~> 2.4.1)
7374
racc
7475
pathname (0.4.0)
@@ -77,7 +78,7 @@ GEM
7778
psych (4.0.6)
7879
stringio
7980
public_suffix (6.0.1)
80-
raap (1.1.0)
81+
raap (1.2.0)
8182
rbs (~> 3.0)
8283
timeout (~> 0.4)
8384
racc (1.8.1)
@@ -95,7 +96,7 @@ GEM
9596
rspec-core (~> 3.13.0)
9697
rspec-expectations (~> 3.13.0)
9798
rspec-mocks (~> 3.13.0)
98-
rspec-core (3.13.2)
99+
rspec-core (3.13.3)
99100
rspec-support (~> 3.13.0)
100101
rspec-expectations (3.13.3)
101102
diff-lcs (>= 1.2.0, < 2.0)
@@ -104,28 +105,30 @@ GEM
104105
diff-lcs (>= 1.2.0, < 2.0)
105106
rspec-support (~> 3.13.0)
106107
rspec-support (3.13.2)
107-
rubocop (1.71.0)
108+
rubocop (1.72.2)
108109
json (~> 2.3)
109-
language_server-protocol (>= 3.17.0)
110+
language_server-protocol (~> 3.17.0.2)
111+
lint_roller (~> 1.1.0)
110112
parallel (~> 1.10)
111113
parser (>= 3.3.0.2)
112114
rainbow (>= 2.2.2, < 4.0)
113115
regexp_parser (>= 2.9.3, < 3.0)
114-
rubocop-ast (>= 1.36.2, < 2.0)
116+
rubocop-ast (>= 1.38.0, < 2.0)
115117
ruby-progressbar (~> 1.7)
116118
unicode-display_width (>= 2.4.0, < 4.0)
117-
rubocop-ast (1.38.0)
119+
rubocop-ast (1.38.1)
118120
parser (>= 3.3.1.0)
119-
rubocop-on-rbs (1.3.0)
121+
rubocop-on-rbs (1.4.2)
120122
rbs (~> 3.5)
121123
rubocop (~> 1.61)
122124
zlib
123-
rubocop-rubycw (0.1.6)
124-
rubocop (~> 1.0)
125+
rubocop-rubycw (0.2.1)
126+
lint_roller (~> 1.1)
127+
rubocop (~> 1.72.1)
125128
ruby-progressbar (1.13.0)
126129
securerandom (0.4.1)
127130
stackprof (0.2.27)
128-
steep (1.9.3)
131+
steep (1.9.4)
129132
activesupport (>= 5.1)
130133
concurrent-ruby (>= 1.1.10)
131134
csv (>= 3.0.9)
@@ -141,7 +144,7 @@ GEM
141144
strscan (>= 1.0.0)
142145
terminal-table (>= 2, < 4)
143146
uri (>= 0.12.0)
144-
stringio (3.1.2)
147+
stringio (3.1.5)
145148
strong_json (2.1.2)
146149
strscan (3.1.2)
147150
tempfile (0.3.1)
@@ -153,7 +156,7 @@ GEM
153156
tzinfo (2.0.6)
154157
concurrent-ruby (~> 1.0)
155158
unicode-display_width (2.6.0)
156-
uri (1.0.2)
159+
uri (1.0.3)
157160
zlib (3.2.1)
158161

159162
PLATFORMS

Rakefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ task :typecheck_test => :compile do
139139
end
140140

141141
task :raap => :compile do
142-
sh %q[ruby test/raap.rb | xargs bundle exec raap -r digest/bubblebabble --library digest --allow-private]
142+
sh "ruby test/raap/core.rb"
143+
sh "ruby test/raap/digest.rb"
144+
sh "ruby test/raap/openssl.rb"
143145
end
144146

145147
task :rubocop do

core/data.rbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -411,5 +411,5 @@ class Data
411411
# out = origin.with(z: 1) # ArgumentError: unknown keyword: :z
412412
# some_point = origin.with(1, 2) # ArgumentError: expected keyword arguments, got positional arguments
413413
#
414-
def with: (**untyped) -> instance
414+
def with: (**untyped) -> self
415415
end

core/exception.rbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class Exception
270270
# x0..equal?(x1) # => false
271271
#
272272
def exception: (?self) -> self
273-
| (string | _ToS message) -> instance
273+
| (string | _ToS message) -> self
274274

275275
# <!--
276276
# rdoc-file=error.c

core/io.rbs

+4
Original file line numberDiff line numberDiff line change
@@ -3251,6 +3251,10 @@ class IO < Object
32513251
# f.close
32523252
#
32533253
alias to_i fileno
3254+
3255+
interface _ForFd[RET]
3256+
def for_fd: (?) -> RET
3257+
end
32543258
end
32553259

32563260
IO::APPEND: Integer

core/method.rbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Method
5454
#
5555
def hash: () -> Integer
5656

57-
def dup: () -> instance
57+
def dup: () -> self
5858

5959
# <!--
6060
# rdoc-file=proc.c
@@ -252,7 +252,7 @@ class Method
252252
# m.call # => "bar"
253253
# n = m.clone.call # => "bar"
254254
#
255-
def clone: () -> instance
255+
def clone: () -> self
256256

257257
# <!--
258258
# rdoc-file=proc.c

core/module.rbs

+3-3
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,8 @@ class Module < Object
731731
# I'm Dino!
732732
# #<B:0x401b39e8>
733733
#
734-
def define_method: (interned symbol, ^() [self: instance] -> untyped | Method | UnboundMethod method) -> Symbol
735-
| (interned symbol) { () [self: instance] -> untyped } -> Symbol
734+
def define_method: (interned symbol, ^() [self: self] -> untyped | Method | UnboundMethod method) -> Symbol
735+
| (interned symbol) { () [self: self] -> untyped } -> Symbol
736736

737737
# <!--
738738
# rdoc-file=object.c
@@ -1164,7 +1164,7 @@ class Module < Object
11641164
# -->
11651165
# Returns the name of the module *mod*. Returns `nil` for anonymous modules.
11661166
#
1167-
def name: () -> String?
1167+
def name: %a{implicitly-returns-nil} () -> String
11681168

11691169
# <!--
11701170
# rdoc-file=eval.c

core/proc.rbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ class Proc
376376
#
377377
def self.new: () { (?) -> untyped } -> instance
378378

379-
def clone: () -> instance
380-
def dup: () -> instance
379+
def clone: () -> self
380+
def dup: () -> self
381381

382382
# <!-- rdoc-file=proc.c -->
383383
# Invokes the block, setting the block's parameters to the values in *params*

core/rubygems/version.rbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ module Gem
221221
#
222222
# Pre-release (alpha) parts, e.g, 5.3.1.b.2 => 5.4, are ignored.
223223
#
224-
def bump: () -> instance
224+
def bump: () -> self
225225

226226
# <!--
227227
# rdoc-file=lib/rubygems/version.rb
@@ -274,7 +274,7 @@ module Gem
274274
# The release for this version (e.g. 1.2.0.a -> 1.2.0). Non-prerelease versions
275275
# return themselves.
276276
#
277-
def release: () -> instance
277+
def release: () -> self
278278

279279
# <!--
280280
# rdoc-file=lib/rubygems/version.rb

core/string.rbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1936,7 +1936,7 @@ class String
19361936
?crlf_newline: boolish,
19371937
?lf_newline: boolish,
19381938
?fallback: ^(String) -> string? | Method | _EncodeFallbackAref
1939-
) -> instance
1939+
) -> self
19401940

19411941
interface _EncodeFallbackAref
19421942
def []: (String) -> string?

core/unbound_method.rbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class UnboundMethod
100100
# m.call # => "bar"
101101
# n = m.clone.call # => "bar"
102102
#
103-
def clone: () -> instance
103+
def clone: () -> self
104104

105105
# <!--
106106
# rdoc-file=proc.c

lib/rbs/cli/validate.rb

+1
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ def validate_class_module_definition
196196
end
197197
InvalidTypeApplicationError.check!(type_name: member.name, params: params, args: member.args, location: member.location)
198198
when AST::Members::Var
199+
@validator.validate_variable(member)
199200
void_type_context_validator(member.type)
200201
if member.is_a?(AST::Members::ClassVariable)
201202
no_self_type_validator(member.type)

lib/rbs/collection/config/lockfile_generator.rb

-5
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,6 @@ def generate
161161
return if lockfile.gems.key?(name)
162162

163163
case name
164-
when 'rubygems', 'set'
165-
msg = "`#{name}` has been moved to core library, so it is always loaded. Remove explicit loading `#{name}`"
166-
msg << " from `#{from_gem}`" if from_gem
167-
msg << "."
168-
return
169164
when *ALUMNI_STDLIBS.keys
170165
version = ALUMNI_STDLIBS.fetch(name)
171166
if from_gem

lib/rbs/definition.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ class Variable
66
attr_reader :parent_variable
77
attr_reader :type
88
attr_reader :declared_in
9+
attr_reader :source
910

10-
def initialize(parent_variable:, type:, declared_in:)
11+
def initialize(parent_variable:, type:, declared_in:, source:)
1112
@parent_variable = parent_variable
1213
@type = type
1314
@declared_in = declared_in
15+
@source = source
1416
end
1517

1618
def sub(s)
@@ -19,7 +21,8 @@ def sub(s)
1921
self.class.new(
2022
parent_variable: parent_variable,
2123
type: type.sub(s),
22-
declared_in: declared_in
24+
declared_in: declared_in,
25+
source: source
2326
)
2427
end
2528
end

0 commit comments

Comments
 (0)