steep 1.0.2 → 1.1.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +5 -0
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +22 -3
  5. data/Gemfile +6 -3
  6. data/Gemfile.lock +12 -16
  7. data/Gemfile.steep +3 -0
  8. data/Gemfile.steep.lock +49 -0
  9. data/Rakefile +5 -0
  10. data/Steepfile +6 -1
  11. data/bin/setup +2 -0
  12. data/bin/steep +19 -0
  13. data/lib/steep/ast/types/factory.rb +1 -1
  14. data/lib/steep/diagnostic/ruby.rb +49 -3
  15. data/lib/steep/diagnostic/signature.rb +18 -0
  16. data/lib/steep/drivers/watch.rb +3 -1
  17. data/lib/steep/method_name.rb +9 -3
  18. data/lib/steep/node_helper.rb +49 -0
  19. data/lib/steep/services/completion_provider.rb +22 -15
  20. data/lib/steep/services/hover_provider/ruby.rb +30 -12
  21. data/lib/steep/services/type_check_service.rb +12 -12
  22. data/lib/steep/shims/symbol_start_with.rb +18 -0
  23. data/lib/steep/signature/validator.rb +19 -0
  24. data/lib/steep/subtyping/constraints.rb +43 -14
  25. data/lib/steep/type_construction.rb +666 -746
  26. data/lib/steep/type_inference/constant_env.rb +0 -2
  27. data/lib/steep/type_inference/context.rb +23 -17
  28. data/lib/steep/type_inference/logic_type_interpreter.rb +210 -119
  29. data/lib/steep/type_inference/method_call.rb +80 -6
  30. data/lib/steep/type_inference/multiple_assignment.rb +189 -0
  31. data/lib/steep/type_inference/type_env.rb +271 -120
  32. data/lib/steep/type_inference/type_env_builder.rb +138 -0
  33. data/lib/steep/typing.rb +2 -0
  34. data/lib/steep/version.rb +1 -1
  35. data/lib/steep.rb +4 -3
  36. data/rbs_collection.steep.lock.yaml +112 -0
  37. data/rbs_collection.steep.yaml +19 -0
  38. data/sample/sig/conference.rbs +8 -0
  39. data/sig/shims/parser/source/map.rbs +146 -0
  40. data/sig/shims/parser/source/range.rbs +237 -0
  41. data/sig/shims/parser.rbs +17 -0
  42. data/sig/steep/ast/annotation/collection.rbs +75 -0
  43. data/sig/steep/ast/annotation.rbs +126 -0
  44. data/sig/steep/ast/builtin.rbs +69 -0
  45. data/sig/steep/ast/type_params.rbs +11 -0
  46. data/sig/steep/ast/types/any.rbs +29 -0
  47. data/sig/steep/ast/types/boolean.rbs +31 -0
  48. data/sig/steep/ast/types/bot.rbs +29 -0
  49. data/sig/steep/ast/types/class.rbs +29 -0
  50. data/sig/steep/ast/types/factory.rbs +76 -0
  51. data/sig/steep/ast/types/helper.rbs +19 -0
  52. data/sig/steep/ast/types/instance.rbs +29 -0
  53. data/sig/steep/ast/types/intersection.rbs +35 -0
  54. data/sig/steep/ast/types/literal.rbs +33 -0
  55. data/sig/steep/ast/types/logic.rbs +78 -0
  56. data/sig/steep/ast/types/name.rbs +71 -0
  57. data/sig/steep/ast/types/nil.rbs +31 -0
  58. data/sig/steep/ast/types/proc.rbs +46 -0
  59. data/sig/steep/ast/types/record.rbs +38 -0
  60. data/sig/steep/ast/types/self.rbs +29 -0
  61. data/sig/steep/ast/types/top.rbs +29 -0
  62. data/sig/steep/ast/types/tuple.rbs +34 -0
  63. data/sig/steep/ast/types/union.rbs +38 -0
  64. data/sig/steep/ast/types/var.rbs +37 -0
  65. data/sig/steep/ast/types/void.rbs +29 -0
  66. data/sig/steep/ast/types.rbs +37 -0
  67. data/sig/steep/diagnostic/deprecated/unknown_constant_assigned.rbs +15 -0
  68. data/sig/steep/diagnostic/helper.rbs +9 -0
  69. data/sig/steep/diagnostic/lsp_formatter.rbs +29 -0
  70. data/sig/steep/diagnostic/ruby.rbs +494 -0
  71. data/sig/steep/diagnostic/signature.rbs +215 -0
  72. data/sig/steep/interface/block.rbs +35 -0
  73. data/sig/steep/interface/function.rbs +253 -0
  74. data/sig/steep/interface/interface.rbs +23 -0
  75. data/sig/steep/interface/method_type.rbs +55 -0
  76. data/sig/steep/interface/substitution.rbs +53 -0
  77. data/sig/steep/interface/type_param.rbs +35 -0
  78. data/sig/steep/method_name.rbs +26 -0
  79. data/sig/steep/module_helper.rbs +7 -0
  80. data/sig/steep/node_helper.rbs +11 -0
  81. data/sig/steep/project/dsl.rbs +94 -0
  82. data/sig/steep/project/options.rbs +15 -0
  83. data/sig/steep/project/pattern.rbs +25 -0
  84. data/sig/steep/project/target.rbs +25 -0
  85. data/sig/steep/project.rbs +19 -0
  86. data/sig/steep/services/completion_provider.rbs +123 -0
  87. data/sig/steep/services/content_change.rbs +35 -0
  88. data/sig/steep/services/file_loader.rbs +13 -0
  89. data/sig/steep/services/goto_service.rbs +45 -0
  90. data/sig/steep/services/hover_provider/rbs.rbs +21 -0
  91. data/sig/steep/services/hover_provider/ruby.rbs +109 -0
  92. data/sig/steep/services/hover_provider/singleton_methods.rbs +11 -0
  93. data/sig/steep/services/path_assignment.rbs +21 -0
  94. data/sig/steep/services/signature_service.rbs +91 -0
  95. data/sig/steep/services/stats_calculator.rbs +17 -0
  96. data/sig/steep/services/type_check_service.rbs +93 -0
  97. data/sig/steep/source.rbs +55 -0
  98. data/sig/steep/subtyping/cache.rbs +17 -0
  99. data/sig/steep/subtyping/check.rbs +93 -0
  100. data/sig/steep/subtyping/constraints.rbs +111 -0
  101. data/sig/steep/subtyping/relation.rbs +51 -0
  102. data/sig/steep/subtyping/result.rbs +157 -0
  103. data/sig/steep/subtyping/variable_variance.rbs +23 -0
  104. data/sig/steep/type_construction.rbs +285 -0
  105. data/sig/steep/type_inference/block_params.rbs +52 -0
  106. data/sig/steep/type_inference/constant_env.rbs +27 -0
  107. data/sig/steep/type_inference/context.rbs +137 -0
  108. data/sig/steep/type_inference/logic_type_interpreter.rbs +72 -0
  109. data/sig/steep/type_inference/method_call.rbs +124 -0
  110. data/sig/steep/type_inference/method_params.rbs +104 -0
  111. data/sig/steep/type_inference/multiple_assignment.rbs +76 -0
  112. data/sig/steep/type_inference/type_env.rbs +158 -0
  113. data/sig/steep/type_inference/type_env_builder.rbs +77 -0
  114. data/sig/steep/typing.rbs +68 -0
  115. data/sig/steep.rbs +31 -0
  116. data/smoke/class/f.rb +1 -0
  117. data/smoke/class/test_expectations.yml +2 -2
  118. data/smoke/diagnostics/test_expectations.yml +4 -2
  119. metadata +90 -6
  120. data/lib/steep/type_inference/local_variable_type_env.rb +0 -249
  121. data/lib/steep/type_inference/logic.rb +0 -161
@@ -0,0 +1,17 @@
1
+ module Parser
2
+ module AST
3
+ class Node
4
+ attr_reader type: Symbol
5
+
6
+ attr_reader children: Array[untyped]
7
+
8
+ def initialize: (Symbol `type`, Array[untyped] children) -> void
9
+
10
+ def updated: (?Symbol?, ?Array[untyped]?) -> Node
11
+
12
+ attr_reader location: Source::Map
13
+
14
+ alias loc location
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,75 @@
1
+ module Steep
2
+ module AST
3
+ module Annotation
4
+ class Collection
5
+ attr_reader annotations: untyped
6
+
7
+ attr_reader factory: Types::Factory
8
+
9
+ attr_reader context: RBS::Resolver::context
10
+
11
+ attr_reader var_type_annotations: Hash[Symbol, VarType]
12
+
13
+ attr_reader const_type_annotations: Hash[RBS::TypeName, ConstType]
14
+
15
+ attr_reader ivar_type_annotations: Hash[Symbol, IvarType]
16
+
17
+ attr_reader method_type_annotations: untyped
18
+
19
+ attr_reader block_type_annotation: untyped
20
+
21
+ attr_reader return_type_annotation: untyped
22
+
23
+ attr_reader self_type_annotation: untyped
24
+
25
+ attr_reader instance_type_annotation: untyped
26
+
27
+ attr_reader module_type_annotation: untyped
28
+
29
+ attr_reader implement_module_annotation: untyped
30
+
31
+ attr_reader dynamic_annotations: untyped
32
+
33
+ attr_reader break_type_annotation: untyped
34
+
35
+ def initialize: (annotations: untyped, factory: untyped, context: untyped) -> void
36
+
37
+ def absolute_type: (untyped `type`) -> (untyped | nil)
38
+
39
+ def var_type: (?lvar: untyped?, ?ivar: untyped?, ?const: untyped?) -> untyped
40
+
41
+ def method_type: (untyped name) -> (untyped | nil)
42
+
43
+ def block_type: () -> untyped
44
+
45
+ def return_type: () -> untyped
46
+
47
+ def self_type: () -> untyped
48
+
49
+ def instance_type: () -> untyped
50
+
51
+ def module_type: () -> untyped
52
+
53
+ def break_type: () -> untyped
54
+
55
+ def lvar_types: () -> untyped
56
+
57
+ def ivar_types: () -> untyped
58
+
59
+ def const_types: () -> untyped
60
+
61
+ def instance_dynamics: () -> untyped
62
+
63
+ def module_dynamics: () -> untyped
64
+
65
+ def merge_block_annotations: (untyped annotations) -> untyped
66
+
67
+ def any?: () { () -> untyped } -> untyped
68
+
69
+ def size: () -> untyped
70
+
71
+ def include?: (untyped obj) -> untyped
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,126 @@
1
+ module Steep
2
+ module AST
3
+ module Annotation
4
+ type t = ReturnType | BlockType | SelfType | InstanceType | ModuleType | BreakType
5
+ | MethodType | VarType | ConstType | IvarType
6
+ | Implements | Dynamic
7
+
8
+ type loc = RBS::Location[untyped, untyped]
9
+
10
+ class Named
11
+ attr_reader name: Symbol
12
+
13
+ attr_reader type: Types::t
14
+
15
+ attr_reader location: loc?
16
+
17
+ def initialize: (name: Symbol, type: Types::t, ?location: loc?) -> void
18
+
19
+ def ==: (untyped other) -> bool
20
+ end
21
+
22
+ class Typed
23
+ attr_reader type: Types::t
24
+
25
+ attr_reader annotation: untyped
26
+
27
+ attr_reader location: loc?
28
+
29
+ def initialize: (type: Types::t, ?location: loc?) -> void
30
+
31
+ def ==: (untyped other) -> bool
32
+ end
33
+
34
+ class ReturnType < Typed
35
+ end
36
+
37
+ class BlockType < Typed
38
+ end
39
+
40
+ class SelfType < Typed
41
+ end
42
+
43
+ class InstanceType < Typed
44
+ end
45
+
46
+ class ModuleType < Typed
47
+ end
48
+
49
+ class BreakType < Typed
50
+ end
51
+
52
+ class MethodType < Named
53
+ end
54
+
55
+ class VarType < Named
56
+ end
57
+
58
+ class ConstType < Named
59
+ attr_reader name: RBS::TypeName
60
+
61
+ attr_reader type: Types::t
62
+
63
+ attr_reader location: loc?
64
+
65
+ def initialize: (name: RBS::TypeName, type: untyped, ?location: loc?) -> void
66
+
67
+ def ==: (untyped other) -> bool
68
+ end
69
+
70
+ class IvarType < Named
71
+ end
72
+
73
+ class Implements
74
+ class Module
75
+ attr_reader name: RBS::TypeName
76
+
77
+ attr_reader args: Array[Types::t]
78
+
79
+ def initialize: (name: RBS::TypeName, args: Array[Types::t]) -> void
80
+
81
+ def ==: (untyped other) -> bool
82
+
83
+ alias eql? ==
84
+
85
+ def hash: () -> Integer
86
+ end
87
+
88
+ attr_reader location: loc?
89
+
90
+ attr_reader name: Module
91
+
92
+ def initialize: (name: Module, ?location: loc?) -> void
93
+
94
+ def ==: (untyped other) -> bool
95
+ end
96
+
97
+ class Dynamic
98
+ class Name
99
+ type kind = :instance | :module_instance | :module
100
+
101
+ attr_reader kind: kind
102
+
103
+ attr_reader name: Symbol
104
+
105
+ attr_reader location: loc?
106
+
107
+ def initialize: (name: Symbol, kind: kind, ?location: loc?) -> void
108
+
109
+ def instance_method?: () -> bool
110
+
111
+ def module_method?: () -> bool
112
+
113
+ def ==: (untyped other) -> bool
114
+ end
115
+
116
+ attr_reader location: loc?
117
+
118
+ attr_reader names: Array[Name]
119
+
120
+ def initialize: (names: Array[Name], ?location: loc?) -> void
121
+
122
+ def ==: (untyped other) -> bool
123
+ end
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,69 @@
1
+ module Steep
2
+ module AST
3
+ module Builtin
4
+ class Type
5
+ attr_reader module_name: RBS::TypeName
6
+
7
+ attr_reader arity: Integer
8
+
9
+ def initialize: (String module_name, ?arity: ::Integer) -> void
10
+
11
+ def instance_type: (*Types::t args, ?fill_untyped: bool) -> Types::Name::Instance
12
+
13
+ def module_type: () -> Types::Name::Singleton
14
+
15
+ def instance_type?: (Types::t `type`, ?args: Array[Types::t]?) -> bool
16
+
17
+ def module_type?: (Types::t `type`) -> bool
18
+ end
19
+
20
+ Object: Type
21
+
22
+ BasicObject: Type
23
+
24
+ Array: Type
25
+
26
+ Range: Type
27
+
28
+ Hash: Type
29
+
30
+ Module: Type
31
+
32
+ Class: Type
33
+
34
+ Integer: Type
35
+
36
+ Float: Type
37
+
38
+ String: Type
39
+
40
+ Symbol: Type
41
+
42
+ TrueClass: Type
43
+
44
+ FalseClass: Type
45
+
46
+ Regexp: Type
47
+
48
+ NilClass: Type
49
+
50
+ Proc: Type
51
+
52
+ def self.nil_type: () -> Types::Nil
53
+
54
+ def self.any_type: () -> Types::Any
55
+
56
+ def self.bool_type: () -> Types::Boolean
57
+
58
+ def self.bottom_type: () -> Types::Bot
59
+
60
+ def self.top_type: () -> Types::Top
61
+
62
+ def self.optional: (Types::t `type`) -> Types::Union
63
+
64
+ def self.true_type: () -> Types::Literal
65
+
66
+ def self.false_type: () -> Types::Literal
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,11 @@
1
+ # module Steep
2
+ # module AST
3
+ # class TypeParams
4
+ # attr_reader location: untyped
5
+
6
+ # attr_reader variables: untyped
7
+
8
+ # def initialize: (variables: untyped, ?location: untyped?) -> void
9
+ # end
10
+ # end
11
+ # end
@@ -0,0 +1,29 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Any
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: () -> "untyped"
18
+
19
+ include Helper::NoFreeVariables
20
+
21
+ include Helper::NoChild
22
+
23
+ def level: () -> ::Array[1]
24
+
25
+ def with_location: (untyped new_location) -> untyped
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,31 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Boolean
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: () -> "bool"
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,29 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Bot
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: () -> "bot"
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,29 @@
1
+ module Steep
2
+ module AST
3
+ module Types
4
+ class Class
5
+ attr_reader location: untyped
6
+
7
+ def initialize: (?location: untyped?) -> void
8
+
9
+ def to_s: () -> "class"
10
+
11
+ def ==: (untyped other) -> untyped
12
+
13
+ def hash: () -> untyped
14
+
15
+ alias eql? ==
16
+
17
+ def subst: (untyped s) -> untyped
18
+
19
+ def free_variables: () -> untyped
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,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