steep 1.3.0.pre.2 → 1.4.0.dev.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby-windows.yml +1 -0
- data/.github/workflows/ruby.yml +1 -5
- data/CHANGELOG.md +6 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +17 -14
- data/Gemfile.steep +2 -2
- data/Gemfile.steep.lock +5 -5
- data/bin/rbs +21 -0
- data/bin/setup +1 -1
- data/lib/steep/ast/types/class.rb +9 -3
- data/lib/steep/ast/types/factory.rb +9 -2
- data/lib/steep/ast/types/instance.rb +8 -3
- data/lib/steep/ast/types/intersection.rb +6 -2
- data/lib/steep/ast/types/literal.rb +1 -1
- data/lib/steep/ast/types/logic.rb +1 -3
- data/lib/steep/ast/types/name.rb +11 -5
- data/lib/steep/ast/types/proc.rb +5 -5
- data/lib/steep/ast/types/record.rb +5 -1
- data/lib/steep/ast/types/self.rb +8 -2
- data/lib/steep/ast/types/tuple.rb +7 -5
- data/lib/steep/ast/types/union.rb +10 -4
- data/lib/steep/ast/types/var.rb +1 -1
- data/lib/steep/index/rbs_index.rb +13 -6
- data/lib/steep/interface/substitution.rb +11 -10
- data/lib/steep/project/dsl.rb +12 -4
- data/lib/steep/project/options.rb +3 -1
- data/lib/steep/signature/validator.rb +13 -13
- data/lib/steep/type_inference/logic_type_interpreter.rb +2 -2
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +0 -1
- data/rbs_collection.steep.lock.yaml +44 -43
- data/sig/steep/ast/builtin.rbs +1 -1
- data/sig/steep/ast/types/any.rbs +5 -5
- data/sig/steep/ast/types/boolean.rbs +6 -6
- data/sig/steep/ast/types/bot.rbs +5 -5
- data/sig/steep/ast/types/class.rbs +7 -6
- data/sig/steep/ast/types/helper.rbs +2 -2
- data/sig/steep/ast/types/instance.rbs +6 -5
- data/sig/steep/ast/types/intersection.rbs +12 -9
- data/sig/steep/ast/types/literal.rbs +6 -4
- data/sig/steep/ast/types/logic.rbs +7 -9
- data/sig/steep/ast/types/name.rbs +7 -3
- data/sig/steep/ast/types/nil.rbs +6 -6
- data/sig/steep/ast/types/proc.rbs +8 -3
- data/sig/steep/ast/types/record.rbs +7 -8
- data/sig/steep/ast/types/self.rbs +7 -6
- data/sig/steep/ast/types/top.rbs +6 -6
- data/sig/steep/ast/types/tuple.rbs +5 -4
- data/sig/steep/ast/types/union.rbs +8 -8
- data/sig/steep/ast/types/var.rbs +16 -11
- data/sig/steep/ast/types/void.rbs +5 -5
- data/sig/steep/ast/types.rbs +5 -26
- data/sig/steep/index/rbs_index.rbs +83 -37
- data/sig/steep/interface/substitution.rbs +9 -9
- data/sig/steep/project/dsl.rbs +35 -30
- data/sig/steep/project/options.rbs +16 -4
- data/smoke/diagnostics-rbs/test_expectations.yml +1 -1
- data/steep.gemspec +3 -2
- metadata +21 -7
- data/lib/steep/ast/types.rb +0 -62
@@ -1,7 +1,9 @@
|
|
1
1
|
module Steep
|
2
2
|
class Project
|
3
3
|
class Options
|
4
|
-
PathOptions = Struct.new(:core_root, :stdlib_root, :repo_paths, keyword_init: true) do
|
4
|
+
PathOptions = _ = Struct.new(:core_root, :stdlib_root, :repo_paths, keyword_init: true) do
|
5
|
+
# @implements PathOptions
|
6
|
+
|
5
7
|
def customized_stdlib?
|
6
8
|
stdlib_root != nil
|
7
9
|
end
|
@@ -270,9 +270,9 @@ module Steep
|
|
270
270
|
mixin_constraints(definition, ancestors.included_modules || raise, immediate_self_types: ancestors.self_types).each do |relation, ancestor|
|
271
271
|
checker.check(
|
272
272
|
relation,
|
273
|
-
self_type: AST::Types::Self.
|
274
|
-
instance_type: AST::Types::Instance.
|
275
|
-
class_type: AST::Types::Class.
|
273
|
+
self_type: AST::Types::Self.instance,
|
274
|
+
instance_type: AST::Types::Instance.instance,
|
275
|
+
class_type: AST::Types::Class.instance,
|
276
276
|
constraints: Subtyping::Constraints.empty
|
277
277
|
).else do
|
278
278
|
raise if ancestor.source.is_a?(Symbol)
|
@@ -314,16 +314,16 @@ module Steep
|
|
314
314
|
relation = Subtyping::Relation.new(sub_type: var_type, super_type: parent_type)
|
315
315
|
result1 = checker.check(
|
316
316
|
relation,
|
317
|
-
self_type: AST::Types::Self.
|
318
|
-
instance_type: AST::Types::Instance.
|
319
|
-
class_type: AST::Types::Class.
|
317
|
+
self_type: AST::Types::Self.instance,
|
318
|
+
instance_type: AST::Types::Instance.instance,
|
319
|
+
class_type: AST::Types::Class.instance,
|
320
320
|
constraints: Subtyping::Constraints.empty
|
321
321
|
)
|
322
322
|
result2 = checker.check(
|
323
323
|
relation.flip,
|
324
|
-
self_type: AST::Types::Self.
|
325
|
-
instance_type: AST::Types::Instance.
|
326
|
-
class_type: AST::Types::Class.
|
324
|
+
self_type: AST::Types::Self.instance,
|
325
|
+
instance_type: AST::Types::Instance.instance,
|
326
|
+
class_type: AST::Types::Class.instance,
|
327
327
|
constraints: Subtyping::Constraints.empty
|
328
328
|
)
|
329
329
|
|
@@ -362,13 +362,13 @@ module Steep
|
|
362
362
|
mixin_constraints(definition, ancestors.extended_modules, immediate_self_types: ancestors.self_types).each do |relation, ancestor|
|
363
363
|
checker.check(
|
364
364
|
relation,
|
365
|
-
self_type: AST::Types::Self.
|
366
|
-
instance_type: AST::Types::Instance.
|
367
|
-
class_type: AST::Types::Class.
|
365
|
+
self_type: AST::Types::Self.instance ,
|
366
|
+
instance_type: AST::Types::Instance.instance,
|
367
|
+
class_type: AST::Types::Class.instance,
|
368
368
|
constraints: Subtyping::Constraints.empty
|
369
369
|
).else do
|
370
370
|
raise if ancestor.source.is_a?(Symbol)
|
371
|
-
|
371
|
+
|
372
372
|
@errors << Diagnostic::Signature::ModuleSelfTypeError.new(
|
373
373
|
name: name,
|
374
374
|
location: ancestor.source&.location || raise,
|
@@ -390,14 +390,14 @@ module Steep
|
|
390
390
|
# 4. none of the above (example: T = String, K = Integer)
|
391
391
|
|
392
392
|
relation = Subtyping::Relation.new(sub_type: type, super_type: instance_type)
|
393
|
-
if subtyping.check(relation, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self.
|
393
|
+
if subtyping.check(relation, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self.instance, instance_type: AST::Types::Instance.instance, class_type: AST::Types::Class.instance).success?
|
394
394
|
# 1 or 2. Satisfies the condition, no narrowing because `type` is already more specific than/equals to `instance_type`
|
395
395
|
[
|
396
396
|
[type],
|
397
397
|
[]
|
398
398
|
]
|
399
399
|
else
|
400
|
-
if subtyping.check(relation.flip, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self.
|
400
|
+
if subtyping.check(relation.flip, constraints: Subtyping::Constraints.empty, self_type: AST::Types::Self.instance, instance_type: AST::Types::Instance.instance, class_type: AST::Types::Class.instance).success?
|
401
401
|
# 3. Satisfied the condition, narrows to `instance_type`, but cannot remove it from *falsy* list
|
402
402
|
[
|
403
403
|
[instance_type],
|
data/lib/steep/version.rb
CHANGED
data/lib/steep.rb
CHANGED
@@ -93,7 +93,6 @@ require "steep/type_inference/type_env_builder"
|
|
93
93
|
require "steep/type_inference/logic_type_interpreter"
|
94
94
|
require "steep/type_inference/multiple_assignment"
|
95
95
|
require "steep/type_inference/method_call"
|
96
|
-
require "steep/ast/types"
|
97
96
|
|
98
97
|
require "steep/index/rbs_index"
|
99
98
|
require "steep/index/signature_symbol_provider"
|
@@ -1,29 +1,18 @@
|
|
1
1
|
---
|
2
2
|
sources:
|
3
|
-
-
|
3
|
+
- type: git
|
4
|
+
name: ruby/gem_rbs_collection
|
5
|
+
revision: 6f9f54a753a78c505e63e7f31a48b3f71f1b510d
|
4
6
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
5
|
-
revision: main
|
6
7
|
repo_dir: gems
|
7
8
|
path: ".gem_rbs_collection"
|
8
9
|
gems:
|
9
|
-
- name: set
|
10
|
-
version: '0'
|
11
|
-
source:
|
12
|
-
type: stdlib
|
13
|
-
- name: rbs
|
14
|
-
version: 2.8.0.pre.1
|
15
|
-
source:
|
16
|
-
type: rubygems
|
17
|
-
- name: dbm
|
18
|
-
version: '0'
|
19
|
-
source:
|
20
|
-
type: stdlib
|
21
10
|
- name: activesupport
|
22
11
|
version: '6.0'
|
23
12
|
source:
|
24
13
|
type: git
|
25
14
|
name: ruby/gem_rbs_collection
|
26
|
-
revision:
|
15
|
+
revision: 6f9f54a753a78c505e63e7f31a48b3f71f1b510d
|
27
16
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
28
17
|
repo_dir: gems
|
29
18
|
- name: ast
|
@@ -31,23 +20,35 @@ gems:
|
|
31
20
|
source:
|
32
21
|
type: git
|
33
22
|
name: ruby/gem_rbs_collection
|
34
|
-
revision:
|
23
|
+
revision: 6f9f54a753a78c505e63e7f31a48b3f71f1b510d
|
35
24
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
36
25
|
repo_dir: gems
|
37
26
|
- name: csv
|
38
27
|
version: '0'
|
39
28
|
source:
|
40
29
|
type: stdlib
|
30
|
+
- name: date
|
31
|
+
version: '0'
|
32
|
+
source:
|
33
|
+
type: stdlib
|
34
|
+
- name: dbm
|
35
|
+
version: '0'
|
36
|
+
source:
|
37
|
+
type: stdlib
|
41
38
|
- name: fileutils
|
42
39
|
version: '0'
|
43
40
|
source:
|
44
41
|
type: stdlib
|
42
|
+
- name: forwardable
|
43
|
+
version: '0'
|
44
|
+
source:
|
45
|
+
type: stdlib
|
45
46
|
- name: i18n
|
46
47
|
version: '1.10'
|
47
48
|
source:
|
48
49
|
type: git
|
49
50
|
name: ruby/gem_rbs_collection
|
50
|
-
revision:
|
51
|
+
revision: 6f9f54a753a78c505e63e7f31a48b3f71f1b510d
|
51
52
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
52
53
|
repo_dir: gems
|
53
54
|
- name: json
|
@@ -59,7 +60,7 @@ gems:
|
|
59
60
|
source:
|
60
61
|
type: git
|
61
62
|
name: ruby/gem_rbs_collection
|
62
|
-
revision:
|
63
|
+
revision: 6f9f54a753a78c505e63e7f31a48b3f71f1b510d
|
63
64
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
64
65
|
repo_dir: gems
|
65
66
|
- name: logger
|
@@ -70,51 +71,51 @@ gems:
|
|
70
71
|
version: '0'
|
71
72
|
source:
|
72
73
|
type: stdlib
|
74
|
+
- name: monitor
|
75
|
+
version: '0'
|
76
|
+
source:
|
77
|
+
type: stdlib
|
78
|
+
- name: mutex_m
|
79
|
+
version: '0'
|
80
|
+
source:
|
81
|
+
type: stdlib
|
82
|
+
- name: optparse
|
83
|
+
version: '0'
|
84
|
+
source:
|
85
|
+
type: stdlib
|
73
86
|
- name: parallel
|
74
87
|
version: '1.20'
|
75
88
|
source:
|
76
89
|
type: git
|
77
90
|
name: ruby/gem_rbs_collection
|
78
|
-
revision:
|
91
|
+
revision: 6f9f54a753a78c505e63e7f31a48b3f71f1b510d
|
79
92
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
80
93
|
repo_dir: gems
|
94
|
+
- name: pathname
|
95
|
+
version: '0'
|
96
|
+
source:
|
97
|
+
type: stdlib
|
81
98
|
- name: rainbow
|
82
99
|
version: '3.0'
|
83
100
|
source:
|
84
101
|
type: git
|
85
102
|
name: ruby/gem_rbs_collection
|
86
|
-
revision:
|
103
|
+
revision: 6f9f54a753a78c505e63e7f31a48b3f71f1b510d
|
87
104
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
88
105
|
repo_dir: gems
|
89
|
-
- name:
|
90
|
-
version:
|
91
|
-
source:
|
92
|
-
type: stdlib
|
93
|
-
- name: strscan
|
94
|
-
version: '0'
|
95
|
-
source:
|
96
|
-
type: stdlib
|
97
|
-
- name: pathname
|
98
|
-
version: '0'
|
99
|
-
source:
|
100
|
-
type: stdlib
|
101
|
-
- name: optparse
|
102
|
-
version: '0'
|
103
|
-
source:
|
104
|
-
type: stdlib
|
105
|
-
- name: tsort
|
106
|
-
version: '0'
|
106
|
+
- name: rbs
|
107
|
+
version: 3.0.0.dev.1
|
107
108
|
source:
|
108
|
-
type:
|
109
|
+
type: rubygems
|
109
110
|
- name: rdoc
|
110
111
|
version: '0'
|
111
112
|
source:
|
112
113
|
type: stdlib
|
113
|
-
- name:
|
114
|
+
- name: securerandom
|
114
115
|
version: '0'
|
115
116
|
source:
|
116
117
|
type: stdlib
|
117
|
-
- name:
|
118
|
+
- name: set
|
118
119
|
version: '0'
|
119
120
|
source:
|
120
121
|
type: stdlib
|
@@ -122,7 +123,7 @@ gems:
|
|
122
123
|
version: '0'
|
123
124
|
source:
|
124
125
|
type: stdlib
|
125
|
-
- name:
|
126
|
+
- name: strscan
|
126
127
|
version: '0'
|
127
128
|
source:
|
128
129
|
type: stdlib
|
@@ -130,7 +131,7 @@ gems:
|
|
130
131
|
version: '0'
|
131
132
|
source:
|
132
133
|
type: stdlib
|
133
|
-
- name:
|
134
|
+
- name: tsort
|
134
135
|
version: '0'
|
135
136
|
source:
|
136
137
|
type: stdlib
|
data/sig/steep/ast/builtin.rbs
CHANGED
data/sig/steep/ast/types/any.rbs
CHANGED
@@ -6,15 +6,15 @@ module Steep
|
|
6
6
|
|
7
7
|
def initialize: (?location: untyped?) -> void
|
8
8
|
|
9
|
-
def ==: (untyped other) ->
|
9
|
+
def ==: (untyped other) -> bool
|
10
10
|
|
11
|
-
def hash: () ->
|
11
|
+
def hash: () -> Integer
|
12
12
|
|
13
13
|
alias eql? ==
|
14
14
|
|
15
|
-
def subst: (
|
15
|
+
def subst: (Interface::Substitution s) -> Any
|
16
16
|
|
17
|
-
def to_s: () ->
|
17
|
+
def to_s: () -> String
|
18
18
|
|
19
19
|
include Helper::NoFreeVariables
|
20
20
|
|
@@ -22,7 +22,7 @@ module Steep
|
|
22
22
|
|
23
23
|
def level: () -> Array[Integer]
|
24
24
|
|
25
|
-
def with_location: (untyped new_location) ->
|
25
|
+
def with_location: (untyped new_location) -> Any
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -6,15 +6,15 @@ module Steep
|
|
6
6
|
|
7
7
|
def initialize: (?location: untyped?) -> void
|
8
8
|
|
9
|
-
def ==: (untyped other) ->
|
9
|
+
def ==: (untyped other) -> bool
|
10
10
|
|
11
|
-
def hash: () ->
|
11
|
+
def hash: () -> Integer
|
12
12
|
|
13
13
|
alias eql? ==
|
14
14
|
|
15
|
-
def subst: (
|
15
|
+
def subst: (Interface::Substitution) -> Boolean
|
16
16
|
|
17
|
-
def to_s: () ->
|
17
|
+
def to_s: () -> String
|
18
18
|
|
19
19
|
include Helper::NoFreeVariables
|
20
20
|
|
@@ -22,9 +22,9 @@ module Steep
|
|
22
22
|
|
23
23
|
def level: () -> Array[Integer]
|
24
24
|
|
25
|
-
def with_location: (untyped new_location) ->
|
25
|
+
def with_location: (untyped new_location) -> Boolean
|
26
26
|
|
27
|
-
def back_type: () ->
|
27
|
+
def back_type: () -> t
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
data/sig/steep/ast/types/bot.rbs
CHANGED
@@ -6,15 +6,15 @@ module Steep
|
|
6
6
|
|
7
7
|
def initialize: (?location: untyped?) -> void
|
8
8
|
|
9
|
-
def ==: (untyped other) ->
|
9
|
+
def ==: (untyped other) -> bool
|
10
10
|
|
11
|
-
def hash: () ->
|
11
|
+
def hash: () -> Integer
|
12
12
|
|
13
13
|
alias eql? ==
|
14
14
|
|
15
|
-
def subst: (
|
15
|
+
def subst: (Interface::Substitution) -> Bot
|
16
16
|
|
17
|
-
def to_s: () ->
|
17
|
+
def to_s: () -> String
|
18
18
|
|
19
19
|
include Helper::NoFreeVariables
|
20
20
|
|
@@ -22,7 +22,7 @@ module Steep
|
|
22
22
|
|
23
23
|
def level: () -> Array[Integer]
|
24
24
|
|
25
|
-
def with_location: (untyped new_location) ->
|
25
|
+
def with_location: (untyped new_location) -> Bot
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -6,23 +6,24 @@ module Steep
|
|
6
6
|
|
7
7
|
def initialize: (?location: untyped?) -> void
|
8
8
|
|
9
|
-
def to_s: () ->
|
9
|
+
def to_s: () -> String
|
10
10
|
|
11
|
-
def ==: (untyped other) ->
|
11
|
+
def ==: (untyped other) -> bool
|
12
12
|
|
13
|
-
def hash: () ->
|
13
|
+
def hash: () -> Integer
|
14
14
|
|
15
15
|
alias eql? ==
|
16
16
|
|
17
|
-
def subst: (
|
17
|
+
def subst: (Interface::Substitution s) -> t
|
18
18
|
|
19
|
-
|
19
|
+
@@fvs: Set[variable]
|
20
|
+
def free_variables: () -> Set[variable]
|
20
21
|
|
21
22
|
include Helper::NoChild
|
22
23
|
|
23
24
|
def level: () -> Array[Integer]
|
24
25
|
|
25
|
-
def with_location: (untyped new_location) ->
|
26
|
+
def with_location: (untyped new_location) -> Class
|
26
27
|
|
27
28
|
self.@instance: Class
|
28
29
|
def self.instance: () -> Class
|
@@ -6,19 +6,20 @@ module Steep
|
|
6
6
|
|
7
7
|
def initialize: (?location: untyped?) -> void
|
8
8
|
|
9
|
-
def ==: (untyped other) ->
|
9
|
+
def ==: (untyped other) -> bool
|
10
10
|
|
11
|
-
def hash: () ->
|
11
|
+
def hash: () -> Integer
|
12
12
|
|
13
13
|
alias eql? ==
|
14
14
|
|
15
|
-
def subst: (
|
15
|
+
def subst: (Interface::Substitution s) -> t
|
16
16
|
|
17
|
-
|
17
|
+
@@fvs: Set[variable]
|
18
|
+
def free_variables: () -> Set[variable]
|
18
19
|
|
19
20
|
include Helper::NoChild
|
20
21
|
|
21
|
-
def to_s: () ->
|
22
|
+
def to_s: () -> String
|
22
23
|
|
23
24
|
def level: () -> Array[Integer]
|
24
25
|
|
@@ -2,33 +2,36 @@ module Steep
|
|
2
2
|
module AST
|
3
3
|
module Types
|
4
4
|
class Intersection
|
5
|
-
attr_reader types:
|
5
|
+
attr_reader types: Array[t]
|
6
6
|
|
7
7
|
attr_reader location: untyped
|
8
8
|
|
9
|
-
def initialize: (types:
|
9
|
+
def initialize: (types: Array[t], ?location: untyped?) -> void
|
10
10
|
|
11
11
|
def self.build: (types: Array[t], ?location: untyped?) -> t
|
12
12
|
|
13
|
-
def ==: (untyped other) ->
|
13
|
+
def ==: (untyped other) -> bool
|
14
14
|
|
15
|
-
|
15
|
+
@hash: Integer
|
16
|
+
def hash: () -> Integer
|
16
17
|
|
17
18
|
alias eql? ==
|
18
19
|
|
19
|
-
def subst: (
|
20
|
+
def subst: (Interface::Substitution s) -> t
|
20
21
|
|
21
|
-
def to_s: () ->
|
22
|
+
def to_s: () -> String
|
22
23
|
|
23
|
-
|
24
|
+
@fvs: Set[variable]
|
25
|
+
def free_variables: () -> Set[variable]
|
24
26
|
|
25
27
|
include Helper::ChildrenLevel
|
26
28
|
|
27
|
-
def each_child: ()
|
29
|
+
def each_child: () { (t) -> void } -> void
|
30
|
+
| () -> Enumerator[t, void]
|
28
31
|
|
29
32
|
def level: () -> Array[Integer]
|
30
33
|
|
31
|
-
def with_location: (untyped new_location) ->
|
34
|
+
def with_location: (untyped new_location) -> Intersection
|
32
35
|
end
|
33
36
|
end
|
34
37
|
end
|
@@ -4,9 +4,11 @@ module Steep
|
|
4
4
|
class Literal
|
5
5
|
attr_reader location: untyped
|
6
6
|
|
7
|
-
|
7
|
+
type value = Integer | String | Symbol | TrueClass | FalseClass
|
8
8
|
|
9
|
-
|
9
|
+
attr_reader value: value
|
10
|
+
|
11
|
+
def initialize: (value: value, ?location: untyped?) -> void
|
10
12
|
|
11
13
|
def ==: (untyped other) -> bool
|
12
14
|
|
@@ -14,7 +16,7 @@ module Steep
|
|
14
16
|
|
15
17
|
alias eql? ==
|
16
18
|
|
17
|
-
def subst: (Interface::Substitution s) ->
|
19
|
+
def subst: (Interface::Substitution s) -> Literal
|
18
20
|
|
19
21
|
def to_s: () -> String
|
20
22
|
|
@@ -24,7 +26,7 @@ module Steep
|
|
24
26
|
|
25
27
|
def level: () -> Array[Integer]
|
26
28
|
|
27
|
-
def with_location: (untyped new_location) ->
|
29
|
+
def with_location: (untyped new_location) -> Literal
|
28
30
|
|
29
31
|
def back_type: () -> AST::Types::Name::Instance
|
30
32
|
end
|
@@ -2,24 +2,22 @@ module Steep
|
|
2
2
|
module AST
|
3
3
|
module Types
|
4
4
|
module Logic
|
5
|
-
type loc = RBS::Location[untyped, untyped]
|
6
|
-
|
7
5
|
class Base
|
8
6
|
attr_reader location: untyped
|
9
7
|
|
10
|
-
def subst: (
|
8
|
+
def subst: (Interface::Substitution s) -> self
|
11
9
|
|
12
|
-
|
10
|
+
include Helper::NoFreeVariables
|
13
11
|
|
14
12
|
include Helper::NoChild
|
15
13
|
|
16
|
-
def hash: () ->
|
14
|
+
def hash: () -> Integer
|
17
15
|
|
18
|
-
def ==: (untyped other) ->
|
16
|
+
def ==: (untyped other) -> bool
|
19
17
|
|
20
18
|
alias eql? ==
|
21
19
|
|
22
|
-
def to_s: () ->
|
20
|
+
def to_s: () -> String
|
23
21
|
|
24
22
|
def level: () -> Array[Integer]
|
25
23
|
end
|
@@ -62,7 +60,7 @@ module Steep
|
|
62
60
|
|
63
61
|
attr_reader type: t
|
64
62
|
|
65
|
-
def initialize: (truthy: TypeInference::TypeEnv, falsy: TypeInference::TypeEnv, type: t, ?location:
|
63
|
+
def initialize: (truthy: TypeInference::TypeEnv, falsy: TypeInference::TypeEnv, type: t, ?location: untyped) -> void
|
66
64
|
|
67
65
|
def ==: (untyped other) -> bool
|
68
66
|
|
@@ -70,7 +68,7 @@ module Steep
|
|
70
68
|
|
71
69
|
def hash: () -> Integer
|
72
70
|
|
73
|
-
def inspect: () ->
|
71
|
+
def inspect: () -> String
|
74
72
|
|
75
73
|
alias to_s inspect
|
76
74
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Steep
|
2
2
|
module AST
|
3
3
|
module Types
|
4
|
+
# Types with names
|
5
|
+
#
|
4
6
|
module Name
|
5
7
|
class Base
|
6
8
|
attr_reader location: untyped
|
@@ -25,15 +27,17 @@ module Steep
|
|
25
27
|
|
26
28
|
alias eql? ==
|
27
29
|
|
30
|
+
@hash: Integer
|
28
31
|
def hash: () -> Integer
|
29
32
|
|
30
33
|
def to_s: () -> ::String
|
31
34
|
|
32
|
-
def with_location: (untyped new_location) ->
|
35
|
+
def with_location: (untyped new_location) -> self
|
33
36
|
|
34
37
|
def subst: (Steep::Interface::Substitution s) -> self
|
35
38
|
|
36
|
-
|
39
|
+
@fvs: Set[variable]
|
40
|
+
def free_variables: () -> Set[variable]
|
37
41
|
|
38
42
|
def each_child: () { (t) -> void } -> void
|
39
43
|
| () -> Enumerator[t, void]
|
@@ -52,7 +56,7 @@ module Steep
|
|
52
56
|
|
53
57
|
def to_s: () -> ::String
|
54
58
|
|
55
|
-
def with_location: (untyped new_location) ->
|
59
|
+
def with_location: (untyped new_location) -> Singleton
|
56
60
|
|
57
61
|
include Helper::NoChild
|
58
62
|
end
|
data/sig/steep/ast/types/nil.rbs
CHANGED
@@ -6,15 +6,15 @@ module Steep
|
|
6
6
|
|
7
7
|
def initialize: (?location: untyped?) -> void
|
8
8
|
|
9
|
-
def ==: (untyped other) ->
|
9
|
+
def ==: (untyped other) -> bool
|
10
10
|
|
11
|
-
def hash: () ->
|
11
|
+
def hash: () -> Integer
|
12
12
|
|
13
13
|
alias eql? ==
|
14
14
|
|
15
|
-
def subst: (
|
15
|
+
def subst: (Interface::Substitution s) -> Nil
|
16
16
|
|
17
|
-
def to_s: () ->
|
17
|
+
def to_s: () -> String
|
18
18
|
|
19
19
|
include Helper::NoFreeVariables
|
20
20
|
|
@@ -22,9 +22,9 @@ module Steep
|
|
22
22
|
|
23
23
|
def level: () -> Array[Integer]
|
24
24
|
|
25
|
-
def with_location: (untyped new_location) ->
|
25
|
+
def with_location: (untyped new_location) -> Nil
|
26
26
|
|
27
|
-
def back_type: () ->
|
27
|
+
def back_type: () -> Name::Instance
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -22,18 +22,23 @@ module Steep
|
|
22
22
|
|
23
23
|
def to_s: () -> ::String
|
24
24
|
|
25
|
-
|
25
|
+
@fvs: Set[variable]
|
26
|
+
def free_variables: () -> Set[variable]
|
26
27
|
|
27
28
|
include Helper::ChildrenLevel
|
28
29
|
|
29
30
|
def level: () -> Array[Integer]
|
30
31
|
|
31
|
-
def closed?: () -> bool
|
32
|
-
|
33
32
|
def with_location: (untyped new_location) -> Proc
|
34
33
|
|
35
34
|
def map_type: () { (AST::Types::t) -> AST::Types::t } -> Proc
|
36
35
|
|
36
|
+
# Returns true if the proc requires exactly one argument
|
37
|
+
#
|
38
|
+
# * One required argument,
|
39
|
+
# * No optional/rest argument, and
|
40
|
+
# * No keywords
|
41
|
+
#
|
37
42
|
def one_arg?: () -> bool
|
38
43
|
|
39
44
|
def back_type: () -> AST::Types::t
|