steep 0.1.0.pre → 0.1.0.pre2
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/README.md +72 -51
- data/bin/smoke_runner.rb +6 -2
- data/lib/steep/cli.rb +4 -4
- data/lib/steep/drivers/check.rb +4 -0
- data/lib/steep/interface.rb +11 -4
- data/lib/steep/parser.y +23 -5
- data/lib/steep/signature/class.rb +118 -26
- data/lib/steep/signature/errors.rb +28 -0
- data/lib/steep/signature/interface.rb +2 -1
- data/lib/steep/type_assignability.rb +13 -8
- data/lib/steep/type_construction.rb +41 -6
- data/lib/steep/type_name.rb +31 -1
- data/lib/steep/types/name.rb +2 -2
- data/lib/steep/version.rb +1 -1
- data/sig/signature.rbi +92 -0
- data/smoke/array/b.rb +16 -0
- data/smoke/class/a.rbi +15 -0
- data/smoke/class/d.rb +9 -0
- data/smoke/class/e.rb +12 -0
- data/smoke/class/f.rb +8 -0
- data/smoke/enumerator/a.rb +19 -0
- data/smoke/initialize/a.rb +12 -0
- data/smoke/initialize/a.rbi +3 -0
- data/smoke/module/a.rb +1 -1
- data/smoke/module/c.rb +23 -0
- data/stdlib/builtin.rbi +19 -4
- data/steep.gemspec +2 -0
- metadata +12 -4
data/smoke/class/d.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# @type const A: A.class
|
2
|
+
# @type const B: A.class constructor
|
3
|
+
# @type const C: A.class noconstructor
|
4
|
+
|
5
|
+
# !expects NoMethodError: type=A.module, method=new
|
6
|
+
a = A.new
|
7
|
+
b = B.new
|
8
|
+
# !expects NoMethodError: type=A.module noconstructor, method=new
|
9
|
+
c = C.new
|
data/smoke/class/e.rb
ADDED
data/smoke/class/f.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# @type var hash: Hash<Symbol, String>
|
2
|
+
|
3
|
+
a = [1]
|
4
|
+
|
5
|
+
# !expects IncompatibleAssignment: lhs_type=Hash<Symbol, String>, rhs_type=String
|
6
|
+
hash = a.each.with_object("") do |x, y|
|
7
|
+
# !expects IncompatibleAssignment: lhs_type=Hash<Symbol, String>, rhs_type=Integer
|
8
|
+
hash = x
|
9
|
+
# !expects IncompatibleAssignment: lhs_type=Hash<Symbol, String>, rhs_type=String
|
10
|
+
hash = y
|
11
|
+
end
|
12
|
+
|
13
|
+
# !expects IncompatibleAssignment: lhs_type=Hash<Symbol, String>, rhs_type=Array<Integer>
|
14
|
+
hash = a.each.with_index do |x, y|
|
15
|
+
# !expects IncompatibleAssignment: lhs_type=Hash<Symbol, String>, rhs_type=Integer
|
16
|
+
hash = x
|
17
|
+
# !expects IncompatibleAssignment: lhs_type=Hash<Symbol, String>, rhs_type=Integer
|
18
|
+
hash = y
|
19
|
+
end
|
data/smoke/module/a.rb
CHANGED
data/smoke/module/c.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module A
|
2
|
+
# @implements A
|
3
|
+
|
4
|
+
def count
|
5
|
+
if block_given?
|
6
|
+
n = 0
|
7
|
+
|
8
|
+
each do |_|
|
9
|
+
n = n + 1
|
10
|
+
end
|
11
|
+
|
12
|
+
n
|
13
|
+
else
|
14
|
+
0
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# ok
|
19
|
+
block_given?
|
20
|
+
|
21
|
+
# !expects NoMethodError: type=Module + A.module, method=no_such_method_in_module
|
22
|
+
no_such_method_in_module
|
23
|
+
end
|
data/stdlib/builtin.rbi
CHANGED
@@ -14,6 +14,7 @@ class Object <: BasicObject
|
|
14
14
|
def class: -> class
|
15
15
|
def to_i: -> Integer
|
16
16
|
def is_a?: (Module) -> _Boolean
|
17
|
+
def inspect: -> String
|
17
18
|
end
|
18
19
|
|
19
20
|
class Module
|
@@ -23,13 +24,19 @@ class Module
|
|
23
24
|
end
|
24
25
|
|
25
26
|
class Class<'instance> <: Module
|
26
|
-
def new: -> 'instance
|
27
27
|
def allocate: -> 'instance
|
28
|
+
def tap: { (any) -> any } -> any
|
29
|
+
def class: -> any
|
28
30
|
end
|
29
31
|
|
30
32
|
module Kernel
|
31
33
|
def raise: () -> any
|
32
34
|
| (String) -> any
|
35
|
+
|
36
|
+
def block_given?: -> _Boolean
|
37
|
+
def include: (Module) -> _Boolean
|
38
|
+
def prepend: (Module) -> _Boolean
|
39
|
+
def enum_for: (Symbol, *any) -> any
|
33
40
|
end
|
34
41
|
|
35
42
|
class Array<'a>
|
@@ -41,8 +48,9 @@ class Array<'a>
|
|
41
48
|
def join: (any) -> String
|
42
49
|
def all?: { (any) -> any } -> _Boolean
|
43
50
|
def sort_by: { ('a) -> any } -> Array<'a>
|
44
|
-
def zip: <'b> (Array<'b>) -> Array<
|
51
|
+
def zip: <'b> (Array<'b>) -> Array<any>
|
45
52
|
def each: { ('a) -> any } -> instance
|
53
|
+
| -> Enumerator<'a, instance>
|
46
54
|
def select: { ('a) -> any } -> Array<'a>
|
47
55
|
def <<: ('a) -> instance
|
48
56
|
def filter: { ('a) -> any } -> Array<'a>
|
@@ -50,9 +58,11 @@ end
|
|
50
58
|
|
51
59
|
class Hash<'key, 'value>
|
52
60
|
def []: ('key) -> 'value
|
61
|
+
def []=: ('key, 'value) -> 'value
|
53
62
|
def size: -> Integer
|
54
63
|
def transform_values: <'a> { ('value) -> 'a } -> Hash<'key, 'a>
|
55
|
-
|
64
|
+
def each_key: { ('key) -> any } -> instance
|
65
|
+
| -> Enumerator<'a, instance>
|
56
66
|
def self.[]: (Array<any>) -> Hash<'key, 'value>
|
57
67
|
end
|
58
68
|
|
@@ -71,7 +81,7 @@ end
|
|
71
81
|
|
72
82
|
class Integer <: Numeric
|
73
83
|
def to_int: -> Integer
|
74
|
-
def +: (
|
84
|
+
def +: (Numeric) -> Integer
|
75
85
|
| (Numeric) -> Numeric
|
76
86
|
def ^: (Numeric) -> Integer
|
77
87
|
end
|
@@ -87,3 +97,8 @@ class String
|
|
87
97
|
def to_str: -> String
|
88
98
|
def size: -> Integer
|
89
99
|
end
|
100
|
+
|
101
|
+
class Enumerator<'a, 'this>
|
102
|
+
def with_object: <'b> ('b) { ('a, 'b) -> any } -> 'b
|
103
|
+
def with_index: { ('a, Integer) -> any } -> 'this
|
104
|
+
end
|
data/steep.gemspec
CHANGED
@@ -21,6 +21,8 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
+
spec.required_ruby_version = '>= 2.4.0'
|
25
|
+
|
24
26
|
spec.add_development_dependency "bundler", "~> 1.13"
|
25
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
28
|
spec.add_development_dependency "minitest", "~> 5.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: steep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- sig/types.rbi
|
157
157
|
- smoke/and/a.rb
|
158
158
|
- smoke/array/a.rb
|
159
|
+
- smoke/array/b.rb
|
159
160
|
- smoke/block/a.rb
|
160
161
|
- smoke/block/a.rbi
|
161
162
|
- smoke/case/a.rb
|
@@ -163,8 +164,12 @@ files:
|
|
163
164
|
- smoke/class/a.rbi
|
164
165
|
- smoke/class/b.rb
|
165
166
|
- smoke/class/c.rb
|
167
|
+
- smoke/class/d.rb
|
168
|
+
- smoke/class/e.rb
|
169
|
+
- smoke/class/f.rb
|
166
170
|
- smoke/const/a.rb
|
167
171
|
- smoke/dstr/a.rb
|
172
|
+
- smoke/enumerator/a.rb
|
168
173
|
- smoke/extension/a.rb
|
169
174
|
- smoke/extension/a.rbi
|
170
175
|
- smoke/extension/b.rb
|
@@ -174,6 +179,8 @@ files:
|
|
174
179
|
- smoke/if/a.rb
|
175
180
|
- smoke/implements/a.rb
|
176
181
|
- smoke/implements/a.rbi
|
182
|
+
- smoke/initialize/a.rb
|
183
|
+
- smoke/initialize/a.rbi
|
177
184
|
- smoke/literal/a.rb
|
178
185
|
- smoke/map/a.rb
|
179
186
|
- smoke/method/a.rb
|
@@ -181,6 +188,7 @@ files:
|
|
181
188
|
- smoke/module/a.rb
|
182
189
|
- smoke/module/a.rbi
|
183
190
|
- smoke/module/b.rb
|
191
|
+
- smoke/module/c.rb
|
184
192
|
- smoke/self/a.rb
|
185
193
|
- smoke/self/a.rbi
|
186
194
|
- smoke/super/a.rb
|
@@ -199,7 +207,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
207
|
requirements:
|
200
208
|
- - ">="
|
201
209
|
- !ruby/object:Gem::Version
|
202
|
-
version:
|
210
|
+
version: 2.4.0
|
203
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
212
|
requirements:
|
205
213
|
- - ">"
|
@@ -207,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
215
|
version: 1.3.1
|
208
216
|
requirements: []
|
209
217
|
rubyforge_project:
|
210
|
-
rubygems_version: 2.6.
|
218
|
+
rubygems_version: 2.6.13
|
211
219
|
signing_key:
|
212
220
|
specification_version: 4
|
213
221
|
summary: Gradual Typing for Ruby
|