rbs-trace 0.3.2 → 0.4.0

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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +11 -1
  3. data/CHANGELOG.md +26 -0
  4. data/README.md +44 -24
  5. data/Rakefile +7 -0
  6. data/exe/rbs-trace +8 -0
  7. data/lib/rbs/trace/builder.rb +124 -0
  8. data/lib/rbs/trace/cli/inline.rb +62 -0
  9. data/lib/rbs/trace/cli/merge.rb +102 -0
  10. data/lib/rbs/trace/cli.rb +40 -0
  11. data/lib/rbs/trace/file.rb +66 -21
  12. data/lib/rbs/trace/helpers.rb +75 -0
  13. data/lib/rbs/trace/inline_comment_visitor.rb +63 -0
  14. data/lib/rbs/trace/overload_compact.rb +85 -0
  15. data/lib/rbs/trace/return_value_visitor.rb +63 -0
  16. data/lib/rbs/trace/version.rb +2 -2
  17. data/lib/rbs/trace.rb +153 -4
  18. data/rbs_collection.lock.yaml +0 -4
  19. data/sig/generated/rbs/trace/builder.rbs +33 -0
  20. data/sig/generated/rbs/trace/cli/inline.rbs +19 -0
  21. data/sig/generated/rbs/trace/cli/merge.rbs +24 -0
  22. data/sig/generated/rbs/trace/cli.rbs +17 -0
  23. data/sig/generated/rbs/trace/file.rbs +20 -9
  24. data/sig/generated/rbs/trace/helpers.rbs +33 -0
  25. data/sig/generated/rbs/trace/inline_comment_visitor.rbs +27 -0
  26. data/sig/generated/rbs/trace/overload_compact.rbs +21 -0
  27. data/sig/generated/rbs/trace/return_value_visitor.rbs +27 -0
  28. data/sig/generated/rbs/trace/version.rbs +1 -1
  29. data/sig/generated/rbs/trace.rbs +63 -1
  30. data/tmp/.keep +0 -0
  31. metadata +38 -11
  32. data/lib/rbs/trace/declaration.rb +0 -107
  33. data/lib/rbs/trace/definition.rb +0 -33
  34. data/lib/rbs/trace/method_tracing.rb +0 -182
  35. data/sig/generated/rbs/trace/declaration.rbs +0 -36
  36. data/sig/generated/rbs/trace/definition.rbs +0 -25
  37. data/sig/generated/rbs/trace/method_tracing.rbs +0 -63
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RBS
4
+ class Trace
5
+ module Helpers
6
+ UNBOUND_CLASS_METHOD = Object.instance_method(:class)
7
+ private_constant :UNBOUND_CLASS_METHOD
8
+
9
+ # @rbs (name: TypeName) -> AST::Declarations::Module
10
+ def new_module_decl(name:)
11
+ AST::Declarations::Module.new(
12
+ name:,
13
+ type_params: [],
14
+ self_types: [],
15
+ members: [],
16
+ annotations: [],
17
+ location: nil,
18
+ comment: nil
19
+ )
20
+ end
21
+
22
+ # @rbs (name: TypeName) -> AST::Declarations::Class
23
+ def new_class_decl(name:)
24
+ AST::Declarations::Class.new(
25
+ name:,
26
+ type_params: [],
27
+ super_class: nil,
28
+ members: [],
29
+ annotations: [],
30
+ location: nil,
31
+ comment: nil
32
+ )
33
+ end
34
+
35
+ # @rbs (name: Symbol, kind: (:singleton | :instance)) -> AST::Members::MethodDefinition
36
+ def new_method_definition(name:, kind:)
37
+ AST::Members::MethodDefinition.new(
38
+ name:,
39
+ kind:,
40
+ overloads: [],
41
+ annotations: [],
42
+ location: nil,
43
+ comment: nil,
44
+ overloading: false,
45
+ visibility: nil
46
+ )
47
+ end
48
+
49
+ # @rbs (BasicObject) -> Class
50
+ def obj_to_class(obj)
51
+ UNBOUND_CLASS_METHOD.bind_call(obj)
52
+ end
53
+
54
+ # @rbs () -> Types::Bases::Void
55
+ def type_void
56
+ @type_void = Types::Bases::Void.new(location: nil)
57
+ end
58
+
59
+ # @rbs () -> Types::Bases::Nil
60
+ def type_nil
61
+ @type_nil ||= Types::Bases::Nil.new(location: nil)
62
+ end
63
+
64
+ # @rbs () -> Types::Bases::Bool
65
+ def type_bool
66
+ @type_bool ||= Types::Bases::Bool.new(location: nil)
67
+ end
68
+
69
+ # @rbs () -> Types::Bases::Any
70
+ def type_untyped
71
+ @type_untyped ||= Types::Bases::Any.new(location: nil)
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RBS
4
+ class Trace
5
+ class InlineCommentVisitor < Prism::Visitor
6
+ # @rbs (Hash[TypeName, AST::Declarations::t], Hash[Integer, String]) -> void
7
+ def initialize(decls, comments)
8
+ @decls = decls
9
+ @comments = comments
10
+ @context = [] #: Array[Symbol]
11
+
12
+ super()
13
+ end
14
+
15
+ # @rbs override
16
+ # @rbs (Prism::Node) -> void
17
+ def visit_class_node(node)
18
+ @context.push(node.name)
19
+ super
20
+ @context.pop
21
+ end
22
+
23
+ # @rbs override
24
+ # @rbs (Prism::Node) -> void
25
+ def visit_module_node(node)
26
+ @context.push(node.name)
27
+ super
28
+ @context.pop
29
+ end
30
+
31
+ # @rbs override
32
+ # @rbs (Prism::Node) -> void
33
+ def visit_def_node(node)
34
+ member = find_method_definition(node.name)
35
+ if member
36
+ lineno = node.location.start_line - 1
37
+ indent = " " * node.location.start_column
38
+ overloads = OverloadCompact.new(member.overloads).call
39
+ comment = overloads.map(&:method_type).join(" | ")
40
+
41
+ @comments[lineno] = "#{indent}# @rbs #{comment}\n"
42
+ end
43
+
44
+ super
45
+ end
46
+
47
+ private
48
+
49
+ # @rbs (Symbol) -> AST::Members::MethodDefinition?
50
+ def find_method_definition(name)
51
+ return if @context.empty?
52
+
53
+ type_name = TypeName.parse("::#{@context.join("::")}")
54
+ decl = @decls[type_name]
55
+ return unless decl
56
+
57
+ decl.members.find do |member|
58
+ member.is_a?(AST::Members::MethodDefinition) && member.name == name
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RBS
4
+ class Trace
5
+ class OverloadCompact
6
+ # @rbs (Array[AST::Members::MethodDefinition::Overload]) -> void
7
+ def initialize(overloads)
8
+ @overloads = overloads
9
+ end
10
+
11
+ # @rbs () -> Array[AST::Members::MethodDefinition::Overload]
12
+ def call
13
+ method_type = merge_method_types(@overloads.map(&:method_type))
14
+ [AST::Members::MethodDefinition::Overload.new(method_type:, annotations: [])]
15
+ end
16
+
17
+ private
18
+
19
+ # @rbs (Array[MethodType]) -> MethodType
20
+ def merge_method_types(method_types) # rubocop:disable Metrics
21
+ # steep:ignore:start
22
+ base = method_types.first
23
+ return base if method_types.one?
24
+
25
+ required_positionals = base.type.required_positionals.map.with_index do |_, i|
26
+ types = method_types.map { |method_type| method_type.type.required_positionals[i].type }.uniq
27
+ Types::Function::Param.new(name: nil, type: merge_types(types))
28
+ end
29
+
30
+ optional_positionals = base.type.optional_positionals.map.with_index do |_, i|
31
+ types = method_types.map { |method_type| method_type.type.optional_positionals[i].type }.uniq
32
+ Types::Function::Param.new(name: nil, type: merge_types(types))
33
+ end
34
+
35
+ types = method_types.filter_map { |method_type| method_type.type.rest_positionals }.uniq
36
+ rest_positionals = Types::Function::Param.new(name: nil, type: merge_types(types)) unless types.empty?
37
+
38
+ required_keywords = base.type.required_keywords.keys.to_h do |key|
39
+ types = method_types.map { |method_type| method_type.type.required_keywords[key] }.uniq
40
+ [key, Types::Function::Param.new(name: nil, type: merge_types(types))]
41
+ end
42
+
43
+ optional_keywords = base.type.optional_keywords.keys.to_h do |key|
44
+ types = method_types.map { |method_type| method_type.type.optional_keywords[key] }.uniq
45
+ [key, Types::Function::Param.new(name: nil, type: merge_types(types))]
46
+ end
47
+
48
+ types = method_types.filter_map { |method_type| method_type.type.rest_keywords }.uniq
49
+ rest_keywords = Types::Function::Param.new(name: nil, type: merge_types(types)) unless types.empty?
50
+
51
+ return_types = method_types.map { |method_type| method_type.type.return_type }.uniq
52
+ return_type = merge_types(return_types)
53
+ # steep:ignore:end
54
+
55
+ fn = Types::Function.new(
56
+ required_positionals:,
57
+ optional_positionals:,
58
+ rest_positionals:,
59
+ trailing_positionals: [],
60
+ required_keywords:,
61
+ optional_keywords:,
62
+ rest_keywords:,
63
+ return_type:
64
+ )
65
+ MethodType.new(
66
+ type_params: [],
67
+ type: fn,
68
+ block: nil,
69
+ location: nil
70
+ )
71
+ end
72
+
73
+ # @rbs (Array[Types::t]) -> Types::t
74
+ def merge_types(types)
75
+ return types.first if types.one?
76
+
77
+ optional = types.any? { |type| type.is_a?(Types::Bases::Nil) }
78
+ types = types.reject { |type| type.is_a?(Types::Bases::Nil) }
79
+ type = types.one? ? types.first : Types::Union.new(types:, location: nil) #: Types::t
80
+
81
+ optional ? Types::Optional.new(type:, location: nil) : type
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RBS
4
+ class Trace
5
+ class ReturnValueVisitor < Prism::BasicVisitor
6
+ class << self
7
+ # @rbs (String) -> ReturnValueVisitor
8
+ def parse_file(path)
9
+ new.tap do |visitor|
10
+ result = Prism.parse_file(path)
11
+ visitor.visit(result.value)
12
+ end
13
+ end
14
+ end
15
+
16
+ # @void_types: Hash[Array[Integer, Symbol], bool]
17
+ # @parents: Array[Prism::Node]
18
+
19
+ # @rbs () -> void
20
+ def initialize
21
+ @void_types = {} #: Hash[Array[Integer|Symbol], bool]
22
+ @parents = [] #: Array[Prism::Node]
23
+ super
24
+ end
25
+
26
+ # @rbs (Integer, Symbol) -> bool
27
+ def void_type?(lineno, name)
28
+ @void_types.fetch([lineno, name], false)
29
+ end
30
+
31
+ # @rbs (Prism::Node) -> void
32
+ def visit_child_nodes(node)
33
+ @parents.push(node)
34
+ super
35
+ @parents.pop
36
+ end
37
+
38
+ # @rbs (Prism::CallNode) -> void
39
+ def visit_call_node(node)
40
+ key = [node.location.start_line, node.name]
41
+ @void_types[key] = !use_return_value?(node)
42
+
43
+ visit_child_nodes(node)
44
+ end
45
+
46
+ (Prism::Visitor.instance_methods.grep(/^visit_/) - instance_methods).each do |m|
47
+ alias_method(m, :visit_child_nodes)
48
+ end
49
+
50
+ private
51
+
52
+ # @rbs (Prism::CallNode) -> bool
53
+ def use_return_value?(_node)
54
+ parent_type = @parents[-1]&.type
55
+ next_parent_type = @parents[-2]&.type
56
+
57
+ parent_type.end_with?("write_node") ||
58
+ parent_type == :call_node ||
59
+ (parent_type == :statements_node && next_parent_type == :embedded_statements_node)
60
+ end
61
+ end
62
+ end
63
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RBS
4
- module Trace
5
- VERSION = "0.3.2"
4
+ class Trace
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  end
data/lib/rbs/trace.rb CHANGED
@@ -2,16 +2,165 @@
2
2
 
3
3
  require "bundler"
4
4
  require "logger"
5
+ require "optparse"
5
6
  require "prism"
7
+ require "rbs"
6
8
 
7
- require_relative "trace/declaration"
8
- require_relative "trace/definition"
9
+ require_relative "trace/helpers"
10
+ require_relative "trace/builder"
11
+ require_relative "trace/cli"
12
+ require_relative "trace/cli/inline"
13
+ require_relative "trace/cli/merge"
9
14
  require_relative "trace/file"
10
- require_relative "trace/method_tracing"
15
+ require_relative "trace/inline_comment_visitor"
16
+ require_relative "trace/overload_compact"
17
+ require_relative "trace/return_value_visitor"
11
18
  require_relative "trace/version"
12
19
 
13
20
  module RBS
14
- module Trace
21
+ class Trace
15
22
  class Error < StandardError; end
23
+ # steep:ignore:start
24
+ BUNDLE_PATH = Bundler.bundle_path.to_s #: String
25
+ # steep:ignore:end
26
+ RUBY_LIB_PATH = RbConfig::CONFIG["rubylibdir"] #: String
27
+ PATH_INTERNAL = "<internal" #: String
28
+ PATH_EVAL = "(eval" #: String
29
+ PATH_INLINE_TEMPLATE = "inline template" #: String
30
+
31
+ private_constant :BUNDLE_PATH, :RUBY_LIB_PATH, :PATH_INTERNAL, :PATH_EVAL, :PATH_INLINE_TEMPLATE
32
+
33
+ # @rbs (?log_level: Symbol, ?raises: bool) -> void
34
+ def initialize(log_level: nil, raises: false)
35
+ @log_level = log_level
36
+ @log_level ||= ENV["RBS_TRACE_DEBUG"] ? :debug : :info
37
+ @raises = raises
38
+ end
39
+
40
+ # @rbs [T] () { () -> T } -> T
41
+ def enable(&)
42
+ trace.enable(&)
43
+ end
44
+
45
+ # @rbs () -> void
46
+ def disable
47
+ trace.disable
48
+ end
49
+
50
+ # @rbs () -> Hash[String, File]
51
+ def files
52
+ @files ||= {}
53
+ end
54
+
55
+ # @rbs () -> void
56
+ def save_comments
57
+ files.each_value(&:rewrite)
58
+ end
59
+
60
+ # @rbs (out_dir: String) -> void
61
+ def save_files(out_dir:)
62
+ files.each_value { |file| file.save_rbs(out_dir) }
63
+ end
64
+
65
+ private
66
+
67
+ # @rbs () -> TracePoint
68
+ def trace
69
+ @trace ||= TracePoint.new(:call, :return) { |tp| record(tp) }
70
+ end
71
+
72
+ # @rbs () -> Logger
73
+ def logger
74
+ @logger ||= Logger.new($stdout, level: @log_level)
75
+ end
76
+
77
+ # @rbs () -> Builder
78
+ def builder
79
+ @builder ||= Builder.new
80
+ end
81
+
82
+ # @rbs (String) -> File
83
+ def find_or_new_file(path)
84
+ files[path] ||= File.new(path)
85
+ end
86
+
87
+ # @rbs (TracePoint) -> void
88
+ def record(tp) # rubocop:disable Metrics/MethodLength
89
+ return if ignore_path?(tp.path)
90
+
91
+ file = find_or_new_file(tp.path)
92
+ # steep:ignore:start
93
+ member = file.find_or_new_method_definition(tp.self, tp.defined_class, tp.method_id)
94
+ # steep:ignore:end
95
+ return unless member
96
+
97
+ case tp.event
98
+ when :call
99
+ call_event(tp, member)
100
+ when :return
101
+ return_event(tp, member)
102
+ end
103
+ rescue StandardError => e
104
+ logger.debug(e)
105
+ raise(e) if @raises
106
+ end
107
+
108
+ # @rbs (TracePoint, AST::Members::MethodDefinition) -> void
109
+ def call_event(tp, member)
110
+ # steep:ignore:start
111
+ void = member.overloads.all? { |overload| overload.method_type.type.return_type.is_a?(Types::Bases::Void) } &&
112
+ void_return_type?(tp.path, tp.method_id)
113
+
114
+ builder.method_call(
115
+ bind: tp.binding,
116
+ parameters: tp.parameters,
117
+ void:
118
+ )
119
+ # steep:ignore:end
120
+ end
121
+
122
+ # @rbs (TracePoint, AST::Members::MethodDefinition) -> void
123
+ def return_event(tp, member)
124
+ overload = builder.method_return(tp.return_value)
125
+ return if member.overloads.include?(overload)
126
+
127
+ member.overloads << overload
128
+ end
129
+
130
+ # @rbs (String) -> bool
131
+ def ignore_path?(path)
132
+ path.start_with?(
133
+ PATH_INTERNAL,
134
+ PATH_EVAL,
135
+ PATH_INLINE_TEMPLATE,
136
+ BUNDLE_PATH,
137
+ RUBY_LIB_PATH,
138
+ __FILE__
139
+ )
140
+ end
141
+
142
+ # @rbs (String, Symbol) -> bool
143
+ def void_return_type?(path, method_id)
144
+ return true if method_id == :initialize
145
+
146
+ loc = find_caller_location(path, method_id.to_s)
147
+ # If the caller is not found, assume the return value is used.
148
+ return false unless loc
149
+
150
+ caller_path = loc.path.to_s
151
+ # Returns true if the file does not exist (eval, etc.)
152
+ return true unless ::File.exist?(caller_path)
153
+
154
+ @return_value_visitors ||= {} #: Hash[String, ReturnValueVisitor]
155
+ v = @return_value_visitors.fetch(caller_path) { ReturnValueVisitor.parse_file(caller_path) }
156
+ v.void_type?(loc.lineno, method_id)
157
+ end
158
+
159
+ # @rbs (String, String) -> Thread::Backtrace::Location?
160
+ def find_caller_location(path, label)
161
+ locations = caller_locations || []
162
+ i = locations.index { |loc| loc.path == path && loc.label == label }
163
+ locations[i + 1] if i
164
+ end
16
165
  end
17
166
  end
@@ -49,10 +49,6 @@ gems:
49
49
  version: 3.8.1
50
50
  source:
51
51
  type: rubygems
52
- - name: rbs-inline
53
- version: 0.10.0
54
- source:
55
- type: rubygems
56
52
  - name: rdoc
57
53
  version: '0'
58
54
  source:
@@ -0,0 +1,33 @@
1
+ # Generated from lib/rbs/trace/builder.rb with RBS::Inline
2
+
3
+ module RBS
4
+ class Trace
5
+ class Builder
6
+ include Helpers
7
+
8
+ GENERICS_SIZE: untyped
9
+
10
+ # @rbs (bind: Binding, parameters: Array[__todo__], void: bool) -> void
11
+ def method_call: (bind: Binding, parameters: Array[__todo__], void: bool) -> void
12
+
13
+ # @rbs (__todo__) -> AST::Members::MethodDefinition::Overload
14
+ def method_return: (__todo__) -> AST::Members::MethodDefinition::Overload
15
+
16
+ private
17
+
18
+ def stack_traces: () -> untyped
19
+
20
+ # @rbs (Binding, Array[__todo__]) -> MethodType
21
+ def parse_parameters: (Binding, Array[__todo__]) -> MethodType
22
+
23
+ # @rbs (Array[untyped]) -> Types::t
24
+ def parse_classes: (Array[untyped]) -> Types::t
25
+
26
+ # @rbs (untyped) -> Types::t
27
+ def parse_class: (untyped) -> Types::t
28
+
29
+ # @rbs (BasicObject) -> Types::t
30
+ def parse_object: (BasicObject) -> Types::t
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,19 @@
1
+ # Generated from lib/rbs/trace/cli/inline.rb with RBS::Inline
2
+
3
+ module RBS
4
+ class Trace
5
+ class CLI
6
+ class Inline
7
+ BANNER: ::String
8
+
9
+ # @rbs (Array[String]) -> void
10
+ def run: (Array[String]) -> void
11
+
12
+ private
13
+
14
+ # @rbs (String) -> Environment
15
+ def load_env: (String) -> Environment
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,24 @@
1
+ # Generated from lib/rbs/trace/cli/merge.rb with RBS::Inline
2
+
3
+ module RBS
4
+ class Trace
5
+ class CLI
6
+ class Merge
7
+ BANNER: ::String
8
+
9
+ # @rbs (Array[String]) -> void
10
+ def run: (Array[String]) -> void
11
+
12
+ # @rbs (Array[Environment]) -> Environment
13
+ def merge_envs: (Array[Environment]) -> Environment
14
+
15
+ private
16
+
17
+ # @rbs (String) -> Environment
18
+ def load_env: (String) -> Environment
19
+
20
+ def merge: (untyped decl, untyped member) -> untyped
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,17 @@
1
+ # Generated from lib/rbs/trace/cli.rb with RBS::Inline
2
+
3
+ module RBS
4
+ class Trace
5
+ class CLI
6
+ BANNER: ::String
7
+
8
+ # @rbs (Array[String]) -> void
9
+ def run: (Array[String]) -> void
10
+
11
+ private
12
+
13
+ # @rbs (Symbol?) -> (singleton(Inline) | singleton(Merge))?
14
+ def command_class: (Symbol?) -> (singleton(Inline) | singleton(Merge))?
15
+ end
16
+ end
17
+ end
@@ -1,13 +1,15 @@
1
1
  # Generated from lib/rbs/trace/file.rb with RBS::Inline
2
2
 
3
3
  module RBS
4
- module Trace
4
+ class Trace
5
5
  class File
6
- # @rbs (String) -> void
7
- def initialize: (String) -> void
6
+ include Helpers
7
+
8
+ # @rbs (String, ?Hash[TypeName, AST::Declarations::t]) -> void
9
+ def initialize: (String, ?Hash[TypeName, AST::Declarations::t]) -> void
8
10
 
9
- # @rbs () -> Hash[String, Definition]
10
- def definitions: () -> Hash[String, Definition]
11
+ # @rbs (untyped, Class, Symbol) -> AST::Members::MethodDefinition?
12
+ def find_or_new_method_definition: (untyped, Class, Symbol) -> AST::Members::MethodDefinition?
11
13
 
12
14
  # @rbs () -> String
13
15
  def with_rbs: () -> String
@@ -15,13 +17,22 @@ module RBS
15
17
  # @rbs () -> void
16
18
  def rewrite: () -> void
17
19
 
20
+ # @rbs () -> String
21
+ def to_rbs: () -> String
22
+
23
+ # @rbs (String) -> void
24
+ def save_rbs: (String) -> void
25
+
18
26
  private
19
27
 
20
- # @rbs (Array[String], Definition) -> boolish
21
- def skip_insert?: (Array[String], Definition) -> boolish
28
+ # @rbs (Array[String], Integer) -> boolish
29
+ def skip_insert?: (Array[String], Integer) -> boolish
30
+
31
+ # @rbs (Class | Module) -> (AST::Declarations::Class | AST::Declarations::Module)?
32
+ def find_or_new_receiver_decl: (Class | Module) -> (AST::Declarations::Class | AST::Declarations::Module)?
22
33
 
23
- # @rbs () -> Enumerator[Definition, void]
24
- def reverse_definitions: () -> Enumerator[Definition, void]
34
+ # @rbs (String) -> Pathname
35
+ def calc_rbs_path: (String) -> Pathname
25
36
  end
26
37
  end
27
38
  end
@@ -0,0 +1,33 @@
1
+ # Generated from lib/rbs/trace/helpers.rb with RBS::Inline
2
+
3
+ module RBS
4
+ class Trace
5
+ module Helpers
6
+ UNBOUND_CLASS_METHOD: untyped
7
+
8
+ # @rbs (name: TypeName) -> AST::Declarations::Module
9
+ def new_module_decl: (name: TypeName) -> AST::Declarations::Module
10
+
11
+ # @rbs (name: TypeName) -> AST::Declarations::Class
12
+ def new_class_decl: (name: TypeName) -> AST::Declarations::Class
13
+
14
+ # @rbs (name: Symbol, kind: (:singleton | :instance)) -> AST::Members::MethodDefinition
15
+ def new_method_definition: (name: Symbol, kind: :singleton | :instance) -> AST::Members::MethodDefinition
16
+
17
+ # @rbs (BasicObject) -> Class
18
+ def obj_to_class: (BasicObject) -> Class
19
+
20
+ # @rbs () -> Types::Bases::Void
21
+ def type_void: () -> Types::Bases::Void
22
+
23
+ # @rbs () -> Types::Bases::Nil
24
+ def type_nil: () -> Types::Bases::Nil
25
+
26
+ # @rbs () -> Types::Bases::Bool
27
+ def type_bool: () -> Types::Bases::Bool
28
+
29
+ # @rbs () -> Types::Bases::Any
30
+ def type_untyped: () -> Types::Bases::Any
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,27 @@
1
+ # Generated from lib/rbs/trace/inline_comment_visitor.rb with RBS::Inline
2
+
3
+ module RBS
4
+ class Trace
5
+ class InlineCommentVisitor < Prism::Visitor
6
+ # @rbs (Hash[TypeName, AST::Declarations::t], Hash[Integer, String]) -> void
7
+ def initialize: (Hash[TypeName, AST::Declarations::t], Hash[Integer, String]) -> void
8
+
9
+ # @rbs override
10
+ # @rbs (Prism::Node) -> void
11
+ def visit_class_node: ...
12
+
13
+ # @rbs override
14
+ # @rbs (Prism::Node) -> void
15
+ def visit_module_node: ...
16
+
17
+ # @rbs override
18
+ # @rbs (Prism::Node) -> void
19
+ def visit_def_node: ...
20
+
21
+ private
22
+
23
+ # @rbs (Symbol) -> AST::Members::MethodDefinition?
24
+ def find_method_definition: (Symbol) -> AST::Members::MethodDefinition?
25
+ end
26
+ end
27
+ end