sorbet-runtime 0.5.9818 → 0.5.9827
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sorbet-runtime.rb +1 -0
- data/lib/types/_types.rb +10 -0
- data/lib/types/types/typed_enumerable.rb +5 -0
- data/lib/types/types/typed_enumerator_lazy.rb +41 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f740868f3b5e872601f01934763bf10255d56d738d50334cfcf96b3a7583bf6
|
4
|
+
data.tar.gz: 90edadbf0782f42a9e2450894936e59be59c7ba19379d8a9000e79a90f34b2a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8185e90e25e5ae3764443743f2180870d0f04f72d0aa2c6e18fabd679708446c1904579b0f7a424e51831e4e6af685622bcbc23c203e523771af6eb1f5057faa
|
7
|
+
data.tar.gz: 1509840bbbbee014740b3fe1029bdb3aea29446a9182adf9b8d7a2dbf63dfd6b9d6128f48870b7804093f4e443f64cb756048ce1b080b11a238ddec5671e5cd7
|
data/lib/sorbet-runtime.rb
CHANGED
@@ -45,6 +45,7 @@ require_relative 'types/types/t_enum'
|
|
45
45
|
require_relative 'types/types/type_parameter'
|
46
46
|
require_relative 'types/types/typed_array'
|
47
47
|
require_relative 'types/types/typed_enumerator'
|
48
|
+
require_relative 'types/types/typed_enumerator_lazy'
|
48
49
|
require_relative 'types/types/typed_hash'
|
49
50
|
require_relative 'types/types/typed_range'
|
50
51
|
require_relative 'types/types/typed_set'
|
data/lib/types/_types.rb
CHANGED
@@ -286,6 +286,16 @@ module T
|
|
286
286
|
T::Types::TypedEnumerator.new(type)
|
287
287
|
end
|
288
288
|
end
|
289
|
+
|
290
|
+
module Lazy
|
291
|
+
def self.[](type)
|
292
|
+
if type.is_a?(T::Types::Untyped)
|
293
|
+
T::Types::TypedEnumeratorLazy::Untyped.new
|
294
|
+
else
|
295
|
+
T::Types::TypedEnumeratorLazy.new(type)
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
289
299
|
end
|
290
300
|
|
291
301
|
module Range
|
@@ -51,6 +51,9 @@ module T::Types
|
|
51
51
|
return false if !key_type.recursively_valid?(key) || !value_type.recursively_valid?(val)
|
52
52
|
end
|
53
53
|
true
|
54
|
+
when Enumerator::Lazy
|
55
|
+
# Enumerators can be unbounded: see `[:foo, :bar].cycle`
|
56
|
+
true
|
54
57
|
when Enumerator
|
55
58
|
# Enumerators can be unbounded: see `[:foo, :bar].cycle`
|
56
59
|
true
|
@@ -140,6 +143,8 @@ module T::Types
|
|
140
143
|
else
|
141
144
|
T::Range[type_from_instances(typeable_objects)]
|
142
145
|
end
|
146
|
+
when Enumerator::Lazy
|
147
|
+
T::Enumerator::Lazy[type_from_instances(obj)]
|
143
148
|
when Enumerator
|
144
149
|
T::Enumerator[type_from_instances(obj)]
|
145
150
|
when Set
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# typed: true
|
3
|
+
|
4
|
+
module T::Types
|
5
|
+
class TypedEnumeratorLazy < TypedEnumerable
|
6
|
+
attr_reader :type
|
7
|
+
|
8
|
+
def underlying_class
|
9
|
+
Enumerator::Lazy
|
10
|
+
end
|
11
|
+
|
12
|
+
# overrides Base
|
13
|
+
def name
|
14
|
+
"T::Enumerator::Lazy[#{@type.name}]"
|
15
|
+
end
|
16
|
+
|
17
|
+
# overrides Base
|
18
|
+
def recursively_valid?(obj)
|
19
|
+
obj.is_a?(Enumerator::Lazy) && super
|
20
|
+
end
|
21
|
+
|
22
|
+
# overrides Base
|
23
|
+
def valid?(obj)
|
24
|
+
obj.is_a?(Enumerator::Lazy)
|
25
|
+
end
|
26
|
+
|
27
|
+
def new(*args, &blk)
|
28
|
+
T.unsafe(Enumerator::Lazy).new(*args, &blk)
|
29
|
+
end
|
30
|
+
|
31
|
+
class Untyped < TypedEnumeratorLazy
|
32
|
+
def initialize
|
33
|
+
super(T.untyped)
|
34
|
+
end
|
35
|
+
|
36
|
+
def valid?(obj)
|
37
|
+
obj.is_a?(Enumerator::Lazy)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sorbet-runtime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.9827
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -233,6 +233,7 @@ files:
|
|
233
233
|
- lib/types/types/typed_array.rb
|
234
234
|
- lib/types/types/typed_enumerable.rb
|
235
235
|
- lib/types/types/typed_enumerator.rb
|
236
|
+
- lib/types/types/typed_enumerator_lazy.rb
|
236
237
|
- lib/types/types/typed_hash.rb
|
237
238
|
- lib/types/types/typed_range.rb
|
238
239
|
- lib/types/types/typed_set.rb
|