rbs 4.0.0.dev.2 → 4.0.0.dev.3
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/.clang-format +74 -0
- data/.clangd +2 -0
- data/.github/workflows/c-check.yml +51 -0
- data/.github/workflows/dependabot.yml +1 -1
- data/.github/workflows/ruby.yml +0 -17
- data/.github/workflows/typecheck.yml +0 -2
- data/.gitignore +4 -0
- data/.rubocop.yml +1 -1
- data/.vscode/extensions.json +5 -0
- data/.vscode/settings.json +19 -0
- data/README.md +37 -0
- data/Rakefile +82 -0
- data/config.yml +1 -1
- data/core/enumerable.rbs +9 -0
- data/core/io.rbs +4 -4
- data/core/thread.rbs +0 -7
- data/ext/rbs_extension/ast_translation.c +1008 -1074
- data/ext/rbs_extension/class_constants.c +78 -74
- data/ext/rbs_extension/compat.h +3 -3
- data/ext/rbs_extension/extconf.rb +11 -1
- data/ext/rbs_extension/legacy_location.c +173 -172
- data/ext/rbs_extension/legacy_location.h +3 -3
- data/ext/rbs_extension/main.c +315 -273
- data/include/rbs/ast.h +11 -12
- data/include/rbs/defines.h +11 -12
- data/include/rbs/lexer.h +105 -105
- data/include/rbs/location.h +14 -14
- data/include/rbs/parser.h +21 -19
- data/include/rbs/string.h +3 -3
- data/include/rbs/util/rbs_allocator.h +14 -14
- data/include/rbs/util/rbs_constant_pool.h +3 -3
- data/include/rbs/util/rbs_encoding.h +1 -1
- data/lib/rbs/environment.rb +4 -0
- data/lib/rbs/namespace.rb +0 -7
- data/lib/rbs/parser_aux.rb +5 -0
- data/lib/rbs/type_name.rb +0 -7
- data/lib/rbs/types.rb +3 -1
- data/lib/rbs/unit_test/convertibles.rb +1 -0
- data/lib/rbs/version.rb +1 -1
- data/sig/environment.rbs +3 -0
- data/sig/namespace.rbs +0 -5
- data/sig/parser.rbs +20 -0
- data/sig/typename.rbs +0 -5
- data/sig/types.rbs +4 -1
- data/src/ast.c +216 -214
- data/src/lexer.c +2923 -2675
- data/src/lexstate.c +155 -155
- data/src/location.c +40 -40
- data/src/parser.c +2591 -2586
- data/src/string.c +2 -2
- data/src/util/rbs_allocator.c +7 -9
- data/src/util/rbs_assert.c +9 -9
- data/src/util/rbs_constant_pool.c +5 -7
- data/src/util/rbs_encoding.c +20095 -4056
- data/src/util/rbs_unescape.c +33 -32
- data/stdlib/json/0/json.rbs +9 -43
- data/stdlib/ripper/0/ripper.rbs +3 -0
- data/stdlib/socket/0/addrinfo.rbs +2 -2
- metadata +7 -2
data/sig/environment.rbs
CHANGED
@@ -30,6 +30,9 @@ module RBS
|
|
30
30
|
class GlobalEntry < SingleEntry[Symbol, AST::Declarations::Global]
|
31
31
|
end
|
32
32
|
|
33
|
+
# Top level declarations
|
34
|
+
def declarations: () -> Array[AST::Ruby::Declarations::t | AST::Declarations::t]
|
35
|
+
|
33
36
|
# Array of source objects loaded in the environment
|
34
37
|
#
|
35
38
|
attr_reader sources: Array[Source::t]
|
data/sig/namespace.rbs
CHANGED
data/sig/parser.rbs
CHANGED
@@ -68,6 +68,24 @@ module RBS
|
|
68
68
|
#
|
69
69
|
def self.parse_signature: (Buffer | String) -> [Buffer, Array[AST::Directives::t], Array[AST::Declarations::t]]
|
70
70
|
|
71
|
+
# Parse a list of type parameters and return it
|
72
|
+
#
|
73
|
+
# ```ruby
|
74
|
+
# RBS::Parser.parse_type_params("") # => nil
|
75
|
+
# RBS::Parser.parse_type_params("[U, V]") # => `[:U, :V]`
|
76
|
+
# RBS::Parser.parse_type_params("[in U, V < Integer]") # => `[:U, :V]`
|
77
|
+
# ```
|
78
|
+
#
|
79
|
+
# When `module_type_params` is `false`, an error is raised if `unchecked`, `in` or `out` are used.
|
80
|
+
#
|
81
|
+
# ```ruby
|
82
|
+
# RBS::Parser.parse_type_params("[unchecked U]", module_type_params: false) # => Raises an error
|
83
|
+
# RBS::Parser.parse_type_params("[out U]", module_type_params: false) # => Raises an error
|
84
|
+
# RBS::Parser.parse_type_params("[in U]", module_type_params: false) # => Raises an error
|
85
|
+
# ```
|
86
|
+
#
|
87
|
+
def self.parse_type_params: (Buffer | String, ?module_type_params: bool) -> Array[AST::TypeParam]
|
88
|
+
|
71
89
|
# Returns the magic comment from the buffer
|
72
90
|
#
|
73
91
|
def self.magic_comment: (Buffer) -> AST::Directives::ResolveTypeNames?
|
@@ -104,6 +122,8 @@ module RBS
|
|
104
122
|
|
105
123
|
def self._parse_signature: (Buffer, Integer start_pos, Integer end_pos) -> [Array[AST::Directives::t], Array[AST::Declarations::t]]
|
106
124
|
|
125
|
+
def self._parse_type_params: (Buffer, Integer start_pos, Integer end_pos, bool module_type_params) -> Array[AST::TypeParam]
|
126
|
+
|
107
127
|
def self._lex: (Buffer, Integer end_pos) -> Array[[Symbol, Location[untyped, untyped]]]
|
108
128
|
|
109
129
|
def self._parse_inline_leading_annotation: (Buffer, Integer start_pos, Integer end_pos, Array[Symbol] variables) -> AST::Ruby::Annotations::leading_annotation
|
data/sig/typename.rbs
CHANGED
data/sig/types.rbs
CHANGED
@@ -518,7 +518,10 @@ module RBS
|
|
518
518
|
|
519
519
|
attr_reader self_type: t?
|
520
520
|
|
521
|
-
|
521
|
+
type loc = Location[bot, bot]
|
522
|
+
attr_reader location: loc?
|
523
|
+
|
524
|
+
def initialize: (?location: loc?, type: function, ?self_type: t?, required: boolish) -> void
|
522
525
|
|
523
526
|
def ==: (untyped other) -> bool
|
524
527
|
|