rbs 0.18.0 → 1.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/Rakefile +4 -0
- data/core/builtin.rbs +4 -0
- data/core/file.rbs +0 -4
- data/core/hash.rbs +1 -3
- data/core/io.rbs +159 -6
- data/core/kernel.rbs +1 -1
- data/core/time.rbs +0 -12
- data/goodcheck.yml +20 -0
- data/lib/rbs.rb +2 -0
- data/lib/rbs/ast/declarations.rb +7 -2
- data/lib/rbs/ast/members.rb +10 -4
- data/lib/rbs/cli.rb +10 -10
- data/lib/rbs/definition.rb +70 -3
- data/lib/rbs/definition_builder.rb +544 -989
- data/lib/rbs/definition_builder/ancestor_builder.rb +476 -0
- data/lib/rbs/definition_builder/method_builder.rb +217 -0
- data/lib/rbs/environment.rb +5 -1
- data/lib/rbs/environment_loader.rb +1 -1
- data/lib/rbs/environment_walker.rb +16 -10
- data/lib/rbs/errors.rb +71 -66
- data/lib/rbs/method_type.rb +1 -31
- data/lib/rbs/parser.rb +1000 -894
- data/lib/rbs/parser.y +108 -57
- data/lib/rbs/prototype/rb.rb +14 -3
- data/lib/rbs/prototype/rbi.rb +6 -6
- data/lib/rbs/prototype/runtime.rb +53 -33
- data/lib/rbs/substitution.rb +4 -0
- data/lib/rbs/test.rb +3 -1
- data/lib/rbs/test/hook.rb +24 -7
- data/lib/rbs/types.rb +63 -6
- data/lib/rbs/validator.rb +4 -2
- data/lib/rbs/variance_calculator.rb +5 -1
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +9 -1
- data/schema/members.json +5 -1
- data/sig/definition.rbs +6 -1
- data/sig/definition_builder.rbs +3 -0
- data/sig/errors.rbs +20 -0
- data/sig/members.rbs +4 -1
- data/sig/method_types.rbs +3 -16
- data/sig/type_name_resolver.rbs +4 -2
- data/sig/types.rbs +17 -1
- data/sig/validator.rbs +12 -0
- data/stdlib/dbm/0/dbm.rbs +0 -2
- data/stdlib/logger/0/log_device.rbs +1 -2
- data/stdlib/monitor/0/monitor.rbs +119 -0
- data/stdlib/time/0/time.rbs +327 -0
- data/stdlib/tsort/0/tsort.rbs +8 -0
- data/stdlib/uri/0/common.rbs +401 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +9 -0
- data/stdlib/uri/0/rfc3986_parser.rbs +2 -0
- data/steep/Gemfile.lock +13 -14
- metadata +14 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd21602800550be064e741db770aa752eaab018ca894238f88d75d1d1e950edd
|
4
|
+
data.tar.gz: 346c39ff339931cf9866e29cd096a0877c620feff86044a2bbb007826276904b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94651715eeed037f3d899fdae1cc49dc5134f5d3df7da03d06b7ebc7a053d43139adf29680de4a0036446afb16ef824862fae4ad5a6870861ae48bd589799ac6
|
7
|
+
data.tar.gz: ec967eef1ab035d4da2fe66f8a4661523c672eb1bc13f7033ac73ac8593810fd73e52d2d52173f8284abc47273b4442f9a95f4a5325c0e265cdb6a6d6b0321e1
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,37 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 1.0.0 (Pre released)
|
6
|
+
|
7
|
+
* Signature updates for `URI`, `IO`, and `Time` ([#529](https://github.com/ruby/rbs/pull/529), [#521](https://github.com/ruby/rbs/pull/521), [#520](https://github.com/ruby/rbs/pull/520), [#511](https://github.com/ruby/rbs/pull/511), [#517](https://github.com/ruby/rbs/pull/517))
|
8
|
+
* `rbs prototype runtime` generates `extend`s ([#535](https://github.com/ruby/rbs/pull/535))
|
9
|
+
* `rbs prototype runtime` stability improvements ([#533](https://github.com/ruby/rbs/pull/533), [#526](https://github.com/ruby/rbs/pull/526))
|
10
|
+
* Improve runtime type checker compatibility ([#532](https://github.com/ruby/rbs/pull/532), [#528](https://github.com/ruby/rbs/pull/528), )
|
11
|
+
* Better compatibility for record type attribute names ([#525](https://github.com/ruby/rbs/pull/525), [#524](https://github.com/ruby/rbs/pull/524))
|
12
|
+
* Let module-self-types be classes ([#523](https://github.com/ruby/rbs/pull/523))
|
13
|
+
* Method resolution improvements about `alias` and `.new` ([#522](https://github.com/ruby/rbs/pull/522), [#519](https://github.com/ruby/rbs/pull/519), [#516](https://github.com/ruby/rbs/pull/516))
|
14
|
+
* Fix `ruby2_keywords` for `Proc` in Ruby <2.7 ([#513](https://github.com/ruby/rbs/pull/513))
|
15
|
+
|
16
|
+
## 0.20.1 (2020-12-06)
|
17
|
+
|
18
|
+
* Make the order of RBS load reproducible ([#508](https://github.com/ruby/rbs/pull/508))
|
19
|
+
|
20
|
+
## 0.20.0 (2020-12-06)
|
21
|
+
|
22
|
+
* Signature updates for `TSort`, `DBM`, `Time`, and `Hash` ([#496](https://github.com/ruby/rbs/pull/496), [#497](https://github.com/ruby/rbs/pull/497), [#499](https://github.com/ruby/rbs/pull/499), [#507](https://github.com/ruby/rbs/pull/507))
|
23
|
+
* Add _singleton attribute_ syntax ([#502](https://github.com/ruby/rbs/pull/502), [#506](https://github.com/ruby/rbs/pull/506), [#505](https://github.com/ruby/rbs/pull/505))
|
24
|
+
* Proc types with blocks ([#503](https://github.com/ruby/rbs/pull/503))
|
25
|
+
* Add support for escape sequences in string literal types ([#501](https://github.com/ruby/rbs/pull/501))
|
26
|
+
* Fix runtime type checking of blocks with keyword args ([#500](https://github.com/ruby/rbs/pull/500))
|
27
|
+
|
28
|
+
## 0.19.0 (2020-12-02)
|
29
|
+
|
30
|
+
* Signature updates for `Monitor` and File ([#485](https://github.com/ruby/rbs/pull/485), [#495](https://github.com/ruby/rbs/pull/495))
|
31
|
+
|
32
|
+
## 0.18.1 (2020-12-01)
|
33
|
+
|
34
|
+
* Fix `EnvironmentWalker#each_type_name` ([#494](https://github.com/ruby/rbs/pull/494))
|
35
|
+
|
5
36
|
## 0.18.0 (2020-12-01)
|
6
37
|
|
7
38
|
* Signature updates for `YAML`, `ObjectSpace`, and `Singleton` ([#408](https://github.com/ruby/rbs/pull/408), [#477](https://github.com/ruby/rbs/pull/477), [#482](https://github.com/ruby/rbs/pull/482))
|
data/Rakefile
CHANGED
data/core/builtin.rbs
CHANGED
@@ -34,6 +34,10 @@ interface _Reader
|
|
34
34
|
def read: (?int length, ?string outbuf) -> String?
|
35
35
|
end
|
36
36
|
|
37
|
+
interface _ReaderPartial
|
38
|
+
def readpartial: (int maxlen, ?string outbuf) -> String
|
39
|
+
end
|
40
|
+
|
37
41
|
interface _Writer
|
38
42
|
# Writes the +data+ string. Returns the number of bytes written
|
39
43
|
def write: (*_ToS data) -> Integer
|
data/core/file.rbs
CHANGED
@@ -192,10 +192,6 @@ class File < IO
|
|
192
192
|
#
|
193
193
|
def self.exist?: (string | _ToPath | IO file_name) -> bool
|
194
194
|
|
195
|
-
# Deprecated method. Don't use.
|
196
|
-
#
|
197
|
-
alias self.exists? self.exist?
|
198
|
-
|
199
195
|
# Converts a pathname to an absolute pathname. Relative paths are referenced
|
200
196
|
# from the current working directory of the process unless `dir_string` is
|
201
197
|
# given, in which case it will be used as the starting point. The given pathname
|
data/core/hash.rbs
CHANGED
@@ -563,8 +563,6 @@ class Hash[unchecked out K, unchecked out V] < Object
|
|
563
563
|
#
|
564
564
|
alias include? has_key?
|
565
565
|
|
566
|
-
def index: (V) -> K?
|
567
|
-
|
568
566
|
# Return the contents of this hash as a string.
|
569
567
|
#
|
570
568
|
# h = { "c" => 300, "a" => 100, "d" => 400, "c" => 300 }
|
@@ -615,7 +613,7 @@ class Hash[unchecked out K, unchecked out V] < Object
|
|
615
613
|
# h.key(300) #=> "c"
|
616
614
|
# h.key(999) #=> nil
|
617
615
|
#
|
618
|
-
|
616
|
+
def key: (V) -> K?
|
619
617
|
|
620
618
|
# Returns `true` if the given key is present in *hsh*.
|
621
619
|
#
|
data/core/io.rbs
CHANGED
@@ -405,7 +405,63 @@ class IO < Object
|
|
405
405
|
|
406
406
|
def puts: (*untyped arg0) -> NilClass
|
407
407
|
|
408
|
-
|
408
|
+
# Reads *length* bytes from the I/O stream.
|
409
|
+
#
|
410
|
+
# *length* must be a non-negative integer or `nil`.
|
411
|
+
#
|
412
|
+
# If *length* is a positive integer, `read` tries to read *length* bytes without
|
413
|
+
# any conversion (binary mode). It returns `nil` if an EOF is encountered before
|
414
|
+
# anything can be read. Fewer than *length* bytes are returned if an EOF is
|
415
|
+
# encountered during the read. In the case of an integer *length*, the resulting
|
416
|
+
# string is always in ASCII-8BIT encoding.
|
417
|
+
#
|
418
|
+
# If *length* is omitted or is `nil`, it reads until EOF and the encoding
|
419
|
+
# conversion is applied, if applicable. A string is returned even if EOF is
|
420
|
+
# encountered before any data is read.
|
421
|
+
#
|
422
|
+
# If *length* is zero, it returns an empty string (`""`).
|
423
|
+
#
|
424
|
+
# If the optional *outbuf* argument is present, it must reference a String,
|
425
|
+
# which will receive the data. The *outbuf* will contain only the received data
|
426
|
+
# after the method call even if it is not empty at the beginning.
|
427
|
+
#
|
428
|
+
# When this method is called at end of file, it returns `nil` or `""`, depending
|
429
|
+
# on *length*: `read`, `read(nil)`, and `read(0)` return `""`,
|
430
|
+
# `read(*positive_integer*)` returns `nil`.
|
431
|
+
#
|
432
|
+
# f = File.new("testfile")
|
433
|
+
# f.read(16) #=> "This is line one"
|
434
|
+
#
|
435
|
+
# # read whole file
|
436
|
+
# open("file") do |f|
|
437
|
+
# data = f.read # This returns a string even if the file is empty.
|
438
|
+
# # ...
|
439
|
+
# end
|
440
|
+
#
|
441
|
+
# # iterate over fixed length records
|
442
|
+
# open("fixed-record-file") do |f|
|
443
|
+
# while record = f.read(256)
|
444
|
+
# # ...
|
445
|
+
# end
|
446
|
+
# end
|
447
|
+
#
|
448
|
+
# # iterate over variable length records,
|
449
|
+
# # each record is prefixed by its 32-bit length
|
450
|
+
# open("variable-record-file") do |f|
|
451
|
+
# while len = f.read(4)
|
452
|
+
# len = len.unpack("N")[0] # 32-bit length
|
453
|
+
# record = f.read(len) # This returns a string even if len is 0.
|
454
|
+
# end
|
455
|
+
# end
|
456
|
+
#
|
457
|
+
# Note that this method behaves like the fread() function in C. This means it
|
458
|
+
# retries to invoke read(2) system calls to read data with the specified length
|
459
|
+
# (or until EOF). This behavior is preserved even if *ios* is in non-blocking
|
460
|
+
# mode. (This method is non-blocking flag insensitive as other methods.) If you
|
461
|
+
# need the behavior like a single read(2) system call, consider #readpartial,
|
462
|
+
# #read_nonblock, and #sysread.
|
463
|
+
#
|
464
|
+
def read: (?Integer? length, ?String outbuf) -> String?
|
409
465
|
|
410
466
|
def read_nonblock: (Integer len) -> String
|
411
467
|
| (Integer len, ?String buf) -> String
|
@@ -428,8 +484,63 @@ class IO < Object
|
|
428
484
|
|
429
485
|
def readlines: (?String sep, ?Integer limit) -> ::Array[String]
|
430
486
|
|
431
|
-
|
432
|
-
|
487
|
+
# Reads at most *maxlen* bytes from the I/O stream. It blocks only if *ios* has
|
488
|
+
# no data immediately available. It doesn't block if some data available.
|
489
|
+
#
|
490
|
+
# If the optional *outbuf* argument is present, it must reference a String,
|
491
|
+
# which will receive the data. The *outbuf* will contain only the received data
|
492
|
+
# after the method call even if it is not empty at the beginning.
|
493
|
+
#
|
494
|
+
# It raises EOFError on end of file.
|
495
|
+
#
|
496
|
+
# readpartial is designed for streams such as pipe, socket, tty, etc. It blocks
|
497
|
+
# only when no data immediately available. This means that it blocks only when
|
498
|
+
# following all conditions hold.
|
499
|
+
# * the byte buffer in the IO object is empty.
|
500
|
+
# * the content of the stream is empty.
|
501
|
+
# * the stream is not reached to EOF.
|
502
|
+
#
|
503
|
+
#
|
504
|
+
# When readpartial blocks, it waits data or EOF on the stream. If some data is
|
505
|
+
# reached, readpartial returns with the data. If EOF is reached, readpartial
|
506
|
+
# raises EOFError.
|
507
|
+
#
|
508
|
+
# When readpartial doesn't blocks, it returns or raises immediately. If the byte
|
509
|
+
# buffer is not empty, it returns the data in the buffer. Otherwise if the
|
510
|
+
# stream has some content, it returns the data in the stream. Otherwise if the
|
511
|
+
# stream is reached to EOF, it raises EOFError.
|
512
|
+
#
|
513
|
+
# r, w = IO.pipe # buffer pipe content
|
514
|
+
# w << "abc" # "" "abc".
|
515
|
+
# r.readpartial(4096) #=> "abc" "" ""
|
516
|
+
# r.readpartial(4096) # blocks because buffer and pipe is empty.
|
517
|
+
#
|
518
|
+
# r, w = IO.pipe # buffer pipe content
|
519
|
+
# w << "abc" # "" "abc"
|
520
|
+
# w.close # "" "abc" EOF
|
521
|
+
# r.readpartial(4096) #=> "abc" "" EOF
|
522
|
+
# r.readpartial(4096) # raises EOFError
|
523
|
+
#
|
524
|
+
# r, w = IO.pipe # buffer pipe content
|
525
|
+
# w << "abc\ndef\n" # "" "abc\ndef\n"
|
526
|
+
# r.gets #=> "abc\n" "def\n" ""
|
527
|
+
# w << "ghi\n" # "def\n" "ghi\n"
|
528
|
+
# r.readpartial(4096) #=> "def\n" "" "ghi\n"
|
529
|
+
# r.readpartial(4096) #=> "ghi\n" "" ""
|
530
|
+
#
|
531
|
+
# Note that readpartial behaves similar to sysread. The differences are:
|
532
|
+
# * If the byte buffer is not empty, read from the byte buffer instead of
|
533
|
+
# "sysread for buffered IO (IOError)".
|
534
|
+
# * It doesn't cause Errno::EWOULDBLOCK and Errno::EINTR. When readpartial
|
535
|
+
# meets EWOULDBLOCK and EINTR by read system call, readpartial retry the
|
536
|
+
# system call.
|
537
|
+
#
|
538
|
+
#
|
539
|
+
# The latter means that readpartial is nonblocking-flag insensitive. It blocks
|
540
|
+
# on the situation IO#sysread causes Errno::EWOULDBLOCK as if the fd is blocking
|
541
|
+
# mode.
|
542
|
+
#
|
543
|
+
def readpartial: (Integer maxlen, ?String outbuf) -> String
|
433
544
|
|
434
545
|
def reopen: (IO other_IO_or_path) -> IO
|
435
546
|
| (String other_IO_or_path, ?String mode_str) -> IO
|
@@ -508,13 +619,55 @@ class IO < Object
|
|
508
619
|
|
509
620
|
def ungetc: (String arg0) -> NilClass
|
510
621
|
|
511
|
-
|
622
|
+
# Writes the given strings to *ios*. The stream must be opened for writing.
|
623
|
+
# Arguments that are not a string will be converted to a string using `to_s`.
|
624
|
+
# Returns the number of bytes written in total.
|
625
|
+
#
|
626
|
+
# count = $stdout.write("This is", " a test\n")
|
627
|
+
# puts "That was #{count} bytes of data"
|
628
|
+
#
|
629
|
+
# *produces:*
|
630
|
+
#
|
631
|
+
# This is a test
|
632
|
+
# That was 15 bytes of data
|
633
|
+
#
|
634
|
+
def write: (*_ToS string) -> Integer
|
512
635
|
|
636
|
+
# Opens the file, optionally seeks to the given *offset*, then returns *length*
|
637
|
+
# bytes (defaulting to the rest of the file). #binread ensures the file is
|
638
|
+
# closed before returning. The open mode would be `"rb:ASCII-8BIT"`.
|
639
|
+
#
|
640
|
+
# IO.binread("testfile") #=> "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
|
641
|
+
# IO.binread("testfile", 20) #=> "This is line one\nThi"
|
642
|
+
# IO.binread("testfile", 20, 10) #=> "ne one\nThis is line "
|
643
|
+
#
|
513
644
|
def self.binread: (String name, ?Integer length, ?Integer offset) -> String
|
514
645
|
|
515
|
-
|
646
|
+
# Same as IO.write except opening the file in binary mode and ASCII-8BIT
|
647
|
+
# encoding (`"wb:ASCII-8BIT"`).
|
648
|
+
#
|
649
|
+
def self.binwrite: (String name, _ToS string, ?Integer offset, ?mode: String mode) -> Integer
|
516
650
|
|
517
|
-
|
651
|
+
# IO.copy_stream copies *src* to *dst*. *src* and *dst* is either a filename or
|
652
|
+
# an IO-like object. IO-like object for *src* should have #readpartial or #read
|
653
|
+
# method. IO-like object for *dst* should have #write method. (Specialized
|
654
|
+
# mechanisms, such as sendfile system call, may be used on appropriate
|
655
|
+
# situation.)
|
656
|
+
#
|
657
|
+
# This method returns the number of bytes copied.
|
658
|
+
#
|
659
|
+
# If optional arguments are not given, the start position of the copy is the
|
660
|
+
# beginning of the filename or the current file offset of the IO. The end
|
661
|
+
# position of the copy is the end of file.
|
662
|
+
#
|
663
|
+
# If *copy_length* is given, No more than *copy_length* bytes are copied.
|
664
|
+
#
|
665
|
+
# If *src_offset* is given, it specifies the start position of the copy.
|
666
|
+
#
|
667
|
+
# When *src_offset* is specified and *src* is an IO, IO.copy_stream doesn't move
|
668
|
+
# the current file offset.
|
669
|
+
#
|
670
|
+
def self.copy_stream: ((String | _Reader | _ReaderPartial) src, (String | _Writer) dst, ?Integer copy_length, ?Integer src_offset) -> Integer
|
518
671
|
|
519
672
|
def self.popen: (*untyped args) -> untyped
|
520
673
|
|
data/core/kernel.rbs
CHANGED
data/core/time.rbs
CHANGED
@@ -757,18 +757,6 @@ class Time < Object
|
|
757
757
|
#
|
758
758
|
def subsec: () -> Numeric
|
759
759
|
|
760
|
-
# Returns a new Time object, one second later than *time*. Time#succ is obsolete
|
761
|
-
# since 1.9.2 for time is not a discrete value.
|
762
|
-
#
|
763
|
-
# t = Time.now #=> 2007-11-19 08:23:57 -0600
|
764
|
-
# t.succ #=> 2007-11-19 08:23:58 -0600
|
765
|
-
#
|
766
|
-
# Use instead `time + 1`
|
767
|
-
#
|
768
|
-
# t + 1 #=> 2007-11-19 08:23:58 -0600
|
769
|
-
#
|
770
|
-
def succ: () -> Time
|
771
|
-
|
772
760
|
# Returns `true` if *time* represents Sunday.
|
773
761
|
#
|
774
762
|
# t = Time.local(1990, 4, 1) #=> 1990-04-01 00:00:00 -0600
|
data/goodcheck.yml
CHANGED
@@ -28,6 +28,26 @@ rules:
|
|
28
28
|
pass:
|
29
29
|
- "def `send`: (String | Symbol, *untyped) -> untyped"
|
30
30
|
|
31
|
+
- id: rbs.prefer_boolish
|
32
|
+
pattern:
|
33
|
+
- regexp: '\([^(]*\bbool\b[^\n]*\)'
|
34
|
+
- token: "-> bool }"
|
35
|
+
message: |
|
36
|
+
Prefer `boolish` over `bool` for method arguments and block return values
|
37
|
+
|
38
|
+
See the doc below:
|
39
|
+
https://github.com/ruby/rbs/blob/78d04a2db0f1c4925d2b13c2939868edf9465d6c/docs/syntax.md#bool-or-boolish
|
40
|
+
glob:
|
41
|
+
- "**/*.rbs"
|
42
|
+
justification:
|
43
|
+
- When you strictly want `true | false`.
|
44
|
+
pass:
|
45
|
+
- "(arg: boolish)"
|
46
|
+
- "{ () -> boolish }"
|
47
|
+
fail:
|
48
|
+
- "(arg: bool)"
|
49
|
+
- "{ () -> bool }"
|
50
|
+
|
31
51
|
- id: deprecate_stdlib_test
|
32
52
|
pattern:
|
33
53
|
token: < StdlibTest
|
data/lib/rbs.rb
CHANGED
@@ -23,6 +23,8 @@ require "rbs/environment_loader"
|
|
23
23
|
require "rbs/builtin_names"
|
24
24
|
require "rbs/definition"
|
25
25
|
require "rbs/definition_builder"
|
26
|
+
require "rbs/definition_builder/ancestor_builder"
|
27
|
+
require "rbs/definition_builder/method_builder"
|
26
28
|
require "rbs/variance_calculator"
|
27
29
|
require "rbs/substitution"
|
28
30
|
require "rbs/constant"
|
data/lib/rbs/ast/declarations.rb
CHANGED
@@ -136,10 +136,12 @@ module RBS
|
|
136
136
|
class Super
|
137
137
|
attr_reader :name
|
138
138
|
attr_reader :args
|
139
|
+
attr_reader :location
|
139
140
|
|
140
|
-
def initialize(name:, args:)
|
141
|
+
def initialize(name:, args:, location:)
|
141
142
|
@name = name
|
142
143
|
@args = args
|
144
|
+
@location = location
|
143
145
|
end
|
144
146
|
|
145
147
|
def ==(other)
|
@@ -155,7 +157,8 @@ module RBS
|
|
155
157
|
def to_json(*a)
|
156
158
|
{
|
157
159
|
name: name,
|
158
|
-
args: args
|
160
|
+
args: args,
|
161
|
+
location: location
|
159
162
|
}.to_json(*a)
|
160
163
|
end
|
161
164
|
end
|
@@ -352,6 +355,8 @@ module RBS
|
|
352
355
|
attr_reader :location
|
353
356
|
attr_reader :comment
|
354
357
|
|
358
|
+
include MixinHelper
|
359
|
+
|
355
360
|
def initialize(name:, type_params:, members:, annotations:, location:, comment:)
|
356
361
|
@name = name
|
357
362
|
@type_params = type_params
|
data/lib/rbs/ast/members.rb
CHANGED
@@ -20,7 +20,7 @@ module RBS
|
|
20
20
|
@annotations = annotations
|
21
21
|
@location = location
|
22
22
|
@comment = comment
|
23
|
-
@overload = overload
|
23
|
+
@overload = overload ? true : false
|
24
24
|
end
|
25
25
|
|
26
26
|
def ==(other)
|
@@ -216,31 +216,34 @@ module RBS
|
|
216
216
|
module Attribute
|
217
217
|
attr_reader :name
|
218
218
|
attr_reader :type
|
219
|
+
attr_reader :kind
|
219
220
|
attr_reader :ivar_name
|
220
221
|
attr_reader :annotations
|
221
222
|
attr_reader :location
|
222
223
|
attr_reader :comment
|
223
224
|
|
224
|
-
def initialize(name:, type:, ivar_name:, annotations:, location:, comment:)
|
225
|
+
def initialize(name:, type:, ivar_name:, kind:, annotations:, location:, comment:)
|
225
226
|
@name = name
|
226
227
|
@type = type
|
227
228
|
@ivar_name = ivar_name
|
228
229
|
@annotations = annotations
|
229
230
|
@location = location
|
230
231
|
@comment = comment
|
232
|
+
@kind = kind
|
231
233
|
end
|
232
234
|
|
233
235
|
def ==(other)
|
234
236
|
other.is_a?(self.class) &&
|
235
237
|
other.name == name &&
|
236
238
|
other.type == type &&
|
237
|
-
other.ivar_name == ivar_name
|
239
|
+
other.ivar_name == ivar_name &&
|
240
|
+
other.kind == kind
|
238
241
|
end
|
239
242
|
|
240
243
|
alias eql? ==
|
241
244
|
|
242
245
|
def hash
|
243
|
-
self.class.hash ^ name.hash ^ type.hash ^ ivar_name.hash
|
246
|
+
self.class.hash ^ name.hash ^ type.hash ^ ivar_name.hash ^ kind.hash
|
244
247
|
end
|
245
248
|
end
|
246
249
|
|
@@ -253,6 +256,7 @@ module RBS
|
|
253
256
|
name: name,
|
254
257
|
type: type,
|
255
258
|
ivar_name: ivar_name,
|
259
|
+
kind: kind,
|
256
260
|
annotations: annotations,
|
257
261
|
location: location,
|
258
262
|
comment: comment
|
@@ -269,6 +273,7 @@ module RBS
|
|
269
273
|
name: name,
|
270
274
|
type: type,
|
271
275
|
ivar_name: ivar_name,
|
276
|
+
kind: kind,
|
272
277
|
annotations: annotations,
|
273
278
|
location: location,
|
274
279
|
comment: comment
|
@@ -285,6 +290,7 @@ module RBS
|
|
285
290
|
name: name,
|
286
291
|
type: type,
|
287
292
|
ivar_name: ivar_name,
|
293
|
+
kind: kind,
|
288
294
|
annotations: annotations,
|
289
295
|
location: location,
|
290
296
|
comment: comment
|