rbs 4.0.3 → 4.1.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/.github/workflows/ruby.yml +34 -6
- data/.github/workflows/rust.yml +0 -2
- data/.github/workflows/windows.yml +0 -3
- data/CHANGELOG.md +0 -8
- data/Rakefile +2 -2
- data/config.yml +24 -0
- data/core/builtin.rbs +1 -0
- data/core/class.rbs +5 -3
- data/core/kernel.rbs +26 -11
- data/core/ruby_vm.rbs +40 -0
- data/docs/inline.md +29 -1
- data/ext/rbs_extension/ast_translation.c +21 -0
- data/ext/rbs_extension/class_constants.c +2 -0
- data/ext/rbs_extension/class_constants.h +1 -0
- data/ext/rbs_extension/extconf.rb +1 -0
- data/include/rbs/ast.h +314 -297
- data/include/rbs/defines.h +13 -0
- data/include/rbs/lexer.h +1 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +27 -31
- data/lib/rbs/ast/ruby/annotations.rb +42 -0
- data/lib/rbs/ast/ruby/declarations.rb +11 -1
- data/lib/rbs/ast/ruby/members.rb +28 -0
- data/lib/rbs/cli.rb +3 -5
- data/lib/rbs/collection/config/lockfile_generator.rb +14 -1
- data/lib/rbs/environment.rb +6 -0
- data/lib/rbs/inline_parser.rb +49 -25
- data/lib/rbs/rewriter.rb +70 -0
- data/lib/rbs/test/type_check.rb +6 -1
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +1 -0
- data/sig/annotate/rdoc_annotater.rbs +12 -9
- data/sig/ast/ruby/annotations.rbs +49 -0
- data/sig/ast/ruby/members.rbs +15 -0
- data/sig/collection/config/lockfile_generator.rbs +2 -0
- data/sig/inline_parser.rbs +2 -0
- data/sig/manifest.yaml +0 -1
- data/sig/rewriter.rbs +45 -0
- data/src/ast.c +109 -85
- data/src/lexer.c +137 -114
- data/src/lexer.re +1 -0
- data/src/lexstate.c +1 -0
- data/src/parser.c +55 -5
- data/stdlib/openssl/0/openssl.rbs +2 -2
- metadata +3 -1
data/sig/ast/ruby/members.rbs
CHANGED
|
@@ -16,6 +16,7 @@ module RBS
|
|
|
16
16
|
| IncludeMember | ExtendMember | PrependMember
|
|
17
17
|
| AttrReaderMember | AttrWriterMember | AttrAccessorMember
|
|
18
18
|
| InstanceVariableMember
|
|
19
|
+
| ModuleSelfMember
|
|
19
20
|
|
|
20
21
|
class MethodTypeAnnotation
|
|
21
22
|
class DocStyle
|
|
@@ -172,6 +173,20 @@ module RBS
|
|
|
172
173
|
|
|
173
174
|
def type_fingerprint: () -> untyped
|
|
174
175
|
end
|
|
176
|
+
|
|
177
|
+
class ModuleSelfMember < Base
|
|
178
|
+
attr_reader annotation: Annotations::ModuleSelfAnnotation
|
|
179
|
+
|
|
180
|
+
def initialize: (Buffer, Annotations::ModuleSelfAnnotation) -> void
|
|
181
|
+
|
|
182
|
+
def name: () -> TypeName
|
|
183
|
+
|
|
184
|
+
def args: () -> Array[Types::t]
|
|
185
|
+
|
|
186
|
+
def location: () -> Location
|
|
187
|
+
|
|
188
|
+
def type_fingerprint: () -> untyped
|
|
189
|
+
end
|
|
175
190
|
end
|
|
176
191
|
end
|
|
177
192
|
end
|
data/sig/inline_parser.rbs
CHANGED
|
@@ -110,6 +110,8 @@ module RBS
|
|
|
110
110
|
|
|
111
111
|
def report_unused_block: (AST::Ruby::CommentBlock) -> void
|
|
112
112
|
|
|
113
|
+
def visit_class_or_module_body: (module_context, Prism::ClassNode | Prism::ModuleNode) -> void
|
|
114
|
+
|
|
113
115
|
private
|
|
114
116
|
|
|
115
117
|
def parse_mixin_call: (Prism::CallNode) -> void
|
data/sig/manifest.yaml
CHANGED
data/sig/rewriter.rbs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module RBS
|
|
2
|
+
# Rewriter performs targeted character-range replacements on Buffer content.
|
|
3
|
+
#
|
|
4
|
+
# Unlike Writer which regenerates entire source from AST, Rewriter preserves
|
|
5
|
+
# everything outside the rewritten ranges, including non-documentation comments.
|
|
6
|
+
#
|
|
7
|
+
# Rewrite requests are buffered and applied all at once when `#string` is called.
|
|
8
|
+
#
|
|
9
|
+
class Rewriter
|
|
10
|
+
attr_reader buffer: Buffer
|
|
11
|
+
|
|
12
|
+
# Initialize with a toplevel buffer.
|
|
13
|
+
# Raises if the buffer has a parent (non-toplevel).
|
|
14
|
+
#
|
|
15
|
+
def initialize: (Buffer buffer) -> void
|
|
16
|
+
|
|
17
|
+
# Register a rewrite request for the given location.
|
|
18
|
+
#
|
|
19
|
+
def rewrite: (Location[untyped, untyped] location, String string) -> self
|
|
20
|
+
|
|
21
|
+
# Add a new comment before the earliest of the given locations.
|
|
22
|
+
#
|
|
23
|
+
def add_comment: (*Location[untyped, untyped] locations, content: String) -> self
|
|
24
|
+
|
|
25
|
+
# Replace an existing comment's content.
|
|
26
|
+
#
|
|
27
|
+
def replace_comment: (AST::Comment comment, content: String) -> self
|
|
28
|
+
|
|
29
|
+
# Delete an existing comment.
|
|
30
|
+
#
|
|
31
|
+
def delete_comment: (AST::Comment comment) -> self
|
|
32
|
+
|
|
33
|
+
# Apply all buffered rewrites and return the resulting string.
|
|
34
|
+
#
|
|
35
|
+
# Raises if any rewrite ranges overlap.
|
|
36
|
+
#
|
|
37
|
+
def string: () -> String
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def format_comment: (String content, String indent) -> String
|
|
42
|
+
|
|
43
|
+
@rewrites: Array[[Location[untyped, untyped], String]]
|
|
44
|
+
end
|
|
45
|
+
end
|