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,76 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Factory
5
+ attr_reader definition_builder: RBS::DefinitionBuilder
6
+
7
+ attr_reader type_name_cache: untyped
8
+
9
+ attr_reader type_cache: untyped
10
+
11
+ attr_reader type_interface_cache: untyped
12
+
13
+ def inspect: () -> String
14
+
15
+ def initialize: (builder: RBS::DefinitionBuilder) -> void
16
+
17
+ def type_name_resolver: () -> untyped
18
+
19
+ def type_opt: (untyped `type`) -> (untyped | nil)
20
+
21
+ def type: (RBS::Types::t `type`) -> AST::Types::t
22
+
23
+ def type_1: (AST::Types::t `type`) -> RBS::Types::t
24
+
25
+ def function_1: (untyped func) -> untyped
26
+
27
+ def params: (untyped `type`) -> untyped
28
+
29
+ def type_param: (untyped type_param) -> untyped
30
+
31
+ def type_param_1: (untyped type_param) -> untyped
32
+
33
+ def method_type: (RBS::MethodType method_type, self_type: AST::Types::t, method_decls: untyped, ?subst2: Interface::Substitution?) -> Interface::MethodType
34
+ | [A] (RBS::MethodType method_type, self_type: AST::Types::t, method_decls: untyped, ?subst2: Interface::Substitution?) { (Interface::MethodType) -> A } -> A
35
+
36
+ def method_type_1: (untyped method_type, self_type: untyped) { (untyped) -> untyped } -> untyped
37
+
38
+ class InterfaceCalculationError < StandardError
39
+ attr_reader type: untyped
40
+
41
+ def initialize: (type: untyped, message: untyped) -> void
42
+ end
43
+
44
+ def unfold: (RBS::TypeName type_name, Array[t] args) -> t
45
+
46
+ def expand_alias: (t `type`) -> t
47
+ | [A] (t) { (t) -> A } -> A
48
+
49
+ def deep_expand_alias: (t `type`, ?recursive: Set[t]) -> t
50
+ | [A] (t `type`, ?recursive: Set[t]) { (t) -> A }-> A
51
+
52
+ def flatten_union: (untyped `type`, ?untyped acc) -> untyped
53
+
54
+ def unwrap_optional: (Types::t `type`) -> [Types::t, Types::t]
55
+
56
+ NilClassName: untyped
57
+
58
+ def setup_primitives: (untyped method_name, untyped method_def, untyped method_type) -> untyped
59
+
60
+ def interface: (untyped `type`, private: untyped, ?self_type: untyped) -> untyped
61
+
62
+ def module_name?: (untyped type_name) -> untyped
63
+
64
+ def class_name?: (untyped type_name) -> untyped
65
+
66
+ def env: () -> RBS::Environment
67
+
68
+ def absolute_type: (untyped `type`, context: untyped) -> untyped
69
+
70
+ def absolute_type_name: (untyped type_name, context: untyped) -> untyped
71
+
72
+ def instance_type: (RBS::TypeName type_name, ?args: Array[t]?, ?location: untyped?) -> t
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,19 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ module Helper
5
+ module ChildrenLevel
6
+ def level_of_children: (untyped children) -> untyped
7
+ end
8
+
9
+ module NoFreeVariables
10
+ def free_variables: () -> untyped
11
+ end
12
+
13
+ module NoChild
14
+ def each_child: () ?{ () -> untyped } -> (untyped | nil)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,29 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Instance
5
+ attr_reader location: untyped
6
+
7
+ def initialize: (?location: untyped?) -> void
8
+
9
+ def ==: (untyped other) -> untyped
10
+
11
+ def hash: () -> untyped
12
+
13
+ alias eql? ==
14
+
15
+ def subst: (untyped s) -> untyped
16
+
17
+ def free_variables: () -> untyped
18
+
19
+ include Helper::NoChild
20
+
21
+ def to_s: () -> "instance"
22
+
23
+ def level: () -> ::Array[0]
24
+
25
+ def with_location: (untyped new_location) -> untyped
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,35 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Intersection
5
+ attr_reader types: untyped
6
+
7
+ attr_reader location: untyped
8
+
9
+ def initialize: (types: untyped, ?location: untyped?) -> void
10
+
11
+ def self.build: (types: untyped, ?location: untyped?) -> untyped
12
+
13
+ def ==: (untyped other) -> untyped
14
+
15
+ def hash: () -> untyped
16
+
17
+ alias eql? ==
18
+
19
+ def subst: (untyped s) -> untyped
20
+
21
+ def to_s: () -> ::String
22
+
23
+ def free_variables: () -> untyped
24
+
25
+ include Helper::ChildrenLevel
26
+
27
+ def each_child: () ?{ () -> untyped } -> untyped
28
+
29
+ def level: () -> untyped
30
+
31
+ def with_location: (untyped new_location) -> untyped
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,33 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Literal
5
+ attr_reader location: untyped
6
+
7
+ attr_reader value: untyped
8
+
9
+ def initialize: (value: untyped, ?location: untyped?) -> void
10
+
11
+ def ==: (untyped other) -> untyped
12
+
13
+ def hash: () -> untyped
14
+
15
+ alias eql? ==
16
+
17
+ def subst: (untyped s) -> self
18
+
19
+ def to_s: () -> untyped
20
+
21
+ include Helper::NoFreeVariables
22
+
23
+ include Helper::NoChild
24
+
25
+ def level: () -> ::Array[0]
26
+
27
+ def with_location: (untyped new_location) -> untyped
28
+
29
+ def back_type: () -> untyped
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,78 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ module Logic
5
+ type loc = RBS::Location[untyped, untyped]
6
+
7
+ class Base
8
+ attr_reader location: untyped
9
+
10
+ def subst: (untyped s) -> self
11
+
12
+ def free_variables: () -> untyped
13
+
14
+ include Helper::NoChild
15
+
16
+ def hash: () -> untyped
17
+
18
+ def ==: (untyped other) -> untyped
19
+
20
+ alias eql? ==
21
+
22
+ def to_s: () -> ::String
23
+ end
24
+
25
+ # A type for `!` (not) operator results.
26
+ class Not < Base
27
+ def initialize: (?location: untyped?) -> void
28
+ end
29
+
30
+ # A type for `foo.nil?` call results.
31
+ class ReceiverIsNil < Base
32
+ def initialize: (?location: untyped?) -> void
33
+ end
34
+
35
+ #
36
+ class ReceiverIsNotNil < Base
37
+ def initialize: (?location: untyped?) -> void
38
+ end
39
+
40
+ # A type for `receiver.is_a?(C)` call results.
41
+ class ReceiverIsArg < Base
42
+ def initialize: (?location: untyped?) -> void
43
+ end
44
+
45
+ # A type for `Class#===` call results.
46
+ class ArgIsReceiver < Base
47
+ def initialize: (?location: untyped?) -> void
48
+ end
49
+
50
+ # A type for `Object#===` call results.
51
+ class ArgEqualsReceiver < Base
52
+ def initialize: (?location: untyped?) -> void
53
+ end
54
+
55
+ # A type with truthy/falsy type environment.
56
+ class Env < Base
57
+ attr_reader truthy: TypeInference::TypeEnv
58
+
59
+ attr_reader falsy: TypeInference::TypeEnv
60
+
61
+ attr_reader type: t
62
+
63
+ def initialize: (truthy: TypeInference::TypeEnv, falsy: TypeInference::TypeEnv, type: t, ?location: loc?) -> void
64
+
65
+ def ==: (untyped other) -> bool
66
+
67
+ alias eql? ==
68
+
69
+ def hash: () -> Integer
70
+
71
+ def inspect: () -> ::String
72
+
73
+ alias to_s inspect
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,71 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ module Name
5
+ class Base
6
+ attr_reader location: untyped
7
+
8
+ attr_reader name: untyped
9
+
10
+ def initialize: (name: untyped, ?location: untyped?) -> void
11
+
12
+ include Helper::NoFreeVariables
13
+
14
+ def subst: (untyped s) -> self
15
+
16
+ def level: () -> ::Array[0]
17
+ end
18
+
19
+ class Applying < Base
20
+ attr_reader args: untyped
21
+
22
+ def initialize: (name: untyped, args: untyped, ?location: untyped?) -> void
23
+
24
+ def ==: (untyped other) -> untyped
25
+
26
+ alias eql? ==
27
+
28
+ def hash: () -> untyped
29
+
30
+ def to_s: () -> ::String
31
+
32
+ def with_location: (untyped new_location) -> untyped
33
+
34
+ def subst: (untyped s) -> (untyped | self)
35
+
36
+ def free_variables: () -> untyped
37
+
38
+ def each_child: () ?{ () -> untyped } -> untyped
39
+
40
+ include Helper::ChildrenLevel
41
+
42
+ def level: () -> untyped
43
+ end
44
+
45
+ class Singleton < Base
46
+ def ==: (untyped other) -> untyped
47
+
48
+ alias eql? ==
49
+
50
+ def hash: () -> untyped
51
+
52
+ def to_s: () -> ::String
53
+
54
+ def with_location: (untyped new_location) -> untyped
55
+
56
+ include Helper::NoChild
57
+ end
58
+
59
+ class Instance < Applying
60
+ def to_module: () -> untyped
61
+ end
62
+
63
+ class Interface < Applying
64
+ end
65
+
66
+ class Alias < Applying
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,31 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Nil
5
+ attr_reader location: untyped
6
+
7
+ def initialize: (?location: untyped?) -> void
8
+
9
+ def ==: (untyped other) -> untyped
10
+
11
+ def hash: () -> untyped
12
+
13
+ alias eql? ==
14
+
15
+ def subst: (untyped s) -> self
16
+
17
+ def to_s: () -> "nil"
18
+
19
+ include Helper::NoFreeVariables
20
+
21
+ include Helper::NoChild
22
+
23
+ def level: () -> ::Array[0]
24
+
25
+ def with_location: (untyped new_location) -> untyped
26
+
27
+ def back_type: () -> untyped
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,46 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Proc
5
+ attr_reader location: untyped
6
+
7
+ attr_reader type: Interface::Function
8
+
9
+ attr_reader block: Interface::Block?
10
+
11
+ def initialize: (type: Interface::Function, block: Interface::Block?, ?location: untyped) -> void
12
+
13
+ def ==: (untyped other) -> bool
14
+
15
+ def hash: () -> Integer
16
+
17
+ alias eql? ==
18
+
19
+ def subst: (Interface::Substitution s) -> Proc
20
+
21
+ def to_s: () -> ::String
22
+
23
+ def free_variables: () -> Set[Symbol]
24
+
25
+ include Helper::ChildrenLevel
26
+
27
+ def level: () -> Array[Integer]
28
+
29
+ def closed?: () -> bool
30
+
31
+ def with_location: (untyped new_location) -> Proc
32
+
33
+ def map_type: () { (AST::Types::t) -> AST::Types::t } -> Proc
34
+
35
+ def one_arg?: () -> bool
36
+
37
+ def back_type: () -> AST::Types::t
38
+
39
+ def block_required?: () -> bool
40
+
41
+ def each_child: () { (AST::Types::t) -> void } -> void
42
+ | () -> Enumerator[AST::Types::t, void]
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,38 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Record
5
+ type loc = RBS::Location[untyped, untyped]
6
+
7
+ type key = Symbol | String | Integer
8
+
9
+ attr_reader location: loc?
10
+
11
+ attr_reader elements: Hash[key, t]
12
+
13
+ def initialize: (elements: Hash[key, t], ?location: loc?) -> void
14
+
15
+ def ==: (untyped other) -> bool
16
+
17
+ def hash: () -> Integer
18
+
19
+ alias eql? ==
20
+
21
+ def subst: (Interface::Substitution s) -> self
22
+
23
+ def to_s: () -> ::String
24
+
25
+ def free_variables: () -> Set[Symbol]
26
+
27
+ include Helper::ChildrenLevel
28
+
29
+ def each_child: () { (t) -> void } -> void
30
+ | () -> Enumerator[t, void]
31
+
32
+ def level: () -> Integer
33
+
34
+ def with_location: (loc new_location) -> self
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,29 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Self
5
+ attr_reader location: untyped
6
+
7
+ def initialize: (?location: untyped?) -> void
8
+
9
+ def ==: (untyped other) -> untyped
10
+
11
+ def hash: () -> untyped
12
+
13
+ alias eql? ==
14
+
15
+ def to_s: () -> "self"
16
+
17
+ include Helper::NoChild
18
+
19
+ def subst: (untyped s) -> untyped
20
+
21
+ def free_variables: () -> untyped
22
+
23
+ def level: () -> ::Array[0]
24
+
25
+ def with_location: (untyped new_location) -> untyped
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Top
5
+ attr_reader location: untyped
6
+
7
+ def initialize: (?location: untyped?) -> void
8
+
9
+ def ==: (untyped other) -> untyped
10
+
11
+ def hash: () -> untyped
12
+
13
+ alias eql? ==
14
+
15
+ def subst: (untyped s) -> self
16
+
17
+ def to_s: () -> "top"
18
+
19
+ include Helper::NoFreeVariables
20
+
21
+ include Helper::NoChild
22
+
23
+ def level: () -> ::Array[2]
24
+
25
+ def with_location: (untyped new_location) -> untyped
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,34 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Tuple
5
+ attr_reader types: Array[t]
6
+
7
+ attr_reader location: RBS::Location[untyped, untyped]?
8
+
9
+ def initialize: (types: Array[t], ?location: RBS::Location[untyped, untyped]?) -> void
10
+
11
+ def ==: (untyped other) -> bool
12
+
13
+ def hash: () -> Integer
14
+
15
+ alias eql? ==
16
+
17
+ def subst: (Interface::Substitution s) -> Tuple
18
+
19
+ def to_s: () -> ::String
20
+
21
+ def free_variables: () -> Set[Symbol]
22
+
23
+ include Helper::ChildrenLevel
24
+
25
+ def each_child: () { (t) -> void } -> void
26
+ | () -> Enumerator[t, void]
27
+
28
+ def level: () -> untyped
29
+
30
+ def with_location: (RBS::Location[untyped, untyped] new_location) -> Tuple
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,38 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Union
5
+ attr_reader types: Array[t]
6
+
7
+ type loc = RBS::Location[untyped, untyped]
8
+
9
+ attr_reader location: loc?
10
+
11
+ def initialize: (types: Array[t], ?location: loc?) -> void
12
+
13
+ def self.build: (types: Array[t], ?location: loc?) -> t
14
+
15
+ def ==: (untyped other) -> bool
16
+
17
+ def hash: () -> Integer
18
+
19
+ alias eql? ==
20
+
21
+ def subst: (Interface::Substitution s) -> Union
22
+
23
+ def to_s: () -> ::String
24
+
25
+ def free_variables: () -> Set[Symbol]
26
+
27
+ def each_child: () { (t) -> void } -> void
28
+ | () -> Enumerator[t, void]
29
+
30
+ include Helper::ChildrenLevel
31
+
32
+ def level: () -> Integer
33
+
34
+ def with_location: (loc new_location) -> Union
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,37 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Var
5
+ attr_reader name: untyped
6
+
7
+ attr_reader location: untyped
8
+
9
+ def initialize: (name: untyped, ?location: untyped?) -> void
10
+
11
+ def ==: (untyped other) -> untyped
12
+
13
+ def hash: () -> untyped
14
+
15
+ alias eql? ==
16
+
17
+ def self.fresh_name: (untyped name) -> untyped
18
+
19
+ def self.fresh: (untyped name, ?location: untyped?) -> untyped
20
+
21
+ def to_s: () -> untyped
22
+
23
+ def subst: (untyped s) -> (untyped | self)
24
+
25
+ def free_variables: () -> untyped
26
+
27
+ include Helper::NoChild
28
+
29
+ def level: () -> ::Array[0]
30
+
31
+ def update: (?name: untyped, ?location: untyped) -> untyped
32
+
33
+ def with_location: (untyped new_location) -> untyped
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,29 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Void
5
+ attr_reader location: untyped
6
+
7
+ def initialize: (?location: untyped?) -> void
8
+
9
+ def ==: (untyped other) -> untyped
10
+
11
+ def hash: () -> untyped
12
+
13
+ alias eql? ==
14
+
15
+ def subst: (untyped s) -> self
16
+
17
+ def to_s: () -> "void"
18
+
19
+ include Helper::NoFreeVariables
20
+
21
+ include Helper::NoChild
22
+
23
+ def level: () -> ::Array[0]
24
+
25
+ def with_location: (untyped new_location) -> untyped
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,37 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ type t = Any | Boolean | Bot | Nil | Top | Void | Literal
5
+ | Class | Instance | Self
6
+ | Intersection | Record | Tuple | Union
7
+ | Name::Alias | Name::Instance | Name::Interface | Name::Singleton
8
+ | Proc | Var | Logic::Base
9
+
10
+ class Masked
11
+ attr_reader location: untyped
12
+
13
+ attr_reader type: untyped
14
+
15
+ attr_reader mask: untyped
16
+
17
+ def initialize: (type: untyped, mask: untyped, location: untyped) -> void
18
+
19
+ def ==: (untyped other) -> untyped
20
+
21
+ alias eql? ==
22
+
23
+ def hash: () -> untyped
24
+
25
+ def to_json: (*untyped a) -> untyped
26
+
27
+ def to_s: (?::Integer level) -> ::String
28
+
29
+ def free_variables: () -> untyped
30
+
31
+ def each_type: () { (untyped) -> untyped } -> untyped
32
+
33
+ def sub: (untyped s) -> untyped
34
+ end
35
+ end
36
+ end
37
+ end