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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby-windows.yml +34 -0
- data/.github/workflows/ruby.yml +7 -2
- data/.gitignore +1 -0
- data/CHANGELOG.md +59 -0
- data/Gemfile +7 -4
- data/Gemfile.lock +17 -21
- data/Gemfile.steep +3 -0
- data/Gemfile.steep.lock +49 -0
- data/Rakefile +5 -0
- data/Steepfile +6 -1
- data/bin/setup +2 -0
- data/bin/steep +19 -0
- data/lib/steep/ast/builtin.rb +2 -2
- data/lib/steep/ast/types/factory.rb +7 -3
- data/lib/steep/ast/types/proc.rb +2 -0
- data/lib/steep/cli.rb +3 -1
- data/lib/steep/diagnostic/ruby.rb +50 -4
- data/lib/steep/diagnostic/signature.rb +18 -0
- data/lib/steep/drivers/check.rb +3 -3
- data/lib/steep/drivers/watch.rb +3 -1
- data/lib/steep/method_name.rb +9 -3
- data/lib/steep/node_helper.rb +49 -0
- data/lib/steep/path_helper.rb +22 -0
- data/lib/steep/project.rb +3 -15
- data/lib/steep/server/base_worker.rb +1 -0
- data/lib/steep/server/change_buffer.rb +1 -1
- data/lib/steep/server/interaction_worker.rb +3 -5
- data/lib/steep/server/master.rb +61 -45
- data/lib/steep/server/type_check_worker.rb +10 -25
- data/lib/steep/services/completion_provider.rb +25 -18
- data/lib/steep/services/goto_service.rb +2 -4
- data/lib/steep/services/hover_provider/rbs.rb +1 -1
- data/lib/steep/services/hover_provider/ruby.rb +30 -12
- data/lib/steep/services/stats_calculator.rb +0 -1
- data/lib/steep/services/type_check_service.rb +15 -12
- data/lib/steep/shims/symbol_start_with.rb +18 -0
- data/lib/steep/signature/validator.rb +25 -1
- data/lib/steep/source.rb +1 -1
- data/lib/steep/subtyping/check.rb +0 -3
- data/lib/steep/subtyping/constraints.rb +43 -14
- data/lib/steep/type_construction.rb +721 -764
- data/lib/steep/type_inference/constant_env.rb +0 -2
- data/lib/steep/type_inference/context.rb +23 -17
- data/lib/steep/type_inference/logic_type_interpreter.rb +210 -117
- data/lib/steep/type_inference/method_call.rb +80 -6
- data/lib/steep/type_inference/multiple_assignment.rb +189 -0
- data/lib/steep/type_inference/send_args.rb +1 -2
- data/lib/steep/type_inference/type_env.rb +273 -116
- data/lib/steep/type_inference/type_env_builder.rb +138 -0
- data/lib/steep/typing.rb +2 -0
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +7 -5
- data/rbs_collection.steep.lock.yaml +112 -0
- data/rbs_collection.steep.yaml +19 -0
- data/sample/sig/conference.rbs +8 -0
- data/sig/shims/parser/source/map.rbs +146 -0
- data/sig/shims/parser/source/range.rbs +237 -0
- data/sig/shims/parser.rbs +17 -0
- data/sig/steep/ast/annotation/collection.rbs +75 -0
- data/sig/steep/ast/annotation.rbs +126 -0
- data/sig/steep/ast/builtin.rbs +69 -0
- data/sig/steep/ast/type_params.rbs +11 -0
- data/sig/steep/ast/types/any.rbs +29 -0
- data/sig/steep/ast/types/boolean.rbs +31 -0
- data/sig/steep/ast/types/bot.rbs +29 -0
- data/sig/steep/ast/types/class.rbs +29 -0
- data/sig/steep/ast/types/factory.rbs +76 -0
- data/sig/steep/ast/types/helper.rbs +19 -0
- data/sig/steep/ast/types/instance.rbs +29 -0
- data/sig/steep/ast/types/intersection.rbs +35 -0
- data/sig/steep/ast/types/literal.rbs +33 -0
- data/sig/steep/ast/types/logic.rbs +78 -0
- data/sig/steep/ast/types/name.rbs +71 -0
- data/sig/steep/ast/types/nil.rbs +31 -0
- data/sig/steep/ast/types/proc.rbs +46 -0
- data/sig/steep/ast/types/record.rbs +38 -0
- data/sig/steep/ast/types/self.rbs +29 -0
- data/sig/steep/ast/types/top.rbs +29 -0
- data/sig/steep/ast/types/tuple.rbs +34 -0
- data/sig/steep/ast/types/union.rbs +38 -0
- data/sig/steep/ast/types/var.rbs +37 -0
- data/sig/steep/ast/types/void.rbs +29 -0
- data/sig/steep/ast/types.rbs +37 -0
- data/sig/steep/diagnostic/deprecated/unknown_constant_assigned.rbs +15 -0
- data/sig/steep/diagnostic/helper.rbs +9 -0
- data/sig/steep/diagnostic/lsp_formatter.rbs +29 -0
- data/sig/steep/diagnostic/ruby.rbs +494 -0
- data/sig/steep/diagnostic/signature.rbs +215 -0
- data/sig/steep/interface/block.rbs +35 -0
- data/sig/steep/interface/function.rbs +253 -0
- data/sig/steep/interface/interface.rbs +23 -0
- data/sig/steep/interface/method_type.rbs +55 -0
- data/sig/steep/interface/substitution.rbs +53 -0
- data/sig/steep/interface/type_param.rbs +35 -0
- data/sig/steep/method_name.rbs +26 -0
- data/sig/steep/module_helper.rbs +7 -0
- data/sig/steep/node_helper.rbs +11 -0
- data/sig/steep/project/dsl.rbs +94 -0
- data/sig/steep/project/options.rbs +15 -0
- data/sig/steep/project/pattern.rbs +25 -0
- data/sig/steep/project/target.rbs +25 -0
- data/sig/steep/project.rbs +19 -0
- data/sig/steep/services/completion_provider.rbs +123 -0
- data/sig/steep/services/content_change.rbs +35 -0
- data/sig/steep/services/file_loader.rbs +13 -0
- data/sig/steep/services/goto_service.rbs +45 -0
- data/sig/steep/services/hover_provider/rbs.rbs +21 -0
- data/sig/steep/services/hover_provider/ruby.rbs +109 -0
- data/sig/steep/services/hover_provider/singleton_methods.rbs +11 -0
- data/sig/steep/services/path_assignment.rbs +21 -0
- data/sig/steep/services/signature_service.rbs +91 -0
- data/sig/steep/services/stats_calculator.rbs +17 -0
- data/sig/steep/services/type_check_service.rbs +93 -0
- data/sig/steep/source.rbs +55 -0
- data/sig/steep/subtyping/cache.rbs +17 -0
- data/sig/steep/subtyping/check.rbs +93 -0
- data/sig/steep/subtyping/constraints.rbs +111 -0
- data/sig/steep/subtyping/relation.rbs +51 -0
- data/sig/steep/subtyping/result.rbs +157 -0
- data/sig/steep/subtyping/variable_variance.rbs +23 -0
- data/sig/steep/type_construction.rbs +285 -0
- data/sig/steep/type_inference/block_params.rbs +52 -0
- data/sig/steep/type_inference/constant_env.rbs +27 -0
- data/sig/steep/type_inference/context.rbs +137 -0
- data/sig/steep/type_inference/logic_type_interpreter.rbs +72 -0
- data/sig/steep/type_inference/method_call.rbs +124 -0
- data/sig/steep/type_inference/method_params.rbs +104 -0
- data/sig/steep/type_inference/multiple_assignment.rbs +76 -0
- data/sig/steep/type_inference/type_env.rbs +158 -0
- data/sig/steep/type_inference/type_env_builder.rbs +77 -0
- data/sig/steep/typing.rbs +68 -0
- data/sig/steep.rbs +31 -0
- data/smoke/class/f.rb +1 -0
- data/smoke/class/test_expectations.yml +2 -2
- data/smoke/diagnostics/test_expectations.yml +4 -2
- data/smoke/regression/lambda.rb +3 -0
- data/smoke/regression/test_expectations.yml +12 -0
- data/steep.gemspec +1 -1
- metadata +95 -9
- data/lib/steep/subtyping/variable_occurrence.rb +0 -51
- data/lib/steep/type_inference/local_variable_type_env.rb +0 -249
- data/lib/steep/type_inference/logic.rb +0 -161
@@ -0,0 +1,11 @@
|
|
1
|
+
module Steep
|
2
|
+
module NodeHelper
|
3
|
+
def each_child_node: (Parser::AST::Node) -> Enumerator[Parser::AST::Node, void]
|
4
|
+
| (Parser::AST::Node) { (Parser::AST::Node) -> void } -> void
|
5
|
+
|
6
|
+
def each_descendant_node: (Parser::AST::Node) -> Enumerator[Parser::AST::Node, void]
|
7
|
+
| (Parser::AST::Node) { (Parser::AST::Node) -> void } -> void
|
8
|
+
|
9
|
+
def value_node?: (Parser::AST::Node) -> bool
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
module Steep
|
2
|
+
class Project
|
3
|
+
class DSL
|
4
|
+
class TargetDSL
|
5
|
+
attr_reader name: untyped
|
6
|
+
|
7
|
+
attr_reader sources: untyped
|
8
|
+
|
9
|
+
attr_reader libraries: untyped
|
10
|
+
|
11
|
+
attr_reader signatures: untyped
|
12
|
+
|
13
|
+
attr_reader ignored_sources: untyped
|
14
|
+
|
15
|
+
attr_reader stdlib_root: untyped
|
16
|
+
|
17
|
+
attr_reader core_root: untyped
|
18
|
+
|
19
|
+
attr_reader repo_paths: untyped
|
20
|
+
|
21
|
+
attr_reader code_diagnostics_config: untyped
|
22
|
+
|
23
|
+
attr_reader project: untyped
|
24
|
+
|
25
|
+
attr_reader collection_config_path: untyped
|
26
|
+
|
27
|
+
NONE: untyped
|
28
|
+
|
29
|
+
def initialize: (untyped name, ?sources: untyped, ?libraries: untyped, ?signatures: untyped, ?ignored_sources: untyped, ?repo_paths: untyped, ?code_diagnostics_config: ::Hash[untyped, untyped], ?project: untyped?, ?collection_config_path: untyped) -> void
|
30
|
+
|
31
|
+
def initialize_copy: (untyped other) -> untyped
|
32
|
+
|
33
|
+
def check: (*untyped args) -> untyped
|
34
|
+
|
35
|
+
def ignore: (*untyped args) -> untyped
|
36
|
+
|
37
|
+
def library: (*untyped args) -> untyped
|
38
|
+
|
39
|
+
def typing_options: (?untyped? level, **untyped hash) -> untyped
|
40
|
+
|
41
|
+
def signature: (*untyped args) -> untyped
|
42
|
+
|
43
|
+
def update: (?name: untyped, ?sources: untyped, ?libraries: untyped, ?ignored_sources: untyped, ?signatures: untyped, ?project: untyped) -> untyped
|
44
|
+
|
45
|
+
def no_builtin!: (?bool value) -> untyped
|
46
|
+
|
47
|
+
def vendor: (?::String dir, ?stdlib: untyped?, ?gems: untyped?) -> untyped
|
48
|
+
|
49
|
+
def stdlib_path: (core_root: untyped, stdlib_root: untyped) -> untyped
|
50
|
+
|
51
|
+
def repo_path: (*untyped paths) -> untyped
|
52
|
+
|
53
|
+
# Configure the code diagnostics printing setup.
|
54
|
+
#
|
55
|
+
# Yields a hash, and the update the hash in the block.
|
56
|
+
#
|
57
|
+
# ```rb
|
58
|
+
# D = Steep::Diagnostic
|
59
|
+
#
|
60
|
+
# configure_code_diagnostics do |hash|
|
61
|
+
# # Assign one of :error, :warning, :information, :hint or :nil to error classes.
|
62
|
+
# hash[D::Ruby::UnexpectedPositionalArgument] = :error
|
63
|
+
# end
|
64
|
+
# ```
|
65
|
+
#
|
66
|
+
# Passing a hash is also allowed.
|
67
|
+
#
|
68
|
+
# ```rb
|
69
|
+
# D = Steep::Diagnostic
|
70
|
+
#
|
71
|
+
# configure_code_diagnostics(D::Ruby.lenient)
|
72
|
+
# ```
|
73
|
+
#
|
74
|
+
def configure_code_diagnostics: (?untyped? hash) { (untyped) -> untyped } -> untyped
|
75
|
+
|
76
|
+
def collection_config: (untyped path) -> untyped
|
77
|
+
|
78
|
+
def disable_collection: () -> untyped
|
79
|
+
end
|
80
|
+
|
81
|
+
attr_reader project: untyped
|
82
|
+
|
83
|
+
def self.templates: () -> untyped
|
84
|
+
|
85
|
+
def initialize: (project: untyped) -> void
|
86
|
+
|
87
|
+
def self.register_template: (untyped name, untyped target) -> untyped
|
88
|
+
|
89
|
+
def self.parse: (untyped project, untyped code, ?filename: ::String) -> untyped
|
90
|
+
|
91
|
+
def target: (untyped name, ?template: untyped?) ?{ () -> untyped } -> untyped
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Steep
|
2
|
+
class Project
|
3
|
+
class Pattern
|
4
|
+
attr_reader patterns: untyped
|
5
|
+
|
6
|
+
attr_reader ignores: untyped
|
7
|
+
|
8
|
+
attr_reader prefixes: untyped
|
9
|
+
|
10
|
+
attr_reader ignore_prefixes: untyped
|
11
|
+
|
12
|
+
attr_reader ext: untyped
|
13
|
+
|
14
|
+
def initialize: (patterns: untyped, ext: untyped, ?ignores: untyped) -> void
|
15
|
+
|
16
|
+
def =~: (untyped path) -> untyped
|
17
|
+
|
18
|
+
def match?: (untyped path) -> untyped
|
19
|
+
|
20
|
+
def ignore?: (untyped path) -> untyped
|
21
|
+
|
22
|
+
def test_string: (untyped path, untyped patterns, untyped prefixes) -> untyped
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Steep
|
2
|
+
class Project
|
3
|
+
class Target
|
4
|
+
attr_reader name: untyped
|
5
|
+
|
6
|
+
attr_reader options: untyped
|
7
|
+
|
8
|
+
attr_reader source_pattern: untyped
|
9
|
+
|
10
|
+
attr_reader signature_pattern: untyped
|
11
|
+
|
12
|
+
attr_reader code_diagnostics_config: untyped
|
13
|
+
|
14
|
+
def initialize: (name: untyped, options: untyped, source_pattern: untyped, signature_pattern: untyped, code_diagnostics_config: untyped) -> void
|
15
|
+
|
16
|
+
def possible_source_file?: (untyped path) -> untyped
|
17
|
+
|
18
|
+
def possible_signature_file?: (untyped path) -> untyped
|
19
|
+
|
20
|
+
def new_env_loader: (project: untyped) -> untyped
|
21
|
+
|
22
|
+
def self.construct_env_loader: (options: untyped, project: untyped) -> untyped
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Steep
|
2
|
+
class Project
|
3
|
+
attr_reader targets: untyped
|
4
|
+
|
5
|
+
attr_reader steepfile_path: untyped
|
6
|
+
|
7
|
+
def initialize: (steepfile_path: untyped) -> void
|
8
|
+
|
9
|
+
def base_dir: () -> untyped
|
10
|
+
|
11
|
+
def relative_path: (untyped path) -> untyped
|
12
|
+
|
13
|
+
def absolute_path: (untyped path) -> untyped
|
14
|
+
|
15
|
+
def target_for_source_path: (untyped path) -> untyped
|
16
|
+
|
17
|
+
def targets_for_path: (untyped path) -> (::Array[untyped | ::Array[untyped]] | ::Array[nil | untyped])
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
module Steep
|
2
|
+
module Services
|
3
|
+
class CompletionProvider
|
4
|
+
class Position
|
5
|
+
attr_reader line: Integer
|
6
|
+
|
7
|
+
attr_reader column: Integer
|
8
|
+
|
9
|
+
def initialize: (line: Integer, column: Integer) -> void
|
10
|
+
|
11
|
+
def -: (Integer) -> Position
|
12
|
+
end
|
13
|
+
|
14
|
+
class Range
|
15
|
+
attr_reader start: Position
|
16
|
+
|
17
|
+
attr_reader end: Position
|
18
|
+
|
19
|
+
def initialize: (start: Position, end: Position) -> void
|
20
|
+
end
|
21
|
+
|
22
|
+
class InstanceVariableItem
|
23
|
+
attr_reader identifier: Symbol
|
24
|
+
|
25
|
+
attr_reader range: Range
|
26
|
+
|
27
|
+
attr_reader type: AST::Types::t
|
28
|
+
|
29
|
+
def initialize: (identifier: Symbol, range: Range, type: AST::Types::t) -> void
|
30
|
+
end
|
31
|
+
|
32
|
+
class LocalVariableItem
|
33
|
+
attr_reader identifier: Symbol
|
34
|
+
|
35
|
+
attr_reader range: Range
|
36
|
+
|
37
|
+
attr_reader type: AST::Types::t
|
38
|
+
|
39
|
+
def initialize: (identifier: Symbol, range: Range, type: AST::Types::t) -> void
|
40
|
+
end
|
41
|
+
|
42
|
+
class ConstantItem
|
43
|
+
attr_reader env: RBS::Environment
|
44
|
+
|
45
|
+
attr_reader identifier: Symbol
|
46
|
+
|
47
|
+
attr_reader range: Range
|
48
|
+
|
49
|
+
attr_reader type: AST::Types::t
|
50
|
+
|
51
|
+
attr_reader full_name: RBS::TypeName
|
52
|
+
|
53
|
+
def initialize: (env: RBS::Environment, identifier: Symbol, range: Range, type: AST::Types::t, full_name: RBS::TypeName) -> void
|
54
|
+
end
|
55
|
+
|
56
|
+
class MethodNameItem
|
57
|
+
attr_reader identifier: Symbol
|
58
|
+
|
59
|
+
attr_reader range: Range
|
60
|
+
|
61
|
+
attr_reader receiver_type: AST::Types::t
|
62
|
+
|
63
|
+
attr_reader method_type: untyped
|
64
|
+
|
65
|
+
attr_reader method_decls: Array[TypeInference::MethodCall::MethodDecl]
|
66
|
+
|
67
|
+
def initialize: (identifier: Symbol, range: Range, method_type: untyped, method_decls: Array[TypeInference::MethodCall::MethodDecl]) -> void
|
68
|
+
|
69
|
+
def comment: () -> RBS::AST::Comment?
|
70
|
+
|
71
|
+
def inherited?: () -> bool
|
72
|
+
end
|
73
|
+
|
74
|
+
attr_reader source_text: untyped
|
75
|
+
|
76
|
+
attr_reader path: untyped
|
77
|
+
|
78
|
+
attr_reader subtyping: untyped
|
79
|
+
|
80
|
+
attr_reader modified_text: untyped
|
81
|
+
|
82
|
+
attr_reader source: untyped
|
83
|
+
|
84
|
+
attr_reader typing: Typing
|
85
|
+
|
86
|
+
def initialize: (source_text: untyped, path: untyped, subtyping: untyped) -> void
|
87
|
+
|
88
|
+
def type_check!: (untyped text, line: untyped, column: untyped) -> untyped
|
89
|
+
|
90
|
+
def env: () -> untyped
|
91
|
+
|
92
|
+
def run: (line: untyped, column: untyped) -> untyped
|
93
|
+
|
94
|
+
def range_from_loc: (untyped loc) -> untyped
|
95
|
+
|
96
|
+
def at_end?: (untyped pos, of: untyped) -> (untyped | nil)
|
97
|
+
|
98
|
+
def range_for: (untyped position, ?prefix: ::String) -> untyped
|
99
|
+
|
100
|
+
def items_for_trigger: (position: untyped) -> (::Array[untyped] | untyped)
|
101
|
+
|
102
|
+
def items_for_dot: (position: Position) -> ::Array[MethodNameItem]
|
103
|
+
|
104
|
+
def items_for_colon2: (position: untyped) -> untyped
|
105
|
+
|
106
|
+
def items_for_atmark: (position: untyped) -> (::Array[untyped] | untyped)
|
107
|
+
|
108
|
+
def method_items_for_receiver_type: (untyped `type`, include_private: untyped, prefix: untyped, position: untyped, items: untyped) -> untyped
|
109
|
+
|
110
|
+
def word_name?: (String name) -> void
|
111
|
+
|
112
|
+
def local_variable_items_for_context: (TypeInference::Context context, position: Position, prefix: String, items: Array[LocalVariableItem]) -> void
|
113
|
+
|
114
|
+
def constant_items_for_context: (TypeInference::Context context, position: Position, prefix: String, items: Array[ConstantItem], ?parent: Parser::AST::Node?) -> void
|
115
|
+
|
116
|
+
def instance_variable_items_for_context: (TypeInference::Context context, position: Position, prefix: String, items: Array[InstanceVariableItem]) -> void
|
117
|
+
|
118
|
+
def index_for: (untyped string, line: untyped, column: untyped) -> untyped
|
119
|
+
|
120
|
+
def disallowed_method?: (Symbol name) -> bool
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Steep
|
2
|
+
module Services
|
3
|
+
class ContentChange
|
4
|
+
class Position
|
5
|
+
attr_reader line: untyped
|
6
|
+
|
7
|
+
attr_reader column: untyped
|
8
|
+
|
9
|
+
def initialize: (line: untyped, column: untyped) -> void
|
10
|
+
|
11
|
+
def ==: (untyped other) -> untyped
|
12
|
+
|
13
|
+
alias eql? ==
|
14
|
+
|
15
|
+
def hash: () -> untyped
|
16
|
+
end
|
17
|
+
|
18
|
+
attr_reader range: untyped
|
19
|
+
|
20
|
+
attr_reader text: untyped
|
21
|
+
|
22
|
+
def initialize: (text: untyped, ?range: untyped?) -> void
|
23
|
+
|
24
|
+
def ==: (untyped other) -> untyped
|
25
|
+
|
26
|
+
alias eql? ==
|
27
|
+
|
28
|
+
def hash: () -> untyped
|
29
|
+
|
30
|
+
def self.string: (untyped string) -> untyped
|
31
|
+
|
32
|
+
def apply_to: (untyped text) -> untyped
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Steep
|
2
|
+
module Services
|
3
|
+
class FileLoader
|
4
|
+
attr_reader base_dir: untyped
|
5
|
+
|
6
|
+
def initialize: (base_dir: untyped) -> void
|
7
|
+
|
8
|
+
def each_path_in_patterns: (untyped pattern, ?untyped commandline_patterns) { (untyped) -> untyped } -> untyped
|
9
|
+
|
10
|
+
def load_changes: (untyped pattern, ?untyped command_line_patterns, changes: untyped) -> untyped
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Steep
|
2
|
+
module Services
|
3
|
+
class GotoService
|
4
|
+
include ModuleHelper
|
5
|
+
|
6
|
+
module SourceHelper
|
7
|
+
def from_ruby?: () -> untyped
|
8
|
+
|
9
|
+
def from_rbs?: () -> untyped
|
10
|
+
end
|
11
|
+
|
12
|
+
ConstantQuery: untyped
|
13
|
+
|
14
|
+
MethodQuery: untyped
|
15
|
+
|
16
|
+
TypeNameQuery: untyped
|
17
|
+
|
18
|
+
attr_reader type_check: untyped
|
19
|
+
|
20
|
+
attr_reader assignment: untyped
|
21
|
+
|
22
|
+
def initialize: (type_check: untyped, assignment: untyped) -> void
|
23
|
+
|
24
|
+
def project: () -> untyped
|
25
|
+
|
26
|
+
def implementation: (path: untyped, line: untyped, column: untyped) -> untyped
|
27
|
+
|
28
|
+
def definition: (path: untyped, line: untyped, column: untyped) -> untyped
|
29
|
+
|
30
|
+
def test_ast_location: (untyped loc, line: untyped, column: untyped) -> (false | true)
|
31
|
+
|
32
|
+
def query_at: (path: untyped, line: untyped, column: untyped) -> untyped
|
33
|
+
|
34
|
+
def type_check_path: (target: untyped, path: untyped, content: untyped, line: untyped, column: untyped) -> untyped
|
35
|
+
|
36
|
+
def constant_definition_in_rbs: (untyped name, locations: untyped) -> untyped
|
37
|
+
|
38
|
+
def constant_definition_in_ruby: (untyped name, locations: untyped) -> untyped
|
39
|
+
|
40
|
+
def method_locations: (untyped name, in_ruby: untyped, in_rbs: untyped, locations: untyped) -> untyped
|
41
|
+
|
42
|
+
def type_name_locations: (untyped name, ?locations: untyped) -> untyped
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Steep
|
2
|
+
module Services
|
3
|
+
module HoverProvider
|
4
|
+
class RBS
|
5
|
+
TypeAliasContent: untyped
|
6
|
+
|
7
|
+
ClassContent: untyped
|
8
|
+
|
9
|
+
InterfaceContent: untyped
|
10
|
+
|
11
|
+
attr_reader service: untyped
|
12
|
+
|
13
|
+
def initialize: (service: untyped) -> void
|
14
|
+
|
15
|
+
def project: () -> untyped
|
16
|
+
|
17
|
+
def content_for: (target: untyped, path: untyped, line: untyped, column: untyped) -> (nil | untyped)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
module Steep
|
2
|
+
module Services
|
3
|
+
module HoverProvider
|
4
|
+
class Ruby
|
5
|
+
class TypeContent
|
6
|
+
attr_reader node: Parser::AST::Node
|
7
|
+
|
8
|
+
attr_reader type: AST::Types::t
|
9
|
+
|
10
|
+
attr_reader location: Parser::Source::Range
|
11
|
+
|
12
|
+
def initialize: (node: Parser::AST::Node, type: AST::Types::t, location: Parser::Source::Range) -> void
|
13
|
+
end
|
14
|
+
|
15
|
+
# Hover content for a local variable, references or assignments
|
16
|
+
#
|
17
|
+
# ```ruby
|
18
|
+
# a = 123
|
19
|
+
# # ^^^^ Hover popups
|
20
|
+
# # ^ Location covers
|
21
|
+
#
|
22
|
+
# a + 1
|
23
|
+
# # ^ Hover popups
|
24
|
+
# # ^ Location covers
|
25
|
+
# ```
|
26
|
+
class VariableContent
|
27
|
+
attr_reader node: Parser::AST::Node
|
28
|
+
|
29
|
+
attr_reader name: Symbol
|
30
|
+
|
31
|
+
attr_reader type: AST::Types::t
|
32
|
+
|
33
|
+
attr_reader location: Parser::Source::Range
|
34
|
+
|
35
|
+
def initialize: (node: Parser::AST::Node, name: Symbol, type: AST::Types::t, location: Parser::Source::Range) -> void
|
36
|
+
end
|
37
|
+
|
38
|
+
class MethodCallContent
|
39
|
+
attr_reader node: Parser::AST::Node
|
40
|
+
|
41
|
+
attr_reader method_call: TypeInference::MethodCall::t
|
42
|
+
|
43
|
+
attr_reader location: Parser::Source::Range
|
44
|
+
|
45
|
+
def initialize: (node: Parser::AST::Node, method_call: TypeInference::MethodCall::t, location: Parser::Source::Range) -> void
|
46
|
+
end
|
47
|
+
|
48
|
+
class DefinitionContent
|
49
|
+
attr_reader node: Parser::AST::Node
|
50
|
+
|
51
|
+
attr_reader method_name: method_name
|
52
|
+
|
53
|
+
attr_reader method_type: Interface::MethodType
|
54
|
+
|
55
|
+
attr_reader definition: ::RBS::Definition::Method
|
56
|
+
|
57
|
+
attr_reader location: Parser::Source::Range
|
58
|
+
|
59
|
+
def initialize: (node: Parser::AST::Node, method_name: method_name, method_type: Interface::MethodType, definition: ::RBS::Definition::Method, location: Parser::Source::Range) -> void
|
60
|
+
end
|
61
|
+
|
62
|
+
class ConstantContent
|
63
|
+
attr_reader location: Parser::Source::Range
|
64
|
+
|
65
|
+
attr_reader full_name: ::RBS::TypeName
|
66
|
+
|
67
|
+
attr_reader type: AST::Types::t
|
68
|
+
|
69
|
+
type decl = ::RBS::Environment::ClassEntry
|
70
|
+
| ::RBS::Environment::ModuleEntry
|
71
|
+
| ::RBS::Environment::SingleEntry[::RBS::TypeName, ::RBS::AST::Declarations::Constant]
|
72
|
+
|
73
|
+
attr_reader decl: decl
|
74
|
+
|
75
|
+
attr_reader class_decl(): ::RBS::Environment::ClassEntry | ::RBS::Environment::ModuleEntry | nil
|
76
|
+
|
77
|
+
attr_reader constant_decl(): ::RBS::Environment::SingleEntry[::RBS::TypeName, ::RBS::AST::Declarations::Constant]?
|
78
|
+
|
79
|
+
def initialize: (location: Parser::Source::Range, full_name: ::RBS::TypeName, type: AST::Types::t, decl: decl) -> void
|
80
|
+
|
81
|
+
def comments: () -> Array[::RBS::AST::Comment]
|
82
|
+
|
83
|
+
# Returns true if `decl` is a class/module definition
|
84
|
+
def class_or_module?: () -> bool
|
85
|
+
|
86
|
+
# Returns true if `decl` is a constant definition
|
87
|
+
def constant?: () -> bool
|
88
|
+
end
|
89
|
+
|
90
|
+
type content = TypeContent | VariableContent | MethodCallContent | DefinitionContent | ConstantContent
|
91
|
+
|
92
|
+
attr_reader service: TypeCheckService
|
93
|
+
|
94
|
+
def initialize: (service: TypeCheckService) -> void
|
95
|
+
|
96
|
+
def project: () -> Project
|
97
|
+
|
98
|
+
def method_definition_for: (AST::Types::Factory factory, ::RBS::TypeName type_name, singleton_method: Symbol) -> ::RBS::Definition::Method
|
99
|
+
| (AST::Types::Factory factory, ::RBS::TypeName type_name, instance_method: Symbol) -> ::RBS::Definition::Method
|
100
|
+
|
101
|
+
def typecheck: (Project::Target target, path: Pathname, content: String, line: Integer, column: Integer) -> Typing?
|
102
|
+
|
103
|
+
def method_name_from_method: (TypeInference::Context::MethodContext context, builder: ::RBS::DefinitionBuilder) -> method_name
|
104
|
+
|
105
|
+
def content_for: (target: Project::Target, path: Pathname, line: Integer, column: Integer) -> content?
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Steep
|
2
|
+
module Services
|
3
|
+
class PathAssignment
|
4
|
+
attr_reader index: untyped
|
5
|
+
|
6
|
+
attr_reader max_index: untyped
|
7
|
+
|
8
|
+
attr_reader cache: untyped
|
9
|
+
|
10
|
+
def initialize: (index: untyped, max_index: untyped) -> void
|
11
|
+
|
12
|
+
def self.all: () -> untyped
|
13
|
+
|
14
|
+
def =~: (untyped path) -> untyped
|
15
|
+
|
16
|
+
alias === =~
|
17
|
+
|
18
|
+
def self.index_for: (path: untyped, max_index: untyped) -> untyped
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
module Steep
|
2
|
+
module Services
|
3
|
+
class SignatureService
|
4
|
+
attr_reader status: untyped
|
5
|
+
|
6
|
+
class SyntaxErrorStatus
|
7
|
+
attr_reader files: untyped
|
8
|
+
|
9
|
+
attr_reader changed_paths: untyped
|
10
|
+
|
11
|
+
attr_reader diagnostics: untyped
|
12
|
+
|
13
|
+
attr_reader last_builder: untyped
|
14
|
+
|
15
|
+
def initialize: (files: untyped, changed_paths: untyped, diagnostics: untyped, last_builder: untyped) -> void
|
16
|
+
|
17
|
+
def rbs_index: () -> untyped
|
18
|
+
end
|
19
|
+
|
20
|
+
class AncestorErrorStatus
|
21
|
+
attr_reader files: untyped
|
22
|
+
|
23
|
+
attr_reader changed_paths: untyped
|
24
|
+
|
25
|
+
attr_reader diagnostics: untyped
|
26
|
+
|
27
|
+
attr_reader last_builder: untyped
|
28
|
+
|
29
|
+
def initialize: (files: untyped, changed_paths: untyped, diagnostics: untyped, last_builder: untyped) -> void
|
30
|
+
|
31
|
+
def rbs_index: () -> untyped
|
32
|
+
end
|
33
|
+
|
34
|
+
class LoadedStatus
|
35
|
+
attr_reader files: untyped
|
36
|
+
|
37
|
+
attr_reader builder: untyped
|
38
|
+
|
39
|
+
def initialize: (files: untyped, builder: untyped) -> void
|
40
|
+
|
41
|
+
def subtyping: () -> untyped
|
42
|
+
|
43
|
+
def rbs_index: () -> untyped
|
44
|
+
end
|
45
|
+
|
46
|
+
FileStatus: untyped
|
47
|
+
|
48
|
+
def initialize: (env: untyped) -> void
|
49
|
+
|
50
|
+
def self.load_from: (untyped loader) -> untyped
|
51
|
+
|
52
|
+
def env_rbs_paths: () -> untyped
|
53
|
+
|
54
|
+
def each_rbs_path: () { (untyped) -> untyped } -> untyped
|
55
|
+
|
56
|
+
def files: () -> untyped
|
57
|
+
|
58
|
+
def pending_changed_paths: () -> untyped
|
59
|
+
|
60
|
+
def latest_env: () -> untyped
|
61
|
+
|
62
|
+
def latest_builder: () -> untyped
|
63
|
+
|
64
|
+
def latest_rbs_index: () -> untyped
|
65
|
+
|
66
|
+
def current_subtyping: () -> (untyped | nil)
|
67
|
+
|
68
|
+
def apply_changes: (untyped files, untyped changes) -> untyped
|
69
|
+
|
70
|
+
def update: (untyped changes) -> untyped
|
71
|
+
|
72
|
+
def update_env: (untyped updated_files, paths: untyped) -> untyped
|
73
|
+
|
74
|
+
def rescue_rbs_error: (untyped errors) { () -> untyped } -> untyped
|
75
|
+
|
76
|
+
def update_builder: (ancestor_builder: untyped, paths: untyped) -> untyped
|
77
|
+
|
78
|
+
def type_names: (paths: untyped, env: untyped) -> untyped
|
79
|
+
|
80
|
+
def const_decls: (paths: untyped, env: untyped) -> untyped
|
81
|
+
|
82
|
+
def global_decls: (paths: untyped, ?env: untyped) -> untyped
|
83
|
+
|
84
|
+
def type_name_from_decl: (untyped decl, set: untyped) -> untyped
|
85
|
+
|
86
|
+
def add_descendants: (graph: untyped, names: untyped, set: untyped) -> untyped
|
87
|
+
|
88
|
+
def add_nested_decls: (env: untyped, names: untyped, set: untyped) -> untyped
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Steep
|
2
|
+
module Services
|
3
|
+
class StatsCalculator
|
4
|
+
SuccessStats: untyped
|
5
|
+
|
6
|
+
ErrorStats: untyped
|
7
|
+
|
8
|
+
attr_reader service: untyped
|
9
|
+
|
10
|
+
def initialize: (service: untyped) -> void
|
11
|
+
|
12
|
+
def project: () -> untyped
|
13
|
+
|
14
|
+
def calc_stats: (untyped target, file: untyped) -> untyped
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|