sorbet-runtime 0.4.4357 → 0.4.4358
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dced59e362cbba099a7058a95a2fdf7f5cfbfd0f
|
4
|
+
data.tar.gz: 206e5dc1fe80e914921e958d018ce530f3a75ca3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab99f0940804c3f3b8cd8ba72602b2944ce276417c16e18630572e51ce47de2c196176e308cc9268b4ac00766383321a2803338831e74b21814aaafd4a76fe58
|
7
|
+
data.tar.gz: 57de4c582d0807a8c49821fcaf23b2503558e3f7f683ff3fa147e74e7290a5228c4ecf386c90ebdaef54eb7f68ce09cf880c041315113bf0fb1484cb9febf5ed
|
@@ -80,9 +80,6 @@ module T::Private::Methods
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def checked(level)
|
83
|
-
if T.unsafe(true)
|
84
|
-
raise "The .checked API is unstable, so we don't want it used until we redesign it. To change Sorbet's runtime behavior, see https://sorbet.org/docs/tconfiguration"
|
85
|
-
end
|
86
83
|
check_live!
|
87
84
|
|
88
85
|
if !decl.checked.equal?(ARG_NOT_PROVIDED)
|
@@ -27,7 +27,7 @@ class T::Props::Decorator
|
|
27
27
|
end
|
28
28
|
|
29
29
|
# prop stuff
|
30
|
-
sig {returns(T::Hash[Symbol, Rules])}
|
30
|
+
sig {returns(T::Hash[Symbol, Rules]).checked(:never)}
|
31
31
|
def props
|
32
32
|
@props ||= {}.freeze
|
33
33
|
end
|
@@ -44,7 +44,7 @@ class T::Props::Decorator
|
|
44
44
|
sig {returns(T::Array[Symbol])}
|
45
45
|
def all_props; props.keys; end
|
46
46
|
|
47
|
-
sig {params(prop: T.any(Symbol, String)).returns(Rules)}
|
47
|
+
sig {params(prop: T.any(Symbol, String)).returns(Rules).checked(:never)}
|
48
48
|
def prop_rules(prop); props[prop.to_sym] || raise("No such prop: #{prop.inspect}"); end
|
49
49
|
|
50
50
|
sig {params(prop: Symbol, rules: Rules).void}
|
@@ -80,7 +80,7 @@ class T::Props::Decorator
|
|
80
80
|
}
|
81
81
|
end
|
82
82
|
|
83
|
-
sig {returns(DecoratedClass)}
|
83
|
+
sig {returns(DecoratedClass).checked(:never)}
|
84
84
|
def decorated_class; @class; end
|
85
85
|
|
86
86
|
# Accessors
|
@@ -94,6 +94,7 @@ class T::Props::Decorator
|
|
94
94
|
rules: T.nilable(Rules)
|
95
95
|
)
|
96
96
|
.returns(T.untyped)
|
97
|
+
.checked(:never)
|
97
98
|
end
|
98
99
|
def get(instance, prop, rules=props[prop.to_sym])
|
99
100
|
# For backwards compatibility, fall back to reconstructing the accessor key
|
@@ -111,6 +112,7 @@ class T::Props::Decorator
|
|
111
112
|
rules: T.nilable(Rules)
|
112
113
|
)
|
113
114
|
.void
|
115
|
+
.checked(:never)
|
114
116
|
end
|
115
117
|
def set(instance, prop, value, rules=props[prop.to_sym])
|
116
118
|
# For backwards compatibility, fall back to reconstructing the accessor key
|
@@ -119,7 +121,7 @@ class T::Props::Decorator
|
|
119
121
|
end
|
120
122
|
|
121
123
|
# Use this to validate that a value will validate for a given prop. Useful for knowing whether a value can be set on a model without setting it.
|
122
|
-
sig {params(prop: Symbol, val: T.untyped).void}
|
124
|
+
sig {params(prop: Symbol, val: T.untyped).void.checked(:never)}
|
123
125
|
def validate_prop_value(prop, val)
|
124
126
|
# This implements a 'public api' on document so that we don't allow callers to pass in rules
|
125
127
|
# Rules seem like an implementation detail so it seems good to now allow people to specify them manually.
|
@@ -127,7 +129,7 @@ class T::Props::Decorator
|
|
127
129
|
end
|
128
130
|
|
129
131
|
# Passing in rules here is purely a performance optimization.
|
130
|
-
sig {params(prop: Symbol, val: T.untyped, rules: Rules).void}
|
132
|
+
sig {params(prop: Symbol, val: T.untyped, rules: Rules).void.checked(:never)}
|
131
133
|
private def check_prop_type(prop, val, rules=prop_rules(prop))
|
132
134
|
type_object = rules.fetch(:type_object)
|
133
135
|
type = rules.fetch(:type)
|
@@ -173,6 +175,7 @@ class T::Props::Decorator
|
|
173
175
|
rules: T.nilable(Rules)
|
174
176
|
)
|
175
177
|
.void
|
178
|
+
.checked(:never)
|
176
179
|
end
|
177
180
|
def prop_set(instance, prop, val, rules=prop_rules(prop))
|
178
181
|
check_prop_type(prop, val, T.must(rules))
|
@@ -188,6 +191,7 @@ class T::Props::Decorator
|
|
188
191
|
rules: T.nilable(Rules)
|
189
192
|
)
|
190
193
|
.returns(T.untyped)
|
194
|
+
.checked(:never)
|
191
195
|
end
|
192
196
|
def prop_get(instance, prop, rules=props[prop.to_sym])
|
193
197
|
val = get(instance, prop, rules)
|
@@ -222,6 +226,7 @@ class T::Props::Decorator
|
|
222
226
|
opts: Hash
|
223
227
|
)
|
224
228
|
.returns(T.untyped)
|
229
|
+
.checked(:never)
|
225
230
|
end
|
226
231
|
def foreign_prop_get(instance, prop, foreign_class, rules=props[prop.to_sym], opts={})
|
227
232
|
return if !(value = prop_get(instance, prop, rules))
|
@@ -70,6 +70,7 @@ module T::Props::PrettyPrintable
|
|
70
70
|
sig do
|
71
71
|
params(instance: T::Props::PrettyPrintable, prop: Symbol, multiline: T::Boolean, indent: String)
|
72
72
|
.returns(String)
|
73
|
+
.checked(:never)
|
73
74
|
end
|
74
75
|
private def inspect_prop_value(instance, prop, multiline:, indent:)
|
75
76
|
val = T.unsafe(self).get(instance, prop)
|