rbs 0.13.1 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -1
  3. data/.gitignore +0 -1
  4. data/CHANGELOG.md +7 -2
  5. data/Gemfile +3 -0
  6. data/README.md +8 -2
  7. data/Steepfile +1 -0
  8. data/bin/annotate-with-rdoc +1 -1
  9. data/bin/setup +0 -2
  10. data/docs/CONTRIBUTING.md +1 -0
  11. data/goodcheck.yml +22 -5
  12. data/lib/rbs/ast/comment.rb +1 -1
  13. data/lib/rbs/definition_builder.rb +4 -5
  14. data/lib/rbs/environment.rb +1 -1
  15. data/lib/rbs/namespace.rb +1 -1
  16. data/lib/rbs/parser.rb +3146 -0
  17. data/lib/rbs/parser.y +7 -2
  18. data/lib/rbs/test/setup_helper.rb +4 -4
  19. data/lib/rbs/test/type_check.rb +2 -2
  20. data/lib/rbs/type_name.rb +1 -1
  21. data/lib/rbs/variance_calculator.rb +1 -1
  22. data/lib/rbs/version.rb +1 -1
  23. data/lib/rbs/writer.rb +1 -1
  24. data/sig/constant.rbs +2 -2
  25. data/sig/constant_table.rbs +10 -10
  26. data/sig/declarations.rbs +1 -1
  27. data/sig/definition.rbs +1 -1
  28. data/sig/namespace.rbs +3 -3
  29. data/sig/parser.rbs +25 -0
  30. data/sig/substitution.rbs +3 -3
  31. data/sig/typename.rbs +1 -1
  32. data/sig/types.rbs +1 -1
  33. data/sig/writer.rbs +15 -15
  34. data/stdlib/benchmark/benchmark.rbs +2 -2
  35. data/stdlib/builtin/basic_object.rbs +54 -54
  36. data/stdlib/builtin/binding.rbs +42 -42
  37. data/stdlib/builtin/class.rbs +33 -33
  38. data/stdlib/builtin/complex.rbs +90 -90
  39. data/stdlib/builtin/encoding.rbs +33 -33
  40. data/stdlib/builtin/enumerable.rbs +32 -32
  41. data/stdlib/builtin/enumerator.rbs +35 -35
  42. data/stdlib/builtin/errors.rbs +1 -1
  43. data/stdlib/builtin/exception.rbs +50 -50
  44. data/stdlib/builtin/false_class.rbs +6 -6
  45. data/stdlib/builtin/fiber.rbs +14 -14
  46. data/stdlib/builtin/fiber_error.rbs +1 -1
  47. data/stdlib/builtin/float.rbs +161 -161
  48. data/stdlib/builtin/gc.rbs +1 -1
  49. data/stdlib/builtin/io.rbs +83 -83
  50. data/stdlib/builtin/kernel.rbs +69 -69
  51. data/stdlib/builtin/match_data.rbs +1 -1
  52. data/stdlib/builtin/method.rbs +19 -19
  53. data/stdlib/builtin/nil_class.rbs +20 -20
  54. data/stdlib/builtin/numeric.rbs +101 -101
  55. data/stdlib/builtin/object.rbs +172 -172
  56. data/stdlib/builtin/proc.rbs +91 -91
  57. data/stdlib/builtin/range.rbs +2 -4
  58. data/stdlib/builtin/rational.rbs +83 -83
  59. data/stdlib/builtin/signal.rbs +7 -7
  60. data/stdlib/builtin/string.rbs +4 -4
  61. data/stdlib/builtin/string_io.rbs +1 -1
  62. data/stdlib/builtin/thread.rbs +185 -185
  63. data/stdlib/builtin/thread_group.rbs +2 -2
  64. data/stdlib/builtin/true_class.rbs +9 -9
  65. data/stdlib/builtin/warning.rbs +1 -1
  66. data/stdlib/date/date.rbs +2 -2
  67. data/stdlib/find/find.rbs +10 -10
  68. data/stdlib/pathname/pathname.rbs +1 -1
  69. data/stdlib/tmpdir/tmpdir.rbs +12 -12
  70. metadata +3 -2
@@ -1,11 +1,11 @@
1
1
  # [ThreadGroup](ThreadGroup) provides a means of
2
2
  # keeping track of a number of threads as a group.
3
- #
3
+ #
4
4
  # A given [Thread](https://ruby-doc.org/core-2.6.3/Thread.html) object can
5
5
  # only belong to one [ThreadGroup](ThreadGroup) at a
6
6
  # time; adding a thread to a new group will remove it from any previous
7
7
  # group.
8
- #
8
+ #
9
9
  # Newly created threads belong to the same group as the thread from which
10
10
  # they were created.
11
11
  class ThreadGroup < Object
@@ -1,14 +1,14 @@
1
1
  # The global value `true` is the only instance of class TrueClass and represents
2
2
  # a logically true value in boolean expressions. The class provides operators
3
3
  # allowing `true` to be used in logical expressions.
4
- #
4
+ #
5
5
  class TrueClass
6
6
  public
7
7
 
8
8
  def !: () -> bool
9
9
 
10
10
  # And---Returns `false` if *obj* is `nil` or `false`, `true` otherwise.
11
- #
11
+ #
12
12
  def &: (nil) -> false
13
13
  | (false) -> false
14
14
  | (untyped obj) -> bool
@@ -16,12 +16,12 @@ class TrueClass
16
16
  # Case Equality -- For class Object, effectively the same as calling `#==`, but
17
17
  # typically overridden by descendants to provide meaningful semantics in `case`
18
18
  # statements.
19
- #
19
+ #
20
20
  def ===: (true) -> true
21
21
  | (untyped obj) -> bool
22
22
 
23
23
  # Exclusive Or---Returns `true` if *obj* is `nil` or `false`, `false` otherwise.
24
- #
24
+ #
25
25
  def ^: (nil) -> true
26
26
  | (false) -> true
27
27
  | (untyped obj) -> bool
@@ -29,18 +29,18 @@ class TrueClass
29
29
  alias inspect to_s
30
30
 
31
31
  # The string representation of `true` is "true".
32
- #
32
+ #
33
33
  def to_s: () -> "true"
34
34
 
35
35
  # Or---Returns `true`. As *obj* is an argument to a method call, it is always
36
36
  # evaluated; there is no short-circuit evaluation in this case.
37
- #
37
+ #
38
38
  # true | puts("or")
39
39
  # true || puts("logical or")
40
- #
40
+ #
41
41
  # *produces:*
42
- #
42
+ #
43
43
  # or
44
- #
44
+ #
45
45
  def |: (bool obj) -> bool
46
46
  end
@@ -3,7 +3,7 @@
3
3
  # module extends itself, making `Warning.warn` available.
4
4
  # [\#warn](Warning#method-i-warn) is called for all
5
5
  # warnings issued by Ruby. By default, warnings are printed to $stderr.
6
- #
6
+ #
7
7
  # By overriding [\#warn](Warning#method-i-warn), you
8
8
  # can change how warnings are handled by Ruby, either filtering some
9
9
  # warnings, and/or outputting warnings somewhere other than $stderr. When
@@ -318,7 +318,7 @@ class Date
318
318
  #
319
319
  def self.ordinal: (?Integer year, ?Integer yday, ?Integer start) -> Date
320
320
 
321
- # Parses the given representation of date and time, and creates a date object.
321
+ # Parses the given representation of date and time, and creates a date object.
322
322
  # This method does not function as a validator.
323
323
  #
324
324
  # If the optional second argument is true and the detected year is in the range
@@ -448,7 +448,7 @@ class Date
448
448
  #
449
449
  def +: (Integer | Rational other) -> Date
450
450
 
451
- # Returns the difference between the two dates if the other is a date object.
451
+ # Returns the difference between the two dates if the other is a date object.
452
452
  # If the other is a numeric value, returns a date object pointing `other` days
453
453
  # before self. If the other is a fractional number, assumes its precision is at
454
454
  # most nanosecond.
@@ -1,12 +1,12 @@
1
1
  # The `Find` module supports the top-down traversal of a set of file paths.
2
- #
2
+ #
3
3
  # For example, to total the size of all files under your home directory,
4
4
  # ignoring anything in a "dot" directory (e.g. $HOME/.ssh):
5
- #
5
+ #
6
6
  # require 'find'
7
- #
7
+ #
8
8
  # total_size = 0
9
- #
9
+ #
10
10
  # Find.find(ENV["HOME"]) do |path|
11
11
  # if FileTest.directory?(path)
12
12
  # if File.basename(path).start_with?('.')
@@ -18,23 +18,23 @@
18
18
  # total_size += FileTest.size(path)
19
19
  # end
20
20
  # end
21
- #
21
+ #
22
22
  module Find
23
23
  # Calls the associated block with the name of every file and directory listed as
24
24
  # arguments, then recursively on their subdirectories, and so on.
25
- #
25
+ #
26
26
  # Returns an enumerator if no block is given.
27
- #
27
+ #
28
28
  # See the `Find` module documentation for an example.
29
- #
29
+ #
30
30
  def self?.find: (*String | _ToPath paths, ?ignore_error: bool) -> Enumerator[String, nil]
31
31
  | (*String | _ToPath paths, ?ignore_error: bool) { (String arg0) -> void } -> nil
32
32
 
33
33
  # Skips the current file or directory, restarting the loop with the next entry.
34
34
  # If the current file is a directory, that directory will not be recursively
35
35
  # entered. Meaningful only within the block associated with Find::find.
36
- #
36
+ #
37
37
  # See the `Find` module documentation for an example.
38
- #
38
+ #
39
39
  def self?.prune: () -> void
40
40
  end
@@ -1078,7 +1078,7 @@ end
1078
1078
 
1079
1079
  module Kernel
1080
1080
  private
1081
-
1081
+
1082
1082
  # Creates a new Pathname object from the given string, `path`, and returns
1083
1083
  # pathname object.
1084
1084
  #
@@ -1,13 +1,13 @@
1
1
  class Dir
2
2
  # Returns the operating system's temporary file path.
3
- #
3
+ #
4
4
  def self.tmpdir: () -> String
5
5
 
6
6
  # Dir.mktmpdir creates a temporary directory.
7
- #
7
+ #
8
8
  # The directory is created with 0700 permission. Application should not change
9
9
  # the permission to make the temporary directory accessible from other users.
10
- #
10
+ #
11
11
  # The prefix and suffix of the name of the directory is specified by the
12
12
  # optional first argument, *prefix_suffix*.
13
13
  # * If it is not specified or nil, "d" is used as the prefix and no suffix is
@@ -15,30 +15,30 @@ class Dir
15
15
  # * If it is a string, it is used as the prefix and no suffix is used.
16
16
  # * If it is an array, first element is used as the prefix and second element
17
17
  # is used as a suffix.
18
- #
19
- #
18
+ #
19
+ #
20
20
  # Dir.mktmpdir {|dir| dir is ".../d..." }
21
21
  # Dir.mktmpdir("foo") {|dir| dir is ".../foo..." }
22
22
  # Dir.mktmpdir(["foo", "bar"]) {|dir| dir is ".../foo...bar" }
23
- #
23
+ #
24
24
  # The directory is created under Dir.tmpdir or the optional second argument
25
25
  # *tmpdir* if non-nil value is given.
26
- #
26
+ #
27
27
  # Dir.mktmpdir {|dir| dir is "#{Dir.tmpdir}/d..." }
28
28
  # Dir.mktmpdir(nil, "/var/tmp") {|dir| dir is "/var/tmp/d..." }
29
- #
29
+ #
30
30
  # If a block is given, it is yielded with the path of the directory. The
31
31
  # directory and its contents are removed using FileUtils.remove_entry before
32
32
  # Dir.mktmpdir returns. The value of the block is returned.
33
- #
33
+ #
34
34
  # Dir.mktmpdir {|dir|
35
35
  # # use the directory...
36
36
  # open("#{dir}/foo", "w") { ... }
37
37
  # }
38
- #
38
+ #
39
39
  # If a block is not given, The path of the directory is returned. In this case,
40
40
  # Dir.mktmpdir doesn't remove the directory.
41
- #
41
+ #
42
42
  # dir = Dir.mktmpdir
43
43
  # begin
44
44
  # # use the directory...
@@ -47,7 +47,7 @@ class Dir
47
47
  # # remove the directory.
48
48
  # FileUtils.remove_entry dir
49
49
  # end
50
- #
50
+ #
51
51
  def self.mktmpdir: (?(String | [ String, String ] | nil), ?String?, ?max_try: Integer?) -> String
52
52
  | [X] (?(String | [ String, String ] | nil), ?String?, ?max_try: Integer?) { (String) -> X } -> X
53
53
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-09 00:00:00.000000000 Z
11
+ date: 2020-10-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: RBS is the language for type signatures for Ruby and standard library
14
14
  definitions.
@@ -112,6 +112,7 @@ files:
112
112
  - sig/members.rbs
113
113
  - sig/method_types.rbs
114
114
  - sig/namespace.rbs
115
+ - sig/parser.rbs
115
116
  - sig/polyfill.rbs
116
117
  - sig/rbs.rbs
117
118
  - sig/substitution.rbs