sorbet-runtime 0.4.4858 → 0.4.4865
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/sorbet-runtime.rb +1 -0
- data/lib/types/_types.rb +5 -0
- data/lib/types/types/attached_class.rb +33 -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: 94a18cf9e2e1f9f37174616403474310fed12cf369517e901f7769a231cfab38
|
4
|
+
data.tar.gz: 70b8cf1a76942f9a4371370dfb92cba1f08c72022cce060bd217cab5c9af502c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2854f99897e4859cc5fdfe3d27bc7f93038096be1ce63bbdab097fa44e45e98a3ff31e550808a11ea41f6e4e71a576b3bc2c6e9188645bbd081e9e7181f07b7b
|
7
|
+
data.tar.gz: bb1ee9d0eb130e64274a8b6c831fd573998df9a7f77f8c1541287cd02f738233a726cf196bbc2819dc36ac7d2eed4bd97ab986e14700dd35bbb821e48bffec37
|
data/lib/sorbet-runtime.rb
CHANGED
@@ -42,6 +42,7 @@ require_relative 'types/types/fixed_hash'
|
|
42
42
|
require_relative 'types/types/intersection'
|
43
43
|
require_relative 'types/types/noreturn'
|
44
44
|
require_relative 'types/types/proc'
|
45
|
+
require_relative 'types/types/attached_class'
|
45
46
|
require_relative 'types/types/self_type'
|
46
47
|
require_relative 'types/types/simple'
|
47
48
|
require_relative 'types/types/opus_enum'
|
data/lib/types/_types.rb
CHANGED
@@ -65,6 +65,11 @@ module T
|
|
65
65
|
T::Types::SelfType.new
|
66
66
|
end
|
67
67
|
|
68
|
+
# Matches the instance type in a singleton-class context
|
69
|
+
def self.experimental_attached_class
|
70
|
+
T::Types::AttachedClassType.new
|
71
|
+
end
|
72
|
+
|
68
73
|
# Matches any class that subclasses or includes the provided class
|
69
74
|
# or module
|
70
75
|
def self.class_of(klass)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# typed: true
|
3
|
+
|
4
|
+
module T::Types
|
5
|
+
# Modeling AttachedClass properly at runtime would require additional
|
6
|
+
# tracking, so at runtime we permit all values and rely on the static checker.
|
7
|
+
# As AttachedClass is modeled statically as a type member on every singleton
|
8
|
+
# class, this is consistent with the runtime behavior for all type members.
|
9
|
+
class AttachedClassType < Base
|
10
|
+
|
11
|
+
def initialize(); end
|
12
|
+
|
13
|
+
# @override Base
|
14
|
+
def name
|
15
|
+
"AttachedClass"
|
16
|
+
end
|
17
|
+
|
18
|
+
# @override Base
|
19
|
+
def valid?(obj)
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
# @override Base
|
24
|
+
private def subtype_of_single?(other)
|
25
|
+
case other
|
26
|
+
when AttachedClassType
|
27
|
+
true
|
28
|
+
else
|
29
|
+
false
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
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.4.
|
4
|
+
version: 0.4.4865
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- lib/types/runtime_profiled.rb
|
118
118
|
- lib/types/sig.rb
|
119
119
|
- lib/types/struct.rb
|
120
|
+
- lib/types/types/attached_class.rb
|
120
121
|
- lib/types/types/base.rb
|
121
122
|
- lib/types/types/class_of.rb
|
122
123
|
- lib/types/types/enum.rb
|