steep 1.1.1 → 1.2.0.pre.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/Gemfile +0 -1
- data/Gemfile.lock +12 -11
- data/Gemfile.steep +1 -1
- data/Gemfile.steep.lock +9 -9
- data/README.md +3 -3
- data/Steepfile +23 -0
- data/bin/steep-prof +2 -1
- data/lib/steep/annotation_parser.rb +1 -1
- data/lib/steep/ast/types/class.rb +4 -0
- data/lib/steep/ast/types/factory.rb +86 -602
- data/lib/steep/ast/types/instance.rb +4 -0
- data/lib/steep/ast/types/literal.rb +1 -1
- data/lib/steep/ast/types/proc.rb +22 -8
- data/lib/steep/ast/types/self.rb +4 -0
- data/lib/steep/ast/types/union.rb +1 -1
- data/lib/steep/cli.rb +24 -1
- data/lib/steep/diagnostic/ruby.rb +17 -22
- data/lib/steep/drivers/checkfile.rb +205 -0
- data/lib/steep/drivers/validate.rb +3 -1
- data/lib/steep/equatable.rb +2 -0
- data/lib/steep/interface/block.rb +21 -11
- data/lib/steep/interface/builder.rb +756 -0
- data/lib/steep/interface/function.rb +32 -24
- data/lib/steep/interface/method_type.rb +191 -78
- data/lib/steep/interface/shape.rb +132 -0
- data/lib/steep/interface/substitution.rb +23 -12
- data/lib/steep/interface/type_param.rb +1 -2
- data/lib/steep/path_helper.rb +1 -1
- data/lib/steep/project.rb +5 -7
- data/lib/steep/server/base_worker.rb +2 -2
- data/lib/steep/server/change_buffer.rb +4 -3
- data/lib/steep/server/interaction_worker.rb +1 -1
- data/lib/steep/server/master.rb +69 -9
- data/lib/steep/server/type_check_worker.rb +13 -11
- data/lib/steep/server/worker_process.rb +9 -7
- data/lib/steep/services/completion_provider.rb +15 -3
- data/lib/steep/services/hover_provider/singleton_methods.rb +5 -6
- data/lib/steep/services/signature_service.rb +13 -8
- data/lib/steep/services/type_check_service.rb +2 -0
- data/lib/steep/signature/validator.rb +1 -1
- data/lib/steep/subtyping/check.rb +154 -103
- data/lib/steep/subtyping/relation.rb +3 -3
- data/lib/steep/subtyping/result.rb +20 -2
- data/lib/steep/subtyping/variable_variance.rb +9 -0
- data/lib/steep/type_construction.rb +558 -299
- data/lib/steep/type_inference/block_params.rb +169 -86
- data/lib/steep/type_inference/logic_type_interpreter.rb +9 -14
- data/lib/steep/type_inference/method_params.rb +12 -7
- data/lib/steep/type_inference/send_args.rb +41 -35
- data/lib/steep/type_inference/type_env_builder.rb +1 -1
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +71 -2
- data/rbs_collection.steep.lock.yaml +18 -30
- data/rbs_collection.steep.yaml +1 -0
- data/sig/shims/language-server_protocol.rbs +20 -0
- data/sig/shims/tagged_logging.rbs +6 -0
- data/sig/steep/ast/annotation/collection.rbs +6 -6
- data/sig/steep/ast/types/class.rbs +3 -0
- data/sig/steep/ast/types/factory.rbs +38 -32
- data/sig/steep/ast/types/instance.rbs +3 -0
- data/sig/steep/ast/types/intersection.rbs +1 -1
- data/sig/steep/ast/types/literal.rbs +7 -7
- data/sig/steep/ast/types/name.rbs +14 -13
- data/sig/steep/ast/types/proc.rbs +3 -1
- data/sig/steep/ast/types/self.rbs +3 -0
- data/sig/steep/ast/types/var.rbs +1 -1
- data/sig/steep/diagnostic/ruby.rbs +30 -34
- data/sig/steep/drivers/annotations.rbs +17 -0
- data/sig/steep/drivers/check.rbs +33 -0
- data/sig/steep/drivers/checkfile.rbs +26 -0
- data/sig/steep/drivers/diagnostic_printer.rbs +25 -0
- data/sig/steep/drivers/init.rbs +19 -0
- data/sig/steep/drivers/langserver.rbs +35 -0
- data/sig/steep/drivers/print_project.rbs +15 -0
- data/sig/steep/drivers/stats.rbs +37 -0
- data/sig/steep/drivers/utils/driver_helper.rbs +23 -0
- data/sig/steep/drivers/utils/jobs_count.rbs +11 -0
- data/sig/steep/drivers/validate.rbs +15 -0
- data/sig/steep/drivers/vendor.rbs +19 -0
- data/sig/steep/drivers/watch.rbs +27 -0
- data/sig/steep/drivers/worker.rbs +31 -0
- data/sig/steep/equatable.rbs +11 -0
- data/sig/steep/index/rbs_index.rbs +91 -0
- data/sig/steep/index/signature_symbol_provider.rbs +29 -0
- data/sig/steep/index/source_index.rbs +63 -0
- data/sig/steep/interface/block.rbs +3 -1
- data/sig/steep/interface/builder.rbs +152 -0
- data/sig/steep/interface/function.rbs +67 -55
- data/sig/steep/interface/method_type.rbs +60 -12
- data/sig/steep/interface/shape.rbs +61 -0
- data/sig/steep/interface/substitution.rbs +18 -22
- data/sig/steep/interface/type_param.rbs +9 -1
- data/sig/steep/path_helper.rbs +7 -0
- data/sig/steep/project/pattern.rbs +10 -10
- data/sig/steep/project/target.rbs +2 -2
- data/sig/steep/project.rbs +15 -8
- data/sig/steep/server/base_worker.rbs +49 -0
- data/sig/steep/server/change_buffer.rbs +32 -0
- data/sig/steep/server/interaction_worker.rbs +41 -0
- data/sig/steep/server/lsp_formatter.rbs +29 -0
- data/sig/steep/server/master.rbs +260 -0
- data/sig/steep/server/type_check_worker.rbs +135 -0
- data/sig/steep/server/worker_process.rbs +29 -0
- data/sig/steep/services/completion_provider.rbs +5 -5
- data/sig/steep/services/content_change.rbs +14 -12
- data/sig/steep/services/file_loader.rbs +12 -4
- data/sig/steep/services/hover_provider/singleton_methods.rbs +1 -1
- data/sig/steep/services/path_assignment.rbs +7 -7
- data/sig/steep/services/signature_service.rbs +67 -40
- data/sig/steep/services/type_check_service.rbs +53 -39
- data/sig/steep/subtyping/check.rbs +80 -44
- data/sig/steep/subtyping/relation.rbs +24 -22
- data/sig/steep/subtyping/result.rbs +48 -30
- data/sig/steep/subtyping/variable_variance.rbs +2 -0
- data/sig/steep/type_construction.rbs +132 -23
- data/sig/steep/type_inference/block_params.rbs +120 -18
- data/sig/steep/type_inference/context.rbs +45 -20
- data/sig/steep/type_inference/context_array.rbs +37 -0
- data/sig/steep/type_inference/logic_type_interpreter.rbs +3 -1
- data/sig/steep/type_inference/method_params.rbs +13 -9
- data/sig/steep/type_inference/send_args.rbs +229 -0
- data/sig/steep/type_inference/type_env_builder.rbs +1 -1
- data/sig/steep/typing.rbs +4 -4
- data/sig/steep.rbs +4 -2
- data/smoke/block/e.rb +12 -0
- data/smoke/block/e.rbs +4 -0
- data/smoke/block/test_expectations.yml +12 -0
- data/smoke/regression/block_param_split.rb +7 -0
- data/smoke/regression/block_param_split.rbs +3 -0
- data/smoke/regression/empty_yield.rb +5 -0
- data/smoke/regression/empty_yield.rbs +3 -0
- data/smoke/regression/test_expectations.yml +12 -0
- data/smoke/yield/test_expectations.yml +4 -4
- data/steep.gemspec +2 -1
- metadata +61 -9
- data/lib/steep/interface/interface.rb +0 -34
- data/sig/steep/interface/interface.rbs +0 -23
- data/sig/version.rbs +0 -3
@@ -2,34 +2,36 @@ module Steep
|
|
2
2
|
module Services
|
3
3
|
class ContentChange
|
4
4
|
class Position
|
5
|
-
attr_reader line:
|
5
|
+
attr_reader line: Integer
|
6
6
|
|
7
|
-
attr_reader column:
|
7
|
+
attr_reader column: Integer
|
8
8
|
|
9
|
-
def initialize: (line:
|
9
|
+
def initialize: (line: Integer, column: Integer) -> void
|
10
10
|
|
11
|
-
def ==: (untyped other) ->
|
11
|
+
def ==: (untyped other) -> bool
|
12
12
|
|
13
13
|
alias eql? ==
|
14
14
|
|
15
|
-
def hash: () ->
|
15
|
+
def hash: () -> Integer
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
type range = [Position, Position]
|
19
19
|
|
20
|
-
attr_reader
|
20
|
+
attr_reader range: range?
|
21
21
|
|
22
|
-
|
22
|
+
attr_reader text: String
|
23
23
|
|
24
|
-
def
|
24
|
+
def initialize: (text: String, ?range: range?) -> void
|
25
|
+
|
26
|
+
def ==: (untyped other) -> bool
|
25
27
|
|
26
28
|
alias eql? ==
|
27
29
|
|
28
|
-
def hash: () ->
|
30
|
+
def hash: () -> Integer
|
29
31
|
|
30
|
-
def self.string: (
|
32
|
+
def self.string: (String) -> ContentChange
|
31
33
|
|
32
|
-
def apply_to: (
|
34
|
+
def apply_to: (String text) -> String
|
33
35
|
end
|
34
36
|
end
|
35
37
|
end
|
@@ -1,13 +1,21 @@
|
|
1
1
|
module Steep
|
2
2
|
module Services
|
3
3
|
class FileLoader
|
4
|
-
attr_reader base_dir:
|
4
|
+
attr_reader base_dir: Pathname
|
5
5
|
|
6
|
-
def initialize: (base_dir:
|
6
|
+
def initialize: (base_dir: Pathname) -> void
|
7
7
|
|
8
|
-
|
8
|
+
# Yields relative paths included in `pattern` from `base_dir`
|
9
|
+
#
|
10
|
+
def each_path_in_patterns: (Project::Pattern pattern, ?Array[String] commandline_patterns) { (Pathname) -> void } -> void
|
11
|
+
| (Project::Pattern pattern, ?Array[String] commandline_patterns) -> Enumerator[Pathname, void]
|
9
12
|
|
10
|
-
|
13
|
+
# Returns changes that represents loading files from file system merged with ones given as `changes:`
|
14
|
+
#
|
15
|
+
# ```
|
16
|
+
# changes = loader.load_changes(target.pattern, command_line_patterns, changes: changes_from_editor)
|
17
|
+
# ```
|
18
|
+
def load_changes: (Project::Pattern pattern, ?Array[String] command_line_patterns, changes: Hash[Pathname, Array[ContentChange]]) -> Hash[Pathname, Array[ContentChange]]
|
11
19
|
end
|
12
20
|
end
|
13
21
|
end
|
@@ -2,7 +2,7 @@ module Steep
|
|
2
2
|
module Services
|
3
3
|
module HoverProvider
|
4
4
|
module SingletonMethods
|
5
|
-
def content_for: (service:
|
5
|
+
def content_for: (service: TypeCheckService, path: Pathname, line: Integer, column: Integer) -> (Ruby | RBS | nil)
|
6
6
|
end
|
7
7
|
|
8
8
|
extend SingletonMethods
|
@@ -1,21 +1,21 @@
|
|
1
1
|
module Steep
|
2
2
|
module Services
|
3
3
|
class PathAssignment
|
4
|
-
attr_reader index:
|
4
|
+
attr_reader index: Integer
|
5
5
|
|
6
|
-
attr_reader max_index:
|
6
|
+
attr_reader max_index: Integer
|
7
7
|
|
8
|
-
attr_reader cache:
|
8
|
+
attr_reader cache: Hash[Pathname, Integer]
|
9
9
|
|
10
|
-
def initialize: (index:
|
10
|
+
def initialize: (index: Integer, max_index: Integer) -> void
|
11
11
|
|
12
|
-
def self.all: () ->
|
12
|
+
def self.all: () -> PathAssignment
|
13
13
|
|
14
|
-
def =~: (
|
14
|
+
def =~: (Pathname path) -> bool
|
15
15
|
|
16
16
|
alias === =~
|
17
17
|
|
18
|
-
def self.index_for: (path:
|
18
|
+
def self.index_for: (path: String, max_index: Integer) -> Integer
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -1,91 +1,118 @@
|
|
1
1
|
module Steep
|
2
2
|
module Services
|
3
3
|
class SignatureService
|
4
|
-
|
4
|
+
type status = SyntaxErrorStatus | AncestorErrorStatus | LoadedStatus
|
5
|
+
|
6
|
+
attr_reader status: status
|
5
7
|
|
6
8
|
class SyntaxErrorStatus
|
7
|
-
attr_reader files:
|
9
|
+
attr_reader files: Hash[Pathname, FileStatus]
|
10
|
+
|
11
|
+
attr_reader changed_paths: Set[Pathname]
|
8
12
|
|
9
|
-
attr_reader
|
13
|
+
attr_reader diagnostics: Array[Diagnostic::Signature::Base]
|
10
14
|
|
11
|
-
attr_reader
|
15
|
+
attr_reader last_builder: RBS::DefinitionBuilder
|
12
16
|
|
13
|
-
|
17
|
+
@rbs_index: Index::RBSIndex?
|
14
18
|
|
15
|
-
def initialize: (files:
|
19
|
+
def initialize: (files: Hash[Pathname, FileStatus], changed_paths: Set[Pathname], diagnostics: Array[Diagnostic::Signature::Base], last_builder: RBS::DefinitionBuilder) -> void
|
16
20
|
|
17
|
-
def rbs_index: () ->
|
21
|
+
def rbs_index: () -> Index::RBSIndex
|
18
22
|
end
|
19
23
|
|
20
24
|
class AncestorErrorStatus
|
21
|
-
attr_reader files:
|
25
|
+
attr_reader files: Hash[Pathname, FileStatus]
|
26
|
+
|
27
|
+
attr_reader changed_paths: Set[Pathname]
|
22
28
|
|
23
|
-
attr_reader
|
29
|
+
attr_reader diagnostics: Array[Diagnostic::Signature::Base]
|
24
30
|
|
25
|
-
attr_reader
|
31
|
+
attr_reader last_builder: RBS::DefinitionBuilder
|
26
32
|
|
27
|
-
|
33
|
+
@rbs_index: Index::RBSIndex?
|
28
34
|
|
29
|
-
def initialize: (files:
|
35
|
+
def initialize: (files: Hash[Pathname, FileStatus], changed_paths: Set[Pathname], diagnostics: Array[Diagnostic::Signature::Base], last_builder: RBS::DefinitionBuilder) -> void
|
30
36
|
|
31
|
-
def rbs_index: () ->
|
37
|
+
def rbs_index: () -> Index::RBSIndex
|
32
38
|
end
|
33
39
|
|
34
40
|
class LoadedStatus
|
35
|
-
attr_reader files:
|
41
|
+
attr_reader files: Hash[Pathname, FileStatus]
|
42
|
+
|
43
|
+
attr_reader builder: RBS::DefinitionBuilder
|
44
|
+
|
45
|
+
@rbs_index: Index::RBSIndex?
|
46
|
+
|
47
|
+
@subtyping: Subtyping::Check?
|
48
|
+
|
49
|
+
def initialize: (files: Hash[Pathname, FileStatus], builder: RBS::DefinitionBuilder) -> void
|
50
|
+
|
51
|
+
def subtyping: () -> Subtyping::Check
|
52
|
+
|
53
|
+
def rbs_index: () -> Index::RBSIndex
|
54
|
+
end
|
36
55
|
|
37
|
-
|
56
|
+
class FileStatus
|
57
|
+
attr_reader path: Pathname
|
38
58
|
|
39
|
-
|
59
|
+
attr_reader content: String
|
40
60
|
|
41
|
-
|
61
|
+
attr_reader decls: Array[RBS::AST::Declarations::t] | Diagnostic::Signature::UnexpectedError | RBS::ParsingError
|
42
62
|
|
43
|
-
def
|
63
|
+
def initialize: (
|
64
|
+
path: Pathname,
|
65
|
+
content: String,
|
66
|
+
decls: Array[RBS::AST::Declarations::t] | Diagnostic::Signature::UnexpectedError | RBS::ParsingError
|
67
|
+
) -> void
|
44
68
|
end
|
45
69
|
|
46
|
-
|
70
|
+
def initialize: (env: RBS::Environment) -> void
|
47
71
|
|
48
|
-
def
|
72
|
+
def self.load_from: (RBS::EnvironmentLoader loader) -> SignatureService
|
49
73
|
|
50
|
-
|
74
|
+
@env_rbs_paths: Set[Pathname]?
|
51
75
|
|
52
|
-
def env_rbs_paths: () ->
|
76
|
+
def env_rbs_paths: () -> Set[Pathname]
|
53
77
|
|
54
|
-
def each_rbs_path: () { (
|
78
|
+
def each_rbs_path: () { (Pathname) -> void } -> void
|
79
|
+
| () -> Enumerator[Pathname, void]
|
55
80
|
|
56
|
-
def files: () ->
|
81
|
+
def files: () -> Hash[Pathname, FileStatus]
|
57
82
|
|
58
|
-
def pending_changed_paths: () ->
|
83
|
+
def pending_changed_paths: () -> Set[Pathname]
|
59
84
|
|
60
|
-
def latest_env: () ->
|
85
|
+
def latest_env: () -> RBS::Environment
|
61
86
|
|
62
|
-
def latest_builder: () ->
|
87
|
+
def latest_builder: () -> RBS::DefinitionBuilder
|
63
88
|
|
64
|
-
def latest_rbs_index: () ->
|
89
|
+
def latest_rbs_index: () -> Index::RBSIndex
|
65
90
|
|
66
|
-
def current_subtyping: () ->
|
91
|
+
def current_subtyping: () -> Subtyping::Check?
|
67
92
|
|
68
|
-
def apply_changes: (
|
93
|
+
def apply_changes: (Hash[Pathname, FileStatus] files, Server::ChangeBuffer::changes changes) -> Hash[Pathname, FileStatus]
|
69
94
|
|
70
|
-
def update: (
|
95
|
+
def update: (Server::ChangeBuffer::changes changes) -> void
|
71
96
|
|
72
|
-
def update_env: (
|
97
|
+
def update_env: (
|
98
|
+
Hash[Pathname, FileStatus] updated_files, paths: Set[Pathname]
|
99
|
+
) -> (RBS::DefinitionBuilder::AncestorBuilder | Array[Diagnostic::Signature::Base])
|
73
100
|
|
74
|
-
def rescue_rbs_error: (
|
101
|
+
def rescue_rbs_error: (Array[RBS::BaseError] errors) { () -> void } -> void
|
75
102
|
|
76
|
-
def update_builder: (ancestor_builder:
|
103
|
+
def update_builder: (ancestor_builder: RBS::DefinitionBuilder::AncestorBuilder, paths: Set[Pathname]) -> RBS::DefinitionBuilder
|
77
104
|
|
78
|
-
def type_names: (paths:
|
105
|
+
def type_names: (paths: Set[Pathname], env: RBS::Environment) -> Set[RBS::TypeName]
|
79
106
|
|
80
|
-
def const_decls: (paths:
|
107
|
+
def const_decls: (paths: Set[Pathname], env: RBS::Environment) -> Hash[RBS::TypeName, RBS::Environment::SingleEntry[RBS::TypeName, RBS::AST::Declarations::Constant]]
|
81
108
|
|
82
|
-
def global_decls: (paths:
|
109
|
+
def global_decls: (paths: Set[Pathname], ?env: RBS::Environment) -> Hash[Symbol, RBS::Environment::SingleEntry[Symbol, RBS::AST::Declarations::Global]]
|
83
110
|
|
84
|
-
def type_name_from_decl: (
|
111
|
+
def type_name_from_decl: (RBS::AST::Declarations::t decl, set: Set[RBS::TypeName]) -> void
|
85
112
|
|
86
|
-
def add_descendants: (graph:
|
113
|
+
def add_descendants: (graph: RBS::AncestorGraph, names: Set[RBS::TypeName], set: Set[RBS::TypeName]) -> void
|
87
114
|
|
88
|
-
def add_nested_decls: (env:
|
115
|
+
def add_nested_decls: (env: RBS::Environment, names: Set[RBS::TypeName], set: Set[RBS::TypeName]) -> void
|
89
116
|
end
|
90
117
|
end
|
91
118
|
end
|
@@ -1,93 +1,107 @@
|
|
1
1
|
module Steep
|
2
2
|
module Services
|
3
3
|
class TypeCheckService
|
4
|
-
attr_reader project:
|
4
|
+
attr_reader project: Project
|
5
5
|
|
6
|
-
attr_reader signature_validation_diagnostics:
|
6
|
+
attr_reader signature_validation_diagnostics: Hash[Symbol, Hash[Pathname, Array[Diagnostic::Signature::Base]]]
|
7
7
|
|
8
|
-
attr_reader source_files:
|
8
|
+
attr_reader source_files: Hash[Pathname, SourceFile]
|
9
9
|
|
10
|
-
attr_reader signature_services:
|
10
|
+
attr_reader signature_services: Hash[Symbol, SignatureService]
|
11
11
|
|
12
12
|
class SourceFile
|
13
|
-
attr_reader path:
|
13
|
+
attr_reader path: Pathname
|
14
14
|
|
15
|
-
attr_reader target:
|
15
|
+
attr_reader target: Project::Target
|
16
16
|
|
17
|
-
attr_reader content:
|
17
|
+
attr_reader content: String
|
18
18
|
|
19
|
-
attr_reader node:
|
19
|
+
attr_reader node: Parser::AST::Node | nil | false
|
20
20
|
|
21
|
-
attr_reader typing:
|
21
|
+
attr_reader typing: Typing?
|
22
22
|
|
23
|
-
attr_reader errors:
|
23
|
+
attr_reader errors: Array[Diagnostic::Ruby::Base]?
|
24
24
|
|
25
|
-
def initialize: (
|
25
|
+
def initialize: (
|
26
|
+
path: Pathname,
|
27
|
+
node: Parser::AST::Node | nil | false,
|
28
|
+
content: String,
|
29
|
+
typing: Typing?,
|
30
|
+
errors: Array[Diagnostic::Ruby::Base]?
|
31
|
+
) -> void
|
26
32
|
|
27
|
-
def self.with_syntax_error: (path:
|
33
|
+
def self.with_syntax_error: (path: Pathname, content: String, error: Diagnostic::Ruby::SyntaxError) -> SourceFile
|
28
34
|
|
29
|
-
def self.with_typing: (path:
|
35
|
+
def self.with_typing: (path: Pathname, content: String, typing: Typing, node: Parser::AST::Node?) -> SourceFile
|
30
36
|
|
31
|
-
def self.no_data: (path:
|
37
|
+
def self.no_data: (path: Pathname, content: String) -> SourceFile
|
32
38
|
|
33
|
-
def update_content: (
|
39
|
+
def update_content: (String content) -> SourceFile
|
34
40
|
|
35
|
-
def diagnostics: () ->
|
41
|
+
def diagnostics: () -> Array[Diagnostic::Ruby::Base]
|
36
42
|
end
|
37
43
|
|
38
44
|
class TargetRequest
|
39
|
-
attr_reader target:
|
45
|
+
attr_reader target: Project::Target
|
40
46
|
|
41
|
-
attr_reader source_paths:
|
47
|
+
attr_reader source_paths: Set[Pathname]
|
42
48
|
|
43
|
-
|
49
|
+
@signature_updated: bool
|
50
|
+
|
51
|
+
def initialize: (target: Project::Target) -> void
|
44
52
|
|
45
53
|
def signature_updated!: (?bool value) -> self
|
46
54
|
|
47
|
-
def signature_updated?: () ->
|
55
|
+
def signature_updated?: () -> bool
|
48
56
|
|
49
|
-
def empty?: () ->
|
57
|
+
def empty?: () -> bool
|
50
58
|
|
51
|
-
def ==: (untyped other) ->
|
59
|
+
def ==: (untyped other) -> bool
|
52
60
|
|
53
61
|
alias eql? ==
|
54
62
|
|
55
|
-
def hash: () ->
|
63
|
+
def hash: () -> Integer
|
56
64
|
end
|
57
65
|
|
58
|
-
def initialize: (project:
|
66
|
+
def initialize: (project: Project) -> void
|
59
67
|
|
60
|
-
def signature_diagnostics: () ->
|
68
|
+
def signature_diagnostics: () -> Hash[Pathname, Array[Diagnostic::Signature::Base]]
|
61
69
|
|
62
|
-
def has_diagnostics?: () ->
|
70
|
+
def has_diagnostics?: () -> bool
|
63
71
|
|
64
|
-
def diagnostics: () ->
|
72
|
+
def diagnostics: () -> Hash[Pathname, Array[Diagnostic::Ruby::Base | Diagnostic::Signature::Base]]
|
65
73
|
|
66
|
-
def each_diagnostics: () { (
|
74
|
+
def each_diagnostics: () { ([Pathname, Array[Diagnostic::Ruby::Base] | Array[Diagnostic::Signature::Base]]) -> void } -> void
|
75
|
+
| () -> Enumerator[[Pathname, Array[Diagnostic::Ruby::Base] | Array[Diagnostic::Signature::Base]], void]
|
67
76
|
|
68
|
-
def update: (changes:
|
77
|
+
def update: (changes: Server::ChangeBuffer::changes) -> Hash[Project::Target, TargetRequest]
|
69
78
|
|
70
|
-
def update_and_check: (
|
79
|
+
def update_and_check: (
|
80
|
+
changes: Server::ChangeBuffer::changes,
|
81
|
+
assignment: PathAssignment
|
82
|
+
) {
|
83
|
+
([Pathname, Array[Diagnostic::Signature::Base] | Array[Diagnostic::Ruby::Base]]) -> void
|
84
|
+
} -> void
|
71
85
|
|
72
|
-
def validate_signature: (path:
|
86
|
+
def validate_signature: (path: Pathname) { ([Pathname, Array[Diagnostic::Signature::Base]]) -> void } -> void
|
73
87
|
|
74
|
-
def typecheck_source: (path:
|
88
|
+
def typecheck_source: (path: Pathname, ?target: Project::Target?) { ([Pathname, Array[Diagnostic::Ruby::Base]]) -> void } -> void
|
75
89
|
|
76
|
-
def update_signature: (changes:
|
90
|
+
def update_signature: (changes: Server::ChangeBuffer::changes, requests: Hash[Project::Target, TargetRequest]) -> void
|
77
91
|
|
78
|
-
def update_sources: (changes:
|
92
|
+
def update_sources: (changes: Server::ChangeBuffer::changes, requests: Hash[Project::Target, TargetRequest]) -> void
|
79
93
|
|
80
|
-
def type_check_file: (target:
|
94
|
+
def type_check_file: (target: Project::Target, subtyping: Subtyping::Check, path: Pathname, text: String) -> SourceFile
|
81
95
|
|
82
96
|
def self.type_check: (source: Source, subtyping: Subtyping::Check) -> Typing
|
83
97
|
|
84
|
-
def source_file?: (Pathname path) ->
|
98
|
+
def source_file?: (Pathname path) -> Project::Target?
|
85
99
|
|
86
|
-
def signature_file?: (Pathname path) ->
|
100
|
+
def signature_file?: (Pathname path) -> Array[Symbol]?
|
87
101
|
|
88
|
-
def app_signature_file?: (Pathname path) ->
|
102
|
+
def app_signature_file?: (Pathname path) -> Array[Symbol]?
|
89
103
|
|
90
|
-
def lib_signature_file?: (Pathname path) ->
|
104
|
+
def lib_signature_file?: (Pathname path) -> bool
|
91
105
|
end
|
92
106
|
end
|
93
107
|
end
|
@@ -1,93 +1,129 @@
|
|
1
1
|
module Steep
|
2
2
|
module Subtyping
|
3
3
|
class Check
|
4
|
-
attr_reader
|
4
|
+
attr_reader builder: Interface::Builder
|
5
5
|
|
6
|
-
attr_reader cache:
|
6
|
+
attr_reader cache: Cache
|
7
7
|
|
8
|
-
|
8
|
+
@assumptions: Set[Relation[untyped]]?
|
9
9
|
|
10
|
-
|
10
|
+
@bounds: Array[Hash[Symbol, AST::Types::t?]]
|
11
11
|
|
12
|
-
|
12
|
+
@self_type: AST::Types::t?
|
13
13
|
|
14
|
-
|
14
|
+
@instance_type: AST::Types::t?
|
15
15
|
|
16
|
-
|
16
|
+
@class_type: AST::Types::t?
|
17
17
|
|
18
|
-
|
18
|
+
@constraints: Constraints?
|
19
19
|
|
20
|
-
def
|
20
|
+
def initialize: (builder: Interface::Builder) -> void
|
21
21
|
|
22
|
-
def
|
22
|
+
def factory: () -> AST::Types::Factory
|
23
23
|
|
24
|
-
def class_type: () ->
|
24
|
+
def with_context: [A] (self_type: AST::Types::t, instance_type: AST::Types::t, class_type: AST::Types::t, constraints: Constraints) { () -> A } -> A
|
25
25
|
|
26
|
-
def
|
26
|
+
def self_type: () -> AST::Types::t
|
27
27
|
|
28
|
-
def
|
28
|
+
def instance_type: () -> AST::Types::t
|
29
29
|
|
30
|
-
def
|
30
|
+
def class_type: () -> AST::Types::t
|
31
31
|
|
32
|
-
def
|
32
|
+
def constraints: () -> Constraints
|
33
33
|
|
34
|
-
def
|
34
|
+
def push_variable_bounds: [A] (Array[Interface::TypeParam] | Hash[Symbol, AST::Types::t?] params) { () -> A } -> A
|
35
35
|
|
36
|
-
def
|
36
|
+
def variable_upper_bound: (Symbol name) -> AST::Types::t?
|
37
37
|
|
38
|
-
def
|
38
|
+
def variable_upper_bounds: () -> Hash[Symbol, AST::Types::t?]
|
39
39
|
|
40
|
-
def
|
40
|
+
def push_assumption: [A] (Relation[untyped] relation) { () -> A } -> A
|
41
41
|
|
42
|
-
def
|
42
|
+
def assumptions: () -> Set[Relation[untyped]]
|
43
43
|
|
44
|
-
def
|
44
|
+
def each_ancestor: (RBS::DefinitionBuilder::AncestorBuilder::OneAncestors ancestors) { (RBS::Definition::Ancestor::t) -> void } -> void
|
45
|
+
| (RBS::DefinitionBuilder::AncestorBuilder::OneAncestors ancestors) -> Enumerator[RBS::Definition::Ancestor::t, void]
|
45
46
|
|
46
|
-
|
47
|
+
type super_type = AST::Types::Name::Instance | AST::Types::Name::Interface | AST::Types::Name::Singleton
|
48
|
+
|
49
|
+
def instance_super_types: (RBS::TypeName type_name, args: Array[AST::Types::t]) -> Array[super_type]
|
50
|
+
|
51
|
+
def singleton_super_types: (RBS::TypeName type_name) -> Array[super_type]
|
52
|
+
|
53
|
+
def check: (Relation[AST::Types::t] relation, constraints: Constraints, self_type: AST::Types::t, instance_type: AST::Types::t, class_type: AST::Types::t) -> Result::t
|
54
|
+
|
55
|
+
def check_type: (Relation[AST::Types::t] relation) -> Result::t
|
56
|
+
|
57
|
+
def cache_bounds: (Relation[AST::Types::t] relation) -> Hash[Symbol, AST::Types::t?]
|
58
|
+
|
59
|
+
def alias?: (AST::Types::t `type`) -> bool
|
60
|
+
|
61
|
+
def cacheable?: (Relation[AST::Types::t] relation) -> bool
|
62
|
+
|
63
|
+
def true_type?: (AST::Types::t `type`) -> bool
|
64
|
+
|
65
|
+
def false_type?: (AST::Types::t `type`) -> bool
|
47
66
|
|
48
67
|
include Result::Helper
|
49
68
|
|
50
|
-
def check_type0: (
|
69
|
+
def check_type0: (Relation[AST::Types::t] relation) -> Result::t
|
51
70
|
|
52
|
-
def definition_for_type: (
|
71
|
+
def definition_for_type: (AST::Types::t `type`) -> RBS::Definition
|
53
72
|
|
54
|
-
|
73
|
+
# Returns true if given `type` is with one or more type arguments.
|
74
|
+
#
|
75
|
+
def arg_type?: (AST::Types::t `type`) -> bool
|
55
76
|
|
56
|
-
|
77
|
+
type application_type = AST::Types::Name::Instance | AST::Types::Name::Interface | AST::Types::Name::Alias
|
57
78
|
|
58
|
-
def
|
79
|
+
def check_type_arg: (Relation[application_type] relation) -> untyped
|
59
80
|
|
60
|
-
def
|
81
|
+
def same_type?: (Relation[AST::Types::t] relation) -> bool
|
61
82
|
|
62
|
-
def
|
83
|
+
def check_interface: (Relation[Interface::Shape] relation) -> Result::t
|
63
84
|
|
64
|
-
def
|
85
|
+
def check_method: (Symbol name, Relation[Interface::Shape::Entry] relation) -> Result::t
|
65
86
|
|
66
|
-
def check_generic_method_type: (
|
87
|
+
def check_generic_method_type: (Symbol name, Relation[Interface::MethodType] relation) -> Result::t
|
67
88
|
|
68
|
-
def check_constraints: (untyped relation, variables:
|
89
|
+
def check_constraints: (Relation[untyped] relation, variables: Enumerable[Symbol], variance: VariableVariance) -> Result::t
|
69
90
|
|
70
|
-
def check_method_type: (
|
91
|
+
def check_method_type: (Symbol name, Relation[Interface::MethodType] relation) -> Result::t
|
71
92
|
|
72
|
-
|
93
|
+
# Receives subtyping relation of blocks `b <: b'` where `b` and `b'` are expanded from
|
94
|
+
# subtyping relation of two method types `(...) _b_ -> T <: (...) _b'_ -> S`.
|
95
|
+
#
|
96
|
+
# Returns `true` is the relation is satisfied immediately.
|
97
|
+
# Returns a Relation when the given relation can be expanded to relation between Interface::Block.
|
98
|
+
# Returns a failure otherwise.
|
99
|
+
#
|
100
|
+
def expand_block_given: (Symbol name, Relation[Interface::Block?] relation) -> (Relation[Interface::Block] | true | Result::t)
|
73
101
|
|
74
|
-
|
102
|
+
# Receives a subtyping relation between self bindings `S <: S'` that is included in procs or blocks as:
|
103
|
+
#
|
104
|
+
# * `^() [self: S] -> T <: ^() [self: S'] -> T` (proc)
|
105
|
+
# * `() { () [self: S'] -> T } -> T <: () { () [self: S] -> T } -> T` (block in method type)
|
106
|
+
#
|
107
|
+
def check_self_type_binding: (Relation[untyped], AST::Types::t? sub_self, AST::Types::t? super_self) -> Result::t?
|
75
108
|
|
76
|
-
def
|
109
|
+
def check_function: (Symbol name, Relation[Interface::Function] relation) -> Result::t
|
77
110
|
|
78
|
-
|
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
|
111
|
+
def check_method_params: (Symbol name, Relation[Interface::Function::Params] relation) -> Result::t
|
83
112
|
|
84
|
-
|
113
|
+
# Returns `nil` when given two method_types are structually comparable.
|
114
|
+
# Returns a failure otherwise.
|
115
|
+
#
|
116
|
+
def match_method_type_fails?: (Symbol name, Interface::MethodType method_type1, Interface::MethodType method_type2) -> (nil | Result::t)
|
85
117
|
|
86
|
-
def
|
118
|
+
def match_params: (Symbol name, Relation[Interface::Function::Params] relation) -> (Array[[AST::Types::t, AST::Types::t]] | Result::t)
|
119
|
+
|
120
|
+
def expand_alias: (AST::Types::t `type`) -> AST::Types::t
|
87
121
|
|
88
122
|
# Returns the shortest type paths for one of the _unknown_ type variables.
|
89
123
|
# Returns nil if there is no path.
|
90
|
-
def hole_path: (
|
124
|
+
def hole_path: (AST::Types::t `type`, ?Array[AST::Types::t] path) -> Array[AST::Types::t]?
|
125
|
+
|
126
|
+
def Relation: [T < Object] (T sub, T sup) -> Relation[T]
|
91
127
|
end
|
92
128
|
end
|
93
129
|
end
|