rbs 3.6.0.pre.2 → 3.6.0.pre.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/Rakefile +2 -2
  4. data/core/array.rbs +0 -2
  5. data/core/complex.rbs +0 -2
  6. data/core/data.rbs +0 -2
  7. data/core/dir.rbs +0 -2
  8. data/core/encoding.rbs +0 -2
  9. data/core/enumerator/product.rbs +0 -2
  10. data/core/enumerator.rbs +1 -1
  11. data/core/errors.rbs +0 -12
  12. data/core/file.rbs +0 -2
  13. data/core/float.rbs +0 -2
  14. data/core/hash.rbs +0 -2
  15. data/core/integer.rbs +0 -2
  16. data/core/io/buffer.rbs +0 -2
  17. data/core/kernel.rbs +5 -5
  18. data/core/module.rbs +2 -2
  19. data/core/numeric.rbs +0 -2
  20. data/core/object_space/weak_key_map.rbs +0 -2
  21. data/core/ractor.rbs +0 -6
  22. data/core/rational.rbs +0 -2
  23. data/core/rbs/unnamed/argf.rbs +0 -2
  24. data/core/ruby_vm.rbs +305 -0
  25. data/lib/rbs/ast/type_param.rb +44 -11
  26. data/lib/rbs/cli/validate.rb +6 -4
  27. data/lib/rbs/definition.rb +2 -8
  28. data/lib/rbs/definition_builder/ancestor_builder.rb +23 -7
  29. data/lib/rbs/definition_builder.rb +7 -6
  30. data/lib/rbs/errors.rb +38 -0
  31. data/lib/rbs/version.rb +1 -1
  32. data/sig/definition.rbs +1 -1
  33. data/sig/errors.rbs +14 -0
  34. data/sig/members.rbs +1 -2
  35. data/sig/type_param.rbs +9 -5
  36. data/stdlib/bigdecimal/0/big_decimal.rbs +0 -2
  37. data/stdlib/cgi/0/core.rbs +0 -10
  38. data/stdlib/date/0/date.rbs +0 -2
  39. data/stdlib/date/0/date_time.rbs +0 -2
  40. data/stdlib/dbm/0/dbm.rbs +0 -2
  41. data/stdlib/delegate/0/delegator.rbs +0 -2
  42. data/stdlib/delegate/0/simple_delegator.rbs +0 -2
  43. data/stdlib/digest/0/digest.rbs +0 -4
  44. data/stdlib/etc/0/etc.rbs +0 -4
  45. data/stdlib/json/0/json.rbs +22 -0
  46. data/stdlib/logger/0/formatter.rbs +0 -2
  47. data/stdlib/logger/0/log_device.rbs +0 -2
  48. data/stdlib/logger/0/logger.rbs +0 -2
  49. data/stdlib/monitor/0/monitor.rbs +0 -6
  50. data/stdlib/mutex_m/0/mutex_m.rbs +0 -2
  51. data/stdlib/net-http/0/net-http.rbs +0 -8
  52. data/stdlib/observable/0/observable.rbs +0 -2
  53. data/stdlib/open-uri/0/open-uri.rbs +1 -1
  54. data/stdlib/open3/0/open3.rbs +155 -0
  55. data/stdlib/openssl/0/openssl.rbs +0 -112
  56. data/stdlib/optparse/0/optparse.rbs +0 -22
  57. data/stdlib/pathname/0/pathname.rbs +0 -2
  58. data/stdlib/pstore/0/pstore.rbs +0 -2
  59. data/stdlib/resolv/0/resolv.rbs +0 -74
  60. data/stdlib/singleton/0/singleton.rbs +0 -2
  61. data/stdlib/socket/0/addrinfo.rbs +0 -2
  62. data/stdlib/socket/0/basic_socket.rbs +0 -2
  63. data/stdlib/socket/0/ip_socket.rbs +0 -2
  64. data/stdlib/socket/0/socket.rbs +0 -8
  65. data/stdlib/socket/0/tcp_server.rbs +0 -2
  66. data/stdlib/socket/0/udp_socket.rbs +0 -2
  67. data/stdlib/socket/0/unix_server.rbs +0 -2
  68. data/stdlib/socket/0/unix_socket.rbs +0 -2
  69. data/stdlib/strscan/0/string_scanner.rbs +0 -2
  70. data/stdlib/tempfile/0/tempfile.rbs +0 -4
  71. data/stdlib/zlib/0/deflate.rbs +0 -2
  72. data/stdlib/zlib/0/gzip_file/error.rbs +0 -2
  73. data/stdlib/zlib/0/gzip_file.rbs +0 -2
  74. data/stdlib/zlib/0/gzip_reader.rbs +0 -2
  75. data/stdlib/zlib/0/gzip_writer.rbs +0 -2
  76. data/stdlib/zlib/0/inflate.rbs +0 -2
  77. data/stdlib/zlib/0/zstream.rbs +0 -2
  78. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3986f50e40a03702c9472964ede255b11e28657c0e0814a250e58749efeb824
4
- data.tar.gz: 6f1e5defc9e5d42c84c5692c50e5712ddc92bf51e89958f9bfa511e518e724e5
3
+ metadata.gz: e6d0650c01c5b470a842e74e253097e5b49110518a03fa7d10a436d8c1ca396c
4
+ data.tar.gz: 5b99332dbafc318d5db5b4de03f09654b35b4108c7e126f2132db9e74d872d6c
5
5
  SHA512:
6
- metadata.gz: af34f7e1f8547abf07d7a888927aa3cc408480130fc6cc1b94b42c5069b4332b770df805968ff9b31ab957d6cff55601f07d08ce2ede84cec927531465806ad1
7
- data.tar.gz: 1e6057a9ffcf93e86ea042aa5aa1061de95107678a1f485930e7a73f22321ba3fd0d7b8b7f8587cd1bc1a18a24a60e6d90768bad4f08f6ddaf8ba75133a37fab
6
+ metadata.gz: 15ec712879343b5ab4ebb39d085a29e55d5ad51efd30fb2d294d0bea9e90d483b82a8093d9d00c25572bac3b9f6c25733e2099066f39914192d49baee3b449dc
7
+ data.tar.gz: 50092cb860beb679e653e457b11ceb169ae588511d82308243cb32fcc0e33f13e00ca5196971cfaf583e25534c5370ec8a592b1d1df132d230ed8d951aabcf3c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.6.0.pre.3 (2024-09-30)
4
+
5
+ ### Signature updates
6
+
7
+ * `JSON.load_file`, `.load_file!` ([#2031](https://github.com/ruby/rbs/pull/2031))
8
+ * `Module#class_eval`, `Module#module_eval` ([#2029](https://github.com/ruby/rbs/pull/2029))
9
+ * `Open3` ([#2014](https://github.com/ruby/rbs/pull/2014))
10
+ * `RubyVM::InstructionSequence` ([#2027](https://github.com/ruby/rbs/pull/2027))
11
+ * Fixup RBS type definitions with rbs-on-rubocop ([#2023](https://github.com/ruby/rbs/pull/2023))
12
+ * Avoid using `instance`/`class` types in modules ([#2020](https://github.com/ruby/rbs/pull/2020))
13
+
14
+ ### Language updates
15
+
16
+ * Optional type param restriction ([#2030](https://github.com/ruby/rbs/pull/2030))
17
+ * Prohibit `self` type as a generics default ([#2022](https://github.com/ruby/rbs/pull/2022))
18
+ * Allow `self` types in generics default type ([#2021](https://github.com/ruby/rbs/pull/2021))
19
+
20
+ ### Library changes
21
+
22
+ * Add `TypeParamDefaultReferenceError#type_param` ([#2032](https://github.com/ruby/rbs/pull/2032))
23
+
3
24
  ## 3.6.0.pre.2 (2024-09-18)
4
25
 
5
26
  ### Signature updates
data/Rakefile CHANGED
@@ -56,7 +56,7 @@ end
56
56
  task :validate => :compile do
57
57
  require 'yaml'
58
58
 
59
- sh "#{ruby} #{rbs} validate"
59
+ sh "#{ruby} #{rbs} validate --exit-error-on-syntax-error"
60
60
 
61
61
  libs = FileList["stdlib/*"].map {|path| File.basename(path).to_s }
62
62
 
@@ -72,7 +72,7 @@ task :validate => :compile do
72
72
  end
73
73
 
74
74
  libs.each do |lib|
75
- sh "#{ruby} #{rbs} -r #{lib} validate"
75
+ sh "#{ruby} #{rbs} -r #{lib} validate --exit-error-on-syntax-error"
76
76
  end
77
77
  end
78
78
 
data/core/array.rbs CHANGED
@@ -600,8 +600,6 @@ class Array[unchecked out Elem] < Object
600
600
  #
601
601
  def self.try_convert: [U] (untyped) -> ::Array[U]?
602
602
 
603
- public
604
-
605
603
  # <!--
606
604
  # rdoc-file=array.c
607
605
  # - array & other_array -> new_array
data/core/complex.rbs CHANGED
@@ -109,8 +109,6 @@ class Complex < Numeric
109
109
  #
110
110
  alias self.rectangular self.rect
111
111
 
112
- public
113
-
114
112
  # <!--
115
113
  # rdoc-file=complex.c
116
114
  # - complex * numeric -> new_complex
data/core/data.rbs CHANGED
@@ -183,8 +183,6 @@ class Data
183
183
 
184
184
  def self.allocate: () -> bot
185
185
 
186
- public
187
-
188
186
  # <!--
189
187
  # rdoc-file=struct.c
190
188
  # - self == other -> true or false
data/core/dir.rbs CHANGED
@@ -759,8 +759,6 @@ class Dir
759
759
  #
760
760
  alias self.unlink self.delete
761
761
 
762
- public
763
-
764
762
  # <!--
765
763
  # rdoc-file=dir.c
766
764
  # - chdir -> 0
data/core/encoding.rbs CHANGED
@@ -780,8 +780,6 @@ class Encoding::Converter < Object
780
780
  ?xml: :text | :attr
781
781
  ) -> conversion_path
782
782
 
783
- public
784
-
785
783
  # <!--
786
784
  # rdoc-file=transcode.c
787
785
  # - ec == other -> true or false
@@ -44,8 +44,6 @@ class Enumerator[unchecked out Elem, out Return = void]
44
44
  #
45
45
  def initialize: (*_EachEntry[Elem]) -> void
46
46
 
47
- public
48
-
49
47
  # <!--
50
48
  # rdoc-file=enumerator.c
51
49
  # - obj.each { |...| ... } -> obj
data/core/enumerator.rbs CHANGED
@@ -132,7 +132,7 @@ class Enumerator[unchecked out Elem, out Return = void] < Object
132
132
 
133
133
  # A convenience interface for `each` with optional block
134
134
  #
135
- interface _Each[out E, out R = self]
135
+ interface _Each[out E, out R]
136
136
  def each: () { (E) -> void } -> R
137
137
  | () -> Enumerator[E, R]
138
138
  end
data/core/errors.rbs CHANGED
@@ -270,8 +270,6 @@ class NameError[T] < StandardError
270
270
  #
271
271
  def initialize: (?string msg, ?String? name, ?receiver: T?) -> void
272
272
 
273
- public
274
-
275
273
  # <!--
276
274
  # rdoc-file=error.c
277
275
  # - name_error.local_variables -> array
@@ -362,8 +360,6 @@ class NoMethodError[T] < NameError[T]
362
360
  #
363
361
  def initialize: (?string? msg, ?String? name, ?Array[untyped] args, ?boolish `private`, ?receiver: T?) -> void
364
362
 
365
- public
366
-
367
363
  # <!--
368
364
  # rdoc-file=error.c
369
365
  # - no_method_error.args -> obj
@@ -471,8 +467,6 @@ class SignalException < Exception
471
467
  def initialize: (?string sig_name) -> void
472
468
  | (int sig_number, ?string sig_name) -> void
473
469
 
474
- public
475
-
476
470
  def signm: () -> String
477
471
 
478
472
  # <!--
@@ -608,8 +602,6 @@ class SystemCallError < StandardError
608
602
  #
609
603
  def self.===: (untyped other) -> bool
610
604
 
611
- public
612
-
613
605
  # <!--
614
606
  # rdoc-file=error.c
615
607
  # - system_call_error.errno -> integer
@@ -637,8 +629,6 @@ class SystemExit < Exception
637
629
  | (string msg) -> void
638
630
  | (true | false | int status, ?string msg) -> void
639
631
 
640
- public
641
-
642
632
  # <!--
643
633
  # rdoc-file=error.c
644
634
  # - system_exit.status -> integer
@@ -726,8 +716,6 @@ class UncaughtThrowError < ArgumentError
726
716
  #
727
717
  def initialize: (untyped tag, untyped value) -> void
728
718
 
729
- public
730
-
731
719
  # <!--
732
720
  # rdoc-file=vm_eval.c
733
721
  # - uncaught_throw.tag -> obj
data/core/file.rbs CHANGED
@@ -1769,8 +1769,6 @@ class File < IO
1769
1769
  #
1770
1770
  def self.zero?: (string | _ToPath | IO file_name) -> bool
1771
1771
 
1772
- public
1773
-
1774
1772
  # <!--
1775
1773
  # rdoc-file=file.c
1776
1774
  # - file.atime -> time
data/core/float.rbs CHANGED
@@ -80,8 +80,6 @@
80
80
  # * #truncate: Returns `self` truncated to a given precision.
81
81
  #
82
82
  class Float < Numeric
83
- public
84
-
85
83
  # <!--
86
84
  # rdoc-file=numeric.c
87
85
  # - self % other -> float
data/core/hash.rbs CHANGED
@@ -559,8 +559,6 @@ class Hash[unchecked out K, unchecked out V] < Object
559
559
  def self.try_convert: [U, V] (_ToHash[U, V]) -> ::Hash[U, V]
560
560
  | (untyped) -> (::Hash[untyped, untyped] | nil)
561
561
 
562
- public
563
-
564
562
  # <!--
565
563
  # rdoc-file=hash.c
566
564
  # - hash < other_hash -> true or false
data/core/integer.rbs CHANGED
@@ -149,8 +149,6 @@ class Integer < Numeric
149
149
  def self.try_convert: (int) -> Integer
150
150
  | (untyped) -> Integer?
151
151
 
152
- public
153
-
154
152
  # <!--
155
153
  # rdoc-file=numeric.c
156
154
  # - self % other -> real_number
data/core/io/buffer.rbs CHANGED
@@ -184,8 +184,6 @@ class IO
184
184
  #
185
185
  def self.string: (int) { (Buffer) -> void } -> String
186
186
 
187
- public
188
-
189
187
  # <!--
190
188
  # rdoc-file=io_buffer.c
191
189
  # - <=>(other) -> true or false
data/core/kernel.rbs CHANGED
@@ -282,7 +282,7 @@ module Kernel : BasicObject
282
282
  # 1.class #=> Integer
283
283
  # self.class #=> Object
284
284
  #
285
- def class: () -> class
285
+ def class: () -> Class
286
286
 
287
287
  # <!--
288
288
  # rdoc-file=vm_eval.c
@@ -2210,7 +2210,7 @@ module Kernel : BasicObject
2210
2210
  # s3 = s1.dup #=> #<Klass:0x401c1084>
2211
2211
  # s3.foo #=> NoMethodError: undefined method `foo' for #<Klass:0x401c1084>
2212
2212
  #
2213
- def dup: () -> instance
2213
+ def dup: () -> self
2214
2214
 
2215
2215
  # <!-- rdoc-file=enumerator.c -->
2216
2216
  # Creates a new Enumerator which will enumerate by calling `method` on `obj`,
@@ -2956,9 +2956,9 @@ module Kernel : BasicObject
2956
2956
 
2957
2957
  private
2958
2958
 
2959
- def initialize_copy: (instance object) -> self
2959
+ def initialize_copy: (self object) -> self
2960
2960
 
2961
- def initialize_clone: (instance object, ?freeze: bool?) -> self
2961
+ def initialize_clone: (self object, ?freeze: bool?) -> self
2962
2962
 
2963
- def initialize_dup: (instance object) -> self
2963
+ def initialize_dup: (self object) -> self
2964
2964
  end
data/core/module.rbs CHANGED
@@ -377,7 +377,7 @@ class Module < Object
377
377
  # or method `code' for Thing:Class
378
378
  #
379
379
  def class_eval: (String arg0, ?String filename, ?Integer lineno) -> untyped
380
- | [U] () { (self m) -> U } -> U
380
+ | [U] () { (self m) [self: self] -> U } -> U
381
381
 
382
382
  # <!-- rdoc-file=vm_eval.c -->
383
383
  # Evaluates the given block in the context of the class/module. The method
@@ -1083,7 +1083,7 @@ class Module < Object
1083
1083
  # or method `code' for Thing:Class
1084
1084
  #
1085
1085
  def module_eval: (String arg0, ?String filename, ?Integer lineno) -> untyped
1086
- | [U] () { (self m) -> U } -> U
1086
+ | [U] () { (self m) [self: self] -> U } -> U
1087
1087
 
1088
1088
  # <!--
1089
1089
  # rdoc-file=vm_eval.c
data/core/numeric.rbs CHANGED
@@ -162,8 +162,6 @@
162
162
  class Numeric
163
163
  include Comparable
164
164
 
165
- public
166
-
167
165
  # <!--
168
166
  # rdoc-file=numeric.c
169
167
  # - self % other -> real_numeric
@@ -59,8 +59,6 @@ module ObjectSpace
59
59
  # sitting in the cache forever.
60
60
  #
61
61
  class WeakKeyMap[Key, Value]
62
- public
63
-
64
62
  # <!--
65
63
  # rdoc-file=weakmap.c
66
64
  # - map[key] -> value
data/core/ractor.rbs CHANGED
@@ -597,8 +597,6 @@ class Ractor
597
597
  #
598
598
  def self.yield: (untyped obj, ?move: boolish) -> untyped
599
599
 
600
- public
601
-
602
600
  # <!--
603
601
  # rdoc-file=ractor.rb
604
602
  # - <<(obj, move: false)
@@ -925,8 +923,6 @@ class Ractor
925
923
  # # Ractor::MovedError (can not send any methods to a moved object)
926
924
  #
927
925
  class MovedObject < BasicObject
928
- public
929
-
930
926
  # <!--
931
927
  # rdoc-file=ractor.c
932
928
  # - !(*args)
@@ -1007,8 +1003,6 @@ class Ractor
1007
1003
  # end
1008
1004
  #
1009
1005
  class RemoteError < Ractor::Error
1010
- public
1011
-
1012
1006
  def ractor: () -> Ractor
1013
1007
  end
1014
1008
 
data/core/rational.rbs CHANGED
@@ -48,8 +48,6 @@
48
48
  # #=> (1.0000000000000002+1.7320508075688772i)
49
49
  #
50
50
  class Rational < Numeric
51
- public
52
-
53
51
  def %: (Integer) -> Rational
54
52
  | (Float) -> Float
55
53
  | (Rational) -> Rational
@@ -45,8 +45,6 @@ module RBS
45
45
  class ARGFClass
46
46
  include Enumerable[String]
47
47
 
48
- public
49
-
50
48
  # <!--
51
49
  # rdoc-file=io.c
52
50
  # - ARGF.argv -> ARGV
data/core/ruby_vm.rbs CHANGED
@@ -50,6 +50,311 @@ RubyVM::OPTS: Array[String]
50
50
  # Of course, this class is MRI specific.
51
51
  #
52
52
  class RubyVM::InstructionSequence < Object
53
+ # <!--
54
+ # rdoc-file=iseq.c
55
+ # - absolute_path()
56
+ # -->
57
+ # Returns the absolute path of this instruction sequence.
58
+ #
59
+ # `nil` if the iseq was evaluated from a string.
60
+ #
61
+ # For example, using ::compile_file:
62
+ #
63
+ # # /tmp/method.rb
64
+ # def hello
65
+ # puts "hello, world"
66
+ # end
67
+ #
68
+ # # in irb
69
+ # > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
70
+ # > iseq.absolute_path #=> /tmp/method.rb
71
+ #
72
+ def absolute_path: () -> String?
73
+
74
+ # <!--
75
+ # rdoc-file=iseq.c
76
+ # - base_label()
77
+ # -->
78
+ # Returns the base label of this instruction sequence.
79
+ #
80
+ # For example, using irb:
81
+ #
82
+ # iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
83
+ # #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
84
+ # iseq.base_label
85
+ # #=> "<compiled>"
86
+ #
87
+ # Using ::compile_file:
88
+ #
89
+ # # /tmp/method.rb
90
+ # def hello
91
+ # puts "hello, world"
92
+ # end
93
+ #
94
+ # # in irb
95
+ # > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
96
+ # > iseq.base_label #=> <main>
97
+ #
98
+ def base_label: () -> String
99
+
100
+ # <!--
101
+ # rdoc-file=iseq.c
102
+ # - iseq.disasm -> str
103
+ # - iseq.disassemble -> str
104
+ # -->
105
+ # Returns the instruction sequence as a `String` in human readable form.
106
+ #
107
+ # puts RubyVM::InstructionSequence.compile('1 + 2').disasm
108
+ #
109
+ # Produces:
110
+ #
111
+ # == disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
112
+ # 0000 trace 1 ( 1)
113
+ # 0002 putobject 1
114
+ # 0004 putobject 2
115
+ # 0006 opt_plus <ic:1>
116
+ # 0008 leave
117
+ #
118
+ def disasm: () -> String
119
+
120
+ # <!-- rdoc-file=iseq.c -->
121
+ # Returns the instruction sequence as a `String` in human readable form.
122
+ #
123
+ # puts RubyVM::InstructionSequence.compile('1 + 2').disasm
124
+ #
125
+ # Produces:
126
+ #
127
+ # == disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
128
+ # 0000 trace 1 ( 1)
129
+ # 0002 putobject 1
130
+ # 0004 putobject 2
131
+ # 0006 opt_plus <ic:1>
132
+ # 0008 leave
133
+ #
134
+ def disassemble: () -> String
135
+
136
+ # <!--
137
+ # rdoc-file=iseq.c
138
+ # - iseq.each_child{|child_iseq| ...} -> iseq
139
+ # -->
140
+ # Iterate all direct child instruction sequences. Iteration order is
141
+ # implementation/version defined so that people should not rely on the order.
142
+ #
143
+ def each_child: () -> RubyVM::InstructionSequence
144
+
145
+ # <!--
146
+ # rdoc-file=iseq.c
147
+ # - iseq.eval -> obj
148
+ # -->
149
+ # Evaluates the instruction sequence and returns the result.
150
+ #
151
+ # RubyVM::InstructionSequence.compile("1 + 2").eval #=> 3
152
+ #
153
+ def eval: () -> untyped
154
+
155
+ # <!--
156
+ # rdoc-file=iseq.c
157
+ # - first_lineno()
158
+ # -->
159
+ # Returns the number of the first source line where the instruction sequence was
160
+ # loaded from.
161
+ #
162
+ # For example, using irb:
163
+ #
164
+ # iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
165
+ # #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
166
+ # iseq.first_lineno
167
+ # #=> 1
168
+ #
169
+ def first_lineno: () -> Integer
170
+
171
+ # <!--
172
+ # rdoc-file=iseq.c
173
+ # - inspect()
174
+ # -->
175
+ # Returns a human-readable string representation of this instruction sequence,
176
+ # including the #label and #path.
177
+ #
178
+ def inspect: () -> String
179
+
180
+ # <!--
181
+ # rdoc-file=iseq.c
182
+ # - label()
183
+ # -->
184
+ # Returns the label of this instruction sequence.
185
+ #
186
+ # `<main>` if it's at the top level, `<compiled>` if it was evaluated from a
187
+ # string.
188
+ #
189
+ # For example, using irb:
190
+ #
191
+ # iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
192
+ # #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
193
+ # iseq.label
194
+ # #=> "<compiled>"
195
+ #
196
+ # Using ::compile_file:
197
+ #
198
+ # # /tmp/method.rb
199
+ # def hello
200
+ # puts "hello, world"
201
+ # end
202
+ #
203
+ # # in irb
204
+ # > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
205
+ # > iseq.label #=> <main>
206
+ #
207
+ def label: () -> String
208
+
209
+ # <!--
210
+ # rdoc-file=iseq.c
211
+ # - path()
212
+ # -->
213
+ # Returns the path of this instruction sequence.
214
+ #
215
+ # `<compiled>` if the iseq was evaluated from a string.
216
+ #
217
+ # For example, using irb:
218
+ #
219
+ # iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
220
+ # #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
221
+ # iseq.path
222
+ # #=> "<compiled>"
223
+ #
224
+ # Using ::compile_file:
225
+ #
226
+ # # /tmp/method.rb
227
+ # def hello
228
+ # puts "hello, world"
229
+ # end
230
+ #
231
+ # # in irb
232
+ # > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
233
+ # > iseq.path #=> /tmp/method.rb
234
+ #
235
+ def path: () -> String
236
+
237
+ # <!--
238
+ # rdoc-file=iseq.c
239
+ # - iseq.script_lines -> array or nil
240
+ # -->
241
+ # It returns recorded script lines if it is available. The script lines are not
242
+ # limited to the iseq range, but are entire lines of the source file.
243
+ #
244
+ # Note that this is an API for ruby internal use, debugging, and research. Do
245
+ # not use this for any other purpose. The compatibility is not guaranteed.
246
+ #
247
+ def script_lines: () -> Array[String]?
248
+
249
+ # <!--
250
+ # rdoc-file=iseq.c
251
+ # - iseq.to_a -> ary
252
+ # -->
253
+ # Returns an Array with 14 elements representing the instruction sequence with
254
+ # the following data:
255
+ #
256
+ # magic
257
+ # : A string identifying the data format. **Always
258
+ # `YARVInstructionSequence/SimpleDataFormat`.**
259
+ #
260
+ # major_version
261
+ # : The major version of the instruction sequence.
262
+ #
263
+ # minor_version
264
+ # : The minor version of the instruction sequence.
265
+ #
266
+ # format_type
267
+ # : A number identifying the data format. **Always 1**.
268
+ #
269
+ # misc
270
+ # : A hash containing:
271
+ #
272
+ # `:arg_size`
273
+ # : the total number of arguments taken by the method or the block (0 if
274
+ # *iseq* doesn't represent a method or block)
275
+ # `:local_size`
276
+ # : the number of local variables + 1
277
+ # `:stack_max`
278
+ # : used in calculating the stack depth at which a SystemStackError is
279
+ # thrown.
280
+ #
281
+ #
282
+ # #label
283
+ # : The name of the context (block, method, class, module, etc.) that this
284
+ # instruction sequence belongs to.
285
+ #
286
+ # `<main>` if it's at the top level, `<compiled>` if it was evaluated from a
287
+ # string.
288
+ #
289
+ # #path
290
+ # : The relative path to the Ruby file where the instruction sequence was
291
+ # loaded from.
292
+ #
293
+ # `<compiled>` if the iseq was evaluated from a string.
294
+ #
295
+ # #absolute_path
296
+ # : The absolute path to the Ruby file where the instruction sequence was
297
+ # loaded from.
298
+ #
299
+ # `nil` if the iseq was evaluated from a string.
300
+ #
301
+ # #first_lineno
302
+ # : The number of the first source line where the instruction sequence was
303
+ # loaded from.
304
+ #
305
+ # type
306
+ # : The type of the instruction sequence.
307
+ #
308
+ # Valid values are `:top`, `:method`, `:block`, `:class`, `:rescue`,
309
+ # `:ensure`, `:eval`, `:main`, and `plain`.
310
+ #
311
+ # locals
312
+ # : An array containing the names of all arguments and local variables as
313
+ # symbols.
314
+ #
315
+ # params
316
+ # : An Hash object containing parameter information.
317
+ #
318
+ # More info about these values can be found in `vm_core.h`.
319
+ #
320
+ # catch_table
321
+ # : A list of exceptions and control flow operators (rescue, next, redo,
322
+ # break, etc.).
323
+ #
324
+ # bytecode
325
+ # : An array of arrays containing the instruction names and operands that make
326
+ # up the body of the instruction sequence.
327
+ #
328
+ #
329
+ # Note that this format is MRI specific and version dependent.
330
+ #
331
+ def to_a: () -> Array[untyped]
332
+
333
+ # <!--
334
+ # rdoc-file=iseq.c
335
+ # - iseq.to_binary(extra_data = nil) -> binary str
336
+ # -->
337
+ # Returns serialized iseq binary format data as a String object. A corresponding
338
+ # iseq object is created by RubyVM::InstructionSequence.load_from_binary()
339
+ # method.
340
+ #
341
+ # String extra_data will be saved with binary data. You can access this data
342
+ # with RubyVM::InstructionSequence.load_from_binary_extra_data(binary).
343
+ #
344
+ # Note that the translated binary data is not portable. You can not move this
345
+ # binary data to another machine. You can not use the binary data which is
346
+ # created by another version/another architecture of Ruby.
347
+ #
348
+ def to_binary: () -> String
349
+
350
+ # <!--
351
+ # rdoc-file=iseq.c
352
+ # - iseq.trace_points -> ary
353
+ # -->
354
+ # Return trace points in the instruction sequence. Return an array of [line,
355
+ # event_symbol] pair.
356
+ #
357
+ def trace_points: () -> Array[untyped]
53
358
  end
54
359
 
55
360
  # <!-- rdoc-file=ast.rb -->