steep 1.0.0 → 1.1.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-windows.yml +34 -0
  3. data/.github/workflows/ruby.yml +7 -2
  4. data/.gitignore +1 -0
  5. data/CHANGELOG.md +59 -0
  6. data/Gemfile +7 -4
  7. data/Gemfile.lock +17 -21
  8. data/Gemfile.steep +3 -0
  9. data/Gemfile.steep.lock +49 -0
  10. data/Rakefile +5 -0
  11. data/Steepfile +6 -1
  12. data/bin/setup +2 -0
  13. data/bin/steep +19 -0
  14. data/lib/steep/ast/builtin.rb +2 -2
  15. data/lib/steep/ast/types/factory.rb +7 -3
  16. data/lib/steep/ast/types/proc.rb +2 -0
  17. data/lib/steep/cli.rb +3 -1
  18. data/lib/steep/diagnostic/ruby.rb +50 -4
  19. data/lib/steep/diagnostic/signature.rb +18 -0
  20. data/lib/steep/drivers/check.rb +3 -3
  21. data/lib/steep/drivers/watch.rb +3 -1
  22. data/lib/steep/method_name.rb +9 -3
  23. data/lib/steep/node_helper.rb +49 -0
  24. data/lib/steep/path_helper.rb +22 -0
  25. data/lib/steep/project.rb +3 -15
  26. data/lib/steep/server/base_worker.rb +1 -0
  27. data/lib/steep/server/change_buffer.rb +1 -1
  28. data/lib/steep/server/interaction_worker.rb +3 -5
  29. data/lib/steep/server/master.rb +61 -45
  30. data/lib/steep/server/type_check_worker.rb +10 -25
  31. data/lib/steep/services/completion_provider.rb +25 -18
  32. data/lib/steep/services/goto_service.rb +2 -4
  33. data/lib/steep/services/hover_provider/rbs.rb +1 -1
  34. data/lib/steep/services/hover_provider/ruby.rb +30 -12
  35. data/lib/steep/services/stats_calculator.rb +0 -1
  36. data/lib/steep/services/type_check_service.rb +15 -12
  37. data/lib/steep/shims/symbol_start_with.rb +18 -0
  38. data/lib/steep/signature/validator.rb +25 -1
  39. data/lib/steep/source.rb +1 -1
  40. data/lib/steep/subtyping/check.rb +0 -3
  41. data/lib/steep/subtyping/constraints.rb +43 -14
  42. data/lib/steep/type_construction.rb +721 -764
  43. data/lib/steep/type_inference/constant_env.rb +0 -2
  44. data/lib/steep/type_inference/context.rb +23 -17
  45. data/lib/steep/type_inference/logic_type_interpreter.rb +210 -117
  46. data/lib/steep/type_inference/method_call.rb +80 -6
  47. data/lib/steep/type_inference/multiple_assignment.rb +189 -0
  48. data/lib/steep/type_inference/send_args.rb +1 -2
  49. data/lib/steep/type_inference/type_env.rb +273 -116
  50. data/lib/steep/type_inference/type_env_builder.rb +138 -0
  51. data/lib/steep/typing.rb +2 -0
  52. data/lib/steep/version.rb +1 -1
  53. data/lib/steep.rb +7 -5
  54. data/rbs_collection.steep.lock.yaml +112 -0
  55. data/rbs_collection.steep.yaml +19 -0
  56. data/sample/sig/conference.rbs +8 -0
  57. data/sig/shims/parser/source/map.rbs +146 -0
  58. data/sig/shims/parser/source/range.rbs +237 -0
  59. data/sig/shims/parser.rbs +17 -0
  60. data/sig/steep/ast/annotation/collection.rbs +75 -0
  61. data/sig/steep/ast/annotation.rbs +126 -0
  62. data/sig/steep/ast/builtin.rbs +69 -0
  63. data/sig/steep/ast/type_params.rbs +11 -0
  64. data/sig/steep/ast/types/any.rbs +29 -0
  65. data/sig/steep/ast/types/boolean.rbs +31 -0
  66. data/sig/steep/ast/types/bot.rbs +29 -0
  67. data/sig/steep/ast/types/class.rbs +29 -0
  68. data/sig/steep/ast/types/factory.rbs +76 -0
  69. data/sig/steep/ast/types/helper.rbs +19 -0
  70. data/sig/steep/ast/types/instance.rbs +29 -0
  71. data/sig/steep/ast/types/intersection.rbs +35 -0
  72. data/sig/steep/ast/types/literal.rbs +33 -0
  73. data/sig/steep/ast/types/logic.rbs +78 -0
  74. data/sig/steep/ast/types/name.rbs +71 -0
  75. data/sig/steep/ast/types/nil.rbs +31 -0
  76. data/sig/steep/ast/types/proc.rbs +46 -0
  77. data/sig/steep/ast/types/record.rbs +38 -0
  78. data/sig/steep/ast/types/self.rbs +29 -0
  79. data/sig/steep/ast/types/top.rbs +29 -0
  80. data/sig/steep/ast/types/tuple.rbs +34 -0
  81. data/sig/steep/ast/types/union.rbs +38 -0
  82. data/sig/steep/ast/types/var.rbs +37 -0
  83. data/sig/steep/ast/types/void.rbs +29 -0
  84. data/sig/steep/ast/types.rbs +37 -0
  85. data/sig/steep/diagnostic/deprecated/unknown_constant_assigned.rbs +15 -0
  86. data/sig/steep/diagnostic/helper.rbs +9 -0
  87. data/sig/steep/diagnostic/lsp_formatter.rbs +29 -0
  88. data/sig/steep/diagnostic/ruby.rbs +494 -0
  89. data/sig/steep/diagnostic/signature.rbs +215 -0
  90. data/sig/steep/interface/block.rbs +35 -0
  91. data/sig/steep/interface/function.rbs +253 -0
  92. data/sig/steep/interface/interface.rbs +23 -0
  93. data/sig/steep/interface/method_type.rbs +55 -0
  94. data/sig/steep/interface/substitution.rbs +53 -0
  95. data/sig/steep/interface/type_param.rbs +35 -0
  96. data/sig/steep/method_name.rbs +26 -0
  97. data/sig/steep/module_helper.rbs +7 -0
  98. data/sig/steep/node_helper.rbs +11 -0
  99. data/sig/steep/project/dsl.rbs +94 -0
  100. data/sig/steep/project/options.rbs +15 -0
  101. data/sig/steep/project/pattern.rbs +25 -0
  102. data/sig/steep/project/target.rbs +25 -0
  103. data/sig/steep/project.rbs +19 -0
  104. data/sig/steep/services/completion_provider.rbs +123 -0
  105. data/sig/steep/services/content_change.rbs +35 -0
  106. data/sig/steep/services/file_loader.rbs +13 -0
  107. data/sig/steep/services/goto_service.rbs +45 -0
  108. data/sig/steep/services/hover_provider/rbs.rbs +21 -0
  109. data/sig/steep/services/hover_provider/ruby.rbs +109 -0
  110. data/sig/steep/services/hover_provider/singleton_methods.rbs +11 -0
  111. data/sig/steep/services/path_assignment.rbs +21 -0
  112. data/sig/steep/services/signature_service.rbs +91 -0
  113. data/sig/steep/services/stats_calculator.rbs +17 -0
  114. data/sig/steep/services/type_check_service.rbs +93 -0
  115. data/sig/steep/source.rbs +55 -0
  116. data/sig/steep/subtyping/cache.rbs +17 -0
  117. data/sig/steep/subtyping/check.rbs +93 -0
  118. data/sig/steep/subtyping/constraints.rbs +111 -0
  119. data/sig/steep/subtyping/relation.rbs +51 -0
  120. data/sig/steep/subtyping/result.rbs +157 -0
  121. data/sig/steep/subtyping/variable_variance.rbs +23 -0
  122. data/sig/steep/type_construction.rbs +285 -0
  123. data/sig/steep/type_inference/block_params.rbs +52 -0
  124. data/sig/steep/type_inference/constant_env.rbs +27 -0
  125. data/sig/steep/type_inference/context.rbs +137 -0
  126. data/sig/steep/type_inference/logic_type_interpreter.rbs +72 -0
  127. data/sig/steep/type_inference/method_call.rbs +124 -0
  128. data/sig/steep/type_inference/method_params.rbs +104 -0
  129. data/sig/steep/type_inference/multiple_assignment.rbs +76 -0
  130. data/sig/steep/type_inference/type_env.rbs +158 -0
  131. data/sig/steep/type_inference/type_env_builder.rbs +77 -0
  132. data/sig/steep/typing.rbs +68 -0
  133. data/sig/steep.rbs +31 -0
  134. data/smoke/class/f.rb +1 -0
  135. data/smoke/class/test_expectations.yml +2 -2
  136. data/smoke/diagnostics/test_expectations.yml +4 -2
  137. data/smoke/regression/lambda.rb +3 -0
  138. data/smoke/regression/test_expectations.yml +12 -0
  139. data/steep.gemspec +1 -1
  140. metadata +95 -9
  141. data/lib/steep/subtyping/variable_occurrence.rb +0 -51
  142. data/lib/steep/type_inference/local_variable_type_env.rb +0 -249
  143. data/lib/steep/type_inference/logic.rb +0 -161
@@ -0,0 +1,93 @@
1
+ module Steep
2
+ module Services
3
+ class TypeCheckService
4
+ attr_reader project: untyped
5
+
6
+ attr_reader signature_validation_diagnostics: untyped
7
+
8
+ attr_reader source_files: untyped
9
+
10
+ attr_reader signature_services: untyped
11
+
12
+ class SourceFile
13
+ attr_reader path: untyped
14
+
15
+ attr_reader target: untyped
16
+
17
+ attr_reader content: untyped
18
+
19
+ attr_reader node: untyped
20
+
21
+ attr_reader typing: untyped
22
+
23
+ attr_reader errors: untyped
24
+
25
+ def initialize: (path: untyped, node: untyped, content: untyped, typing: untyped, errors: untyped) -> void
26
+
27
+ def self.with_syntax_error: (path: untyped, content: untyped, error: untyped) -> untyped
28
+
29
+ def self.with_typing: (path: untyped, content: untyped, typing: untyped, node: untyped) -> untyped
30
+
31
+ def self.no_data: (path: untyped, content: untyped) -> untyped
32
+
33
+ def update_content: (untyped content) -> untyped
34
+
35
+ def diagnostics: () -> untyped
36
+ end
37
+
38
+ class TargetRequest
39
+ attr_reader target: untyped
40
+
41
+ attr_reader source_paths: untyped
42
+
43
+ def initialize: (target: untyped) -> void
44
+
45
+ def signature_updated!: (?bool value) -> self
46
+
47
+ def signature_updated?: () -> untyped
48
+
49
+ def empty?: () -> untyped
50
+
51
+ def ==: (untyped other) -> untyped
52
+
53
+ alias eql? ==
54
+
55
+ def hash: () -> untyped
56
+ end
57
+
58
+ def initialize: (project: untyped) -> void
59
+
60
+ def signature_diagnostics: () -> untyped
61
+
62
+ def has_diagnostics?: () -> untyped
63
+
64
+ def diagnostics: () -> untyped
65
+
66
+ def each_diagnostics: () { (untyped) -> untyped } -> untyped
67
+
68
+ def update: (changes: untyped) -> untyped
69
+
70
+ def update_and_check: (changes: untyped, assignment: untyped) ?{ () -> untyped } -> untyped
71
+
72
+ def validate_signature: (path: untyped) { (untyped) -> untyped } -> untyped
73
+
74
+ def typecheck_source: (path: untyped, ?target: untyped) { (untyped) -> untyped } -> (nil | untyped)
75
+
76
+ def update_signature: (changes: untyped, requests: untyped) -> untyped
77
+
78
+ def update_sources: (changes: untyped, requests: untyped) -> untyped
79
+
80
+ def type_check_file: (target: untyped, subtyping: untyped, path: untyped, text: untyped) -> untyped
81
+
82
+ def self.type_check: (source: Source, subtyping: Subtyping::Check) -> Typing
83
+
84
+ def source_file?: (Pathname path) -> (untyped | nil)
85
+
86
+ def signature_file?: (Pathname path) -> untyped
87
+
88
+ def app_signature_file?: (Pathname path) -> untyped
89
+
90
+ def lib_signature_file?: (Pathname path) -> untyped
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,55 @@
1
+ module Steep
2
+ class Source
3
+ class LocatedAnnotation
4
+ attr_reader line: untyped
5
+
6
+ attr_reader annotation: untyped
7
+
8
+ attr_reader source: untyped
9
+
10
+ def initialize: (line: untyped, source: untyped, annotation: untyped) -> void
11
+
12
+ def ==: (untyped other) -> untyped
13
+ end
14
+
15
+ attr_reader path: untyped
16
+
17
+ attr_reader node: untyped
18
+
19
+ attr_reader mapping: untyped
20
+
21
+ def initialize: (path: untyped, node: untyped, mapping: untyped) -> void
22
+
23
+ class Builder
24
+ def string_value: (untyped token) -> untyped
25
+ end
26
+
27
+ def self.new_parser: () -> untyped
28
+
29
+ def self.parse: (untyped source_code, path: untyped, factory: untyped) -> untyped
30
+
31
+ def self.construct_mapping: (node: untyped, annotations: untyped, mapping: untyped, ?line_range: untyped?) -> untyped
32
+
33
+ def self.each_child_node: (untyped node) { (untyped) -> untyped } -> untyped
34
+
35
+ def self.map_child_nodes: (untyped node) { (untyped) -> untyped } -> untyped
36
+
37
+ def annotations: (block: Parser::AST::Node, factory: AST::Types::Factory, context: RBS::Resolver::context) -> AST::Annotation::Collection
38
+
39
+ def each_annotation: () { (untyped, untyped) -> untyped } -> untyped
40
+
41
+ def each_heredoc_node: (?untyped node, ?untyped parents) { (untyped) -> untyped } -> untyped
42
+
43
+ def find_heredoc_nodes: (untyped line, untyped column, untyped position) -> (untyped | nil)
44
+
45
+ def find_nodes_loc: (untyped node, untyped position, untyped parents) -> untyped
46
+
47
+ def find_nodes: (line: Integer, column: Integer) -> ::Array[Parser::AST::Node]?
48
+
49
+ def self.delete_defs: (untyped node, untyped allow_list) -> untyped
50
+
51
+ def without_unrelated_defs: (line: untyped, column: untyped) -> (untyped | self)
52
+
53
+ def compact_siblings: (untyped node) -> untyped
54
+ end
55
+ end
@@ -0,0 +1,17 @@
1
+ module Steep
2
+ module Subtyping
3
+ class Cache
4
+ attr_reader subtypes: untyped
5
+
6
+ def initialize: () -> void
7
+
8
+ def subtype: (untyped relation, untyped self_type, untyped instance_type, untyped class_type, untyped bounds) -> untyped
9
+
10
+ def []: (untyped relation, untyped self_type, untyped instance_type, untyped class_type, untyped bounds) -> untyped
11
+
12
+ def []=: (untyped relation, untyped self_type, untyped instance_type, untyped class_type, untyped bounds, untyped value) -> untyped
13
+
14
+ def no_subtype_cache?: () -> untyped
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,93 @@
1
+ module Steep
2
+ module Subtyping
3
+ class Check
4
+ attr_reader factory: AST::Types::Factory
5
+
6
+ attr_reader cache: untyped
7
+
8
+ attr_reader assumptions: untyped
9
+
10
+ def initialize: (factory: untyped) -> void
11
+
12
+ def with_context: (self_type: untyped, instance_type: untyped, class_type: untyped, constraints: untyped) { () -> untyped } -> untyped
13
+
14
+ def push_assumption: (untyped relation) { () -> untyped } -> untyped
15
+
16
+ def push_variable_bounds: (untyped params) { () -> untyped } -> untyped
17
+
18
+ def variable_upper_bound: (untyped name) -> (untyped | nil)
19
+
20
+ def self_type: () -> untyped
21
+
22
+ def instance_type: () -> untyped
23
+
24
+ def class_type: () -> untyped
25
+
26
+ def constraints: () -> untyped
27
+
28
+ def each_ancestor: (untyped ancestors) { (untyped) -> untyped } -> untyped
29
+
30
+ def instance_super_types: (untyped type_name, args: untyped) -> untyped
31
+
32
+ def singleton_super_types: (untyped type_name) -> untyped
33
+
34
+ def check: (untyped relation, constraints: untyped, self_type: untyped, instance_type: untyped, class_type: untyped) -> untyped
35
+
36
+ def check_type: (untyped relation) -> untyped
37
+
38
+ def cache_bounds: (untyped relation) -> untyped
39
+
40
+ def alias?: (untyped `type`) -> untyped
41
+
42
+ def cacheable?: (untyped relation) -> untyped
43
+
44
+ def true_type?: (untyped `type`) -> untyped
45
+
46
+ def false_type?: (untyped `type`) -> untyped
47
+
48
+ include Result::Helper
49
+
50
+ def check_type0: (untyped relation) -> untyped
51
+
52
+ def definition_for_type: (untyped `type`) -> untyped
53
+
54
+ def arg_type?: (untyped `type`) -> untyped
55
+
56
+ def check_type_arg: (untyped relation) -> untyped
57
+
58
+ def same_type?: (untyped relation) -> (true | untyped)
59
+
60
+ def check_interface: (untyped relation) -> untyped
61
+
62
+ def check_method: (untyped name, untyped relation) -> untyped
63
+
64
+ def check_type_application: (untyped result, untyped type_params, untyped type_args) { () -> untyped } -> untyped
65
+
66
+ def check_generic_method_type: (untyped name, untyped relation) -> untyped
67
+
68
+ def check_constraints: (untyped relation, variables: untyped, variance: untyped) -> untyped
69
+
70
+ def check_method_type: (untyped name, untyped relation) -> untyped
71
+
72
+ def check_block_given: (untyped name, untyped relation) { () -> untyped } -> untyped
73
+
74
+ def check_function: (untyped name, untyped relation) -> untyped
75
+
76
+ def check_method_params: (untyped name, untyped relation) -> untyped
77
+
78
+ # ```rbs
79
+ # (Symbol, Relation[MethodType]) -> (Array[[Symbol, Symbol]] | Result::t)
80
+ # [A] (Symbol, Relation[MethodType]) { (Array[[Symbol, Symbol]]) -> A } -> (A | Result::t)
81
+ # ````
82
+ def match_method_type: (untyped name, untyped relation) { (untyped) -> untyped } -> untyped
83
+
84
+ def match_params: (untyped name, untyped relation) -> untyped
85
+
86
+ def expand_alias: (untyped `type`) { () -> untyped } -> untyped
87
+
88
+ # Returns the shortest type paths for one of the _unknown_ type variables.
89
+ # Returns nil if there is no path.
90
+ def hole_path: (untyped `type`, ?untyped path) -> untyped
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,111 @@
1
+ module Steep
2
+ module Subtyping
3
+ class Constraints
4
+ class UnsatisfiedInvariantError < StandardError
5
+ attr_reader constraints: untyped
6
+
7
+ attr_reader reason: untyped
8
+
9
+ def initialize: (reason: untyped, constraints: untyped) -> void
10
+
11
+ class VariablesUnknownsNotDisjoint
12
+ attr_reader vars: untyped
13
+
14
+ def initialize: (vars: untyped) -> void
15
+
16
+ def message: () -> ::String
17
+ end
18
+
19
+ class VariablesFreeVariablesNotDisjoint
20
+ attr_reader var: untyped
21
+
22
+ attr_reader lower_bound: untyped
23
+
24
+ attr_reader upper_bound: untyped
25
+
26
+ def initialize: (?var: untyped?, ?lower_bound: untyped?, ?upper_bound: untyped?) -> void
27
+
28
+ def message: () -> ::String
29
+ end
30
+
31
+ class UnknownsFreeVariableNotDisjoint
32
+ attr_reader var: untyped
33
+
34
+ attr_reader upper_bound: untyped
35
+
36
+ attr_reader lower_bound: untyped
37
+
38
+ def initialize: (var: untyped, lower_bound: untyped, upper_bound: untyped) -> void
39
+
40
+ def message: () -> ::String
41
+ end
42
+ end
43
+
44
+ class UnsatisfiableConstraint < StandardError
45
+ attr_reader var: untyped
46
+
47
+ attr_reader sub_type: untyped
48
+
49
+ attr_reader super_type: untyped
50
+
51
+ attr_reader result: untyped
52
+
53
+ def initialize: (var: untyped, sub_type: untyped, super_type: untyped, result: untyped) -> void
54
+ end
55
+
56
+ class Context
57
+ attr_reader variance: untyped
58
+
59
+ attr_reader self_type: AST::Types::t
60
+
61
+ attr_reader instance_type: AST::Types::t
62
+
63
+ attr_reader class_type: AST::Types::t
64
+
65
+ def initialize: (variance: untyped, self_type: AST::Types::t, instance_type: AST::Types::t, class_type: AST::Types::t) -> void
66
+ end
67
+
68
+ attr_reader dictionary: Hash[Symbol, [Set[AST::Types::t], Set[AST::Types::t], Set[AST::Types::t]]]
69
+
70
+ attr_reader vars: Set[Symbol]
71
+
72
+ def initialize: (unknowns: _Each[Symbol]) -> void
73
+
74
+ def self.empty: () -> Constraints
75
+
76
+ def add_var: (*Symbol vars) -> void
77
+
78
+ def add: (Symbol var, ?sub_type: untyped?, ?super_type: untyped?, ?skip: bool) -> untyped
79
+
80
+ def eliminate_variable: (AST::Types::t `type`, to: AST::Types::t) -> AST::Types::t
81
+
82
+ def unknown?: (Symbol var) -> bool
83
+
84
+ def unknowns: () -> Set[Symbol]
85
+
86
+ def unknown!: (Symbol var) -> void
87
+
88
+ def empty?: () -> bool
89
+
90
+ def upper_bound: (Symbol var, ?skip: bool) -> AST::Types::t
91
+
92
+ def lower_bound: (Symbol var, ?skip: bool) -> AST::Types::t
93
+
94
+ def solution: (Check checker, variables: Enumerable[Symbol], variance: VariableVariance, self_type: AST::Types::t, instance_type: AST::Types::t, class_type: AST::Types::t) -> Interface::Substitution
95
+ | (Check checker, variables: Enumerable[Symbol], context: Context) -> Interface::Substitution
96
+
97
+ def has_constraint?: (Symbol var) -> bool
98
+
99
+ def each: () { ([Symbol, AST::Types::t, AST::Types::t]) -> void } -> void
100
+ | () -> Enumerator[[Symbol, AST::Types::t, AST::Types::t], void]
101
+
102
+ def to_s: () -> ::String
103
+
104
+ private
105
+
106
+ def lower_bound_types: (Symbol var_name) -> Set[AST::Types::t]
107
+
108
+ def upper_bound_types: (Symbol var_name) -> Set[AST::Types::t]
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,51 @@
1
+ module Steep
2
+ module Subtyping
3
+ class Relation
4
+ attr_reader sub_type: untyped
5
+
6
+ attr_reader super_type: untyped
7
+
8
+ def initialize: (sub_type: untyped, super_type: untyped) -> void
9
+
10
+ def hash: () -> untyped
11
+
12
+ def ==: (untyped other) -> untyped
13
+
14
+ alias eql? ==
15
+
16
+ def to_s: () -> ::String
17
+
18
+ def to_ary: () -> ::Array[untyped]
19
+
20
+ def type?: () -> untyped
21
+
22
+ def interface?: () -> untyped
23
+
24
+ def method?: () -> untyped
25
+
26
+ def function?: () -> untyped
27
+
28
+ def params?: () -> untyped
29
+
30
+ def block?: () -> untyped
31
+
32
+ def assert_type: (untyped `type`) -> (untyped | nil)
33
+
34
+ def type!: () -> untyped
35
+
36
+ def interface!: () -> untyped
37
+
38
+ def method!: () -> untyped
39
+
40
+ def function!: () -> untyped
41
+
42
+ def params!: () -> untyped
43
+
44
+ def block!: () -> untyped
45
+
46
+ def map: () { (untyped) -> untyped } -> untyped
47
+
48
+ def flip: () -> untyped
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,157 @@
1
+ module Steep
2
+ module Subtyping
3
+ module Result
4
+ type t = Skip | Expand | All | Any | Success | Failure
5
+
6
+ class Base
7
+ attr_reader relation: Relation
8
+
9
+ def initialize: (Relation relation) -> void
10
+
11
+ def failure?: () -> bool
12
+
13
+ def success?: () -> bool
14
+
15
+ def then: [A] () { (self) -> A } -> A
16
+
17
+ def else: [A] () { (self) -> A } -> A
18
+
19
+ def failure_path: (?untyped path) -> untyped
20
+ end
21
+
22
+ class Skip < Base
23
+ def success?: () -> false
24
+
25
+ def failure?: () -> false
26
+
27
+ def failure_path: (?untyped path) -> untyped
28
+ end
29
+
30
+ class Expand < Base
31
+ attr_reader child: untyped
32
+
33
+ def initialize: (untyped relation) { (untyped) -> untyped } -> void
34
+
35
+ def success?: () -> untyped
36
+
37
+ def failure_path: (?untyped path) -> (untyped | nil)
38
+ end
39
+
40
+ class All < Base
41
+ attr_reader branches: untyped
42
+
43
+ def initialize: (untyped relation) -> void
44
+
45
+ # Returns `false` if no future `#add` changes the result.
46
+ def add: (*untyped relations) { (untyped) -> untyped } -> untyped
47
+
48
+ def success?: () -> untyped
49
+
50
+ def failure?: () -> untyped
51
+
52
+ def failure_path: (?untyped path) -> (untyped | nil)
53
+ end
54
+
55
+ class Any < Base
56
+ attr_reader branches: untyped
57
+
58
+ def initialize: (untyped relation) -> void
59
+
60
+ # Returns `false` if no future `#add` changes the result.
61
+ def add: (*untyped relations) { (untyped) -> untyped } -> untyped
62
+
63
+ def success?: () -> untyped
64
+
65
+ def failure_path: (?untyped path) -> (untyped | nil)
66
+ end
67
+
68
+ class Success < Base
69
+ def success?: () -> true
70
+
71
+ def failure_path: (?untyped path) -> nil
72
+ end
73
+
74
+ class Failure < Base
75
+ class MethodMissingError
76
+ attr_reader name: untyped
77
+
78
+ def initialize: (name: untyped) -> void
79
+
80
+ def message: () -> ::String
81
+ end
82
+
83
+ class BlockMismatchError
84
+ attr_reader name: untyped
85
+
86
+ def initialize: (name: untyped) -> void
87
+
88
+ def message: () -> ::String
89
+ end
90
+
91
+ class ParameterMismatchError
92
+ attr_reader name: untyped
93
+
94
+ def initialize: (name: untyped) -> void
95
+
96
+ def message: () -> ::String
97
+ end
98
+
99
+ class UnknownPairError
100
+ attr_reader relation: untyped
101
+
102
+ def initialize: (relation: untyped) -> void
103
+
104
+ def message: () -> ::String
105
+ end
106
+
107
+ class PolyMethodSubtyping
108
+ attr_reader name: untyped
109
+
110
+ def initialize: (name: untyped) -> void
111
+
112
+ def message: () -> ::String
113
+ end
114
+
115
+ class UnsatisfiedConstraints
116
+ attr_reader error: untyped
117
+
118
+ def initialize: (untyped error) -> void
119
+
120
+ def var: () -> untyped
121
+
122
+ def sub_type: () -> untyped
123
+
124
+ def super_type: () -> untyped
125
+
126
+ def result: () -> untyped
127
+
128
+ def message: () -> ::String
129
+ end
130
+
131
+ attr_reader error: untyped
132
+
133
+ def initialize: (untyped relation, untyped error) -> void
134
+
135
+ def success?: () -> false
136
+
137
+ def failure_path: (?untyped path) -> untyped
138
+ end
139
+
140
+ module Helper
141
+ def Skip: (untyped relation) -> untyped
142
+
143
+ def Expand: (untyped relation) { () -> untyped } -> untyped
144
+
145
+ def All: (untyped relation) { () -> untyped } -> untyped
146
+
147
+ def Any: (untyped relation) { () -> untyped } -> untyped
148
+
149
+ def Success: (untyped relation) -> untyped
150
+
151
+ alias success Success
152
+
153
+ def Failure: (untyped relation, ?untyped? error) { () -> untyped } -> untyped
154
+ end
155
+ end
156
+ end
157
+ end
@@ -0,0 +1,23 @@
1
+ module Steep
2
+ module Subtyping
3
+ class VariableVariance
4
+ attr_reader covariants: untyped
5
+
6
+ attr_reader contravariants: untyped
7
+
8
+ def initialize: (covariants: untyped, contravariants: untyped) -> void
9
+
10
+ def covariant?: (untyped var) -> untyped
11
+
12
+ def contravariant?: (untyped var) -> untyped
13
+
14
+ def invariant?: (untyped var) -> untyped
15
+
16
+ def self.from_method_type: (untyped method_type) -> untyped
17
+
18
+ def self.add_params: (untyped params, block: untyped, covariants: untyped, contravariants: untyped) -> untyped
19
+
20
+ def self.add_type: (untyped `type`, variance: untyped, covariants: untyped, contravariants: untyped) -> untyped
21
+ end
22
+ end
23
+ end