sorbet-runtime 0.6.13506 → 0.6.13507
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/types/private/types/not_typed.rb +5 -0
- data/lib/types/private/types/string_holder.rb +5 -0
- data/lib/types/private/types/type_alias.rb +7 -0
- data/lib/types/private/types/void.rb +5 -0
- data/lib/types/types/anything.rb +5 -0
- data/lib/types/types/attached_class.rb +5 -0
- data/lib/types/types/base.rb +11 -0
- data/lib/types/types/class_of.rb +5 -0
- data/lib/types/types/enum.rb +6 -0
- data/lib/types/types/fixed_array.rb +6 -0
- data/lib/types/types/fixed_hash.rb +6 -0
- data/lib/types/types/intersection.rb +6 -0
- data/lib/types/types/noreturn.rb +5 -0
- data/lib/types/types/proc.rb +7 -0
- data/lib/types/types/self_type.rb +5 -0
- data/lib/types/types/simple.rb +8 -0
- data/lib/types/types/t_enum.rb +5 -0
- data/lib/types/types/type_parameter.rb +5 -0
- data/lib/types/types/type_variable.rb +5 -0
- data/lib/types/types/typed_class.rb +6 -0
- data/lib/types/types/typed_enumerable.rb +6 -0
- data/lib/types/types/typed_module.rb +6 -0
- data/lib/types/types/union.rb +6 -0
- data/lib/types/types/untyped.rb +5 -0
- data/lib/types/utils.rb +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4eb8dead2f995b4ddd01ae006eeebf8e634c5b7f30b121995c38c43c1a88aeac
|
|
4
|
+
data.tar.gz: 5df93e5b8be311fb7cfd52d7587439d6d52ee00704b5819d566e93af88385396
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ab174f57c44b549acb2d47431e0609f29afc0535b2490d8d5cef56f21c2840c00a5ee36288bc5bc6d94f4913bc35277d260059beb7da74ee415ec87296b6de45
|
|
7
|
+
data.tar.gz: 97079b47fdc95608f7f81edc16bf090513b1da88503ab1663074303b2c8bbe050241bbad9a04412e90472e72fcdebc820be4e5ed825105b1baa18beb924fa8dd
|
|
@@ -25,6 +25,13 @@ module T::Private::Types
|
|
|
25
25
|
nil
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
# overrides Base
|
|
29
|
+
def build_lazy_fields
|
|
30
|
+
# Not the aliased type too: an alias can refer to itself.
|
|
31
|
+
effective_aliased_type
|
|
32
|
+
nil
|
|
33
|
+
end
|
|
34
|
+
|
|
28
35
|
def aliased_type
|
|
29
36
|
@aliased_type ||= T::Utils.coerce(@callable.call)
|
|
30
37
|
end
|
data/lib/types/types/anything.rb
CHANGED
data/lib/types/types/base.rb
CHANGED
|
@@ -39,6 +39,17 @@ module T::Types
|
|
|
39
39
|
raise NotImplementedError
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
# Force every lazily-initialized field of this type and its inner types to be built.
|
|
43
|
+
# It's unusual to call this directly; you probably want to call it indirectly via `T::Utils.build_all_types`.
|
|
44
|
+
define_method(:build_lazy_fields) do
|
|
45
|
+
raise NotImplementedError
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# A frozen type can't take the write, so skip it.
|
|
49
|
+
private def build_inner_lazy_fields(inner)
|
|
50
|
+
inner.build_lazy_fields unless inner.frozen?
|
|
51
|
+
end
|
|
52
|
+
|
|
42
53
|
# Equality is based on name, so be sure the name reflects all relevant state when implementing.
|
|
43
54
|
define_method(:name) do
|
|
44
55
|
raise NotImplementedError
|
data/lib/types/types/class_of.rb
CHANGED
data/lib/types/types/enum.rb
CHANGED
data/lib/types/types/noreturn.rb
CHANGED
data/lib/types/types/proc.rb
CHANGED
data/lib/types/types/simple.rb
CHANGED
|
@@ -17,6 +17,14 @@ module T::Types
|
|
|
17
17
|
nil
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
# overrides Base
|
|
21
|
+
def build_lazy_fields
|
|
22
|
+
name
|
|
23
|
+
# NilClass can't be paired with itself in a SimplePairUnion.
|
|
24
|
+
to_nilable.types unless @raw_type.equal?(NilClass)
|
|
25
|
+
nil
|
|
26
|
+
end
|
|
27
|
+
|
|
20
28
|
# overrides Base
|
|
21
29
|
def name
|
|
22
30
|
# Memoize to mitigate pathological performance with anonymous modules (https://bugs.ruby-lang.org/issues/11119)
|
data/lib/types/types/t_enum.rb
CHANGED
data/lib/types/types/union.rb
CHANGED
|
@@ -42,6 +42,12 @@ module T::Types
|
|
|
42
42
|
nil
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
+
# overrides Base
|
|
46
|
+
def build_lazy_fields
|
|
47
|
+
types.each { |type| build_inner_lazy_fields(type) }
|
|
48
|
+
nil
|
|
49
|
+
end
|
|
50
|
+
|
|
45
51
|
# overrides Base
|
|
46
52
|
def name
|
|
47
53
|
# Use the attr_reader here so we can override it in SimplePairUnion
|
data/lib/types/types/untyped.rb
CHANGED
data/lib/types/utils.rb
CHANGED
|
@@ -178,6 +178,19 @@ module T::Utils
|
|
|
178
178
|
nil
|
|
179
179
|
end
|
|
180
180
|
|
|
181
|
+
# Force every type object in the process to build its lazily-initialized
|
|
182
|
+
# fields (see `T::Types::Base#build_lazy_fields`).
|
|
183
|
+
#
|
|
184
|
+
# Call this before forking workers so that first use of a type in a worker
|
|
185
|
+
# doesn't write onto a type object shared with the parent via copy-on-write.
|
|
186
|
+
def self.build_all_types
|
|
187
|
+
require 'objspace'
|
|
188
|
+
ObjectSpace.each_object(T::Types::Base) do |type|
|
|
189
|
+
type.build_lazy_fields unless type.frozen?
|
|
190
|
+
end
|
|
191
|
+
nil
|
|
192
|
+
end
|
|
193
|
+
|
|
181
194
|
def self.lift_enum(enum)
|
|
182
195
|
unless enum.is_a?(T::Types::Enum)
|
|
183
196
|
raise ArgumentError.new("#{enum.inspect} is not a T.deprecated_enum")
|