rbs 2.2.2 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +4 -0
  3. data/.github/workflows/comments.yml +2 -2
  4. data/.github/workflows/ruby.yml +1 -1
  5. data/.gitignore +0 -1
  6. data/CHANGELOG.md +43 -0
  7. data/Gemfile +2 -1
  8. data/Gemfile.lock +117 -0
  9. data/Rakefile +1 -1
  10. data/core/dir.rbs +1 -1
  11. data/core/enumerator.rbs +1 -1
  12. data/core/false_class.rbs +1 -1
  13. data/core/integer.rbs +4 -4
  14. data/core/io/wait.rbs +1 -1
  15. data/core/module.rbs +21 -2
  16. data/core/nil_class.rbs +7 -5
  17. data/core/object.rbs +9 -0
  18. data/core/trace_point.rbs +42 -3
  19. data/core/true_class.rbs +1 -1
  20. data/ext/rbs_extension/constants.c +1 -1
  21. data/ext/rbs_extension/extconf.rb +1 -1
  22. data/ext/rbs_extension/location.c +1 -1
  23. data/ext/rbs_extension/parser.c +4 -3
  24. data/ext/rbs_extension/parserstate.c +2 -2
  25. data/ext/rbs_extension/unescape.c +1 -1
  26. data/lib/rbs/ast/members.rb +2 -1
  27. data/lib/rbs/collection/installer.rb +4 -1
  28. data/lib/rbs/definition_builder/ancestor_builder.rb +4 -2
  29. data/lib/rbs/definition_builder/method_builder.rb +1 -1
  30. data/lib/rbs/definition_builder.rb +2 -2
  31. data/lib/rbs/environment.rb +24 -12
  32. data/lib/rbs/locator.rb +24 -15
  33. data/lib/rbs/prototype/rb.rb +17 -6
  34. data/lib/rbs/resolver/constant_resolver.rb +192 -0
  35. data/lib/rbs/resolver/type_name_resolver.rb +55 -0
  36. data/lib/rbs/type_name.rb +15 -0
  37. data/lib/rbs/version.rb +1 -1
  38. data/lib/rbs.rb +2 -0
  39. data/schema/members.json +4 -1
  40. data/sig/environment.rbs +28 -21
  41. data/sig/environment_loader.rbs +23 -23
  42. data/sig/locator.rbs +2 -0
  43. data/sig/manifest.yaml +8 -0
  44. data/sig/resolver/constant_resolver.rbs +93 -0
  45. data/sig/resolver/context.rbs +34 -0
  46. data/sig/resolver/type_name_resolver.rbs +31 -0
  47. data/sig/typename.rbs +9 -3
  48. data/stdlib/bigdecimal/0/big_decimal.rbs +135 -0
  49. data/stdlib/erb/0/erb.rbs +237 -0
  50. data/stdlib/optparse/0/optparse.rbs +20 -18
  51. data/stdlib/prime/0/prime.rbs +115 -4
  52. data/stdlib/rubygems/0/version.rbs +159 -1
  53. data/steep/Gemfile.lock +13 -15
  54. metadata +10 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d38dbf926f1fd55787f5d4a70ed5e31ce737e040b698e2aa3d5f68ab14a8b791
4
- data.tar.gz: 0d86ba79682c662bc3ab2058a0e4464be43d8a317e58194c0e7dfd1f8aaec735
3
+ metadata.gz: f16a35868e75e53f28b6c63c095c60190f14e3eecb9d30b87046d184646176dd
4
+ data.tar.gz: 123998b67c9b926af173e64adeb0e9437ff784d13d960d50219274f472c36973
5
5
  SHA512:
6
- metadata.gz: 25801791a12dfe85b729fc0e72eb9ebdb0e801c3c1fe3a1f8d9ec2ded0476e8b2a35a7ac520f034a1d8fe2e954bf4bc6d59caaaf9136286cd5844e8f3d8ae7da
7
- data.tar.gz: b5ad3e185184b6ffcb786379abd5909284bab2a680ece911db40fccc7b8d258a52d588114ee99178c00b1d5bcf2030698c7e9db94b7b00b3d2ea88d269dd9de7
6
+ metadata.gz: f9ba3b43d4dbf19239b4ece9443d5da88ff2ca62cf73bfa102464537ecad3a3893b2d6de97679e51d25c2abd5bc43cfb69d608227aa779b6352a9a9ae78c1cac
7
+ data.tar.gz: cdec18fab9146ce955a5b10b74f9c068a8ebec8a229bf9019ec2772d99e47b57ece38342cb71a8b9b2740d99106151b6fa91e3a6c2c80685a386f58c63eb5757
@@ -8,3 +8,7 @@ updates:
8
8
  directory: "/steep"
9
9
  schedule:
10
10
  interval: "daily"
11
+ - package-ecosystem: 'github-actions'
12
+ directory: '/'
13
+ schedule:
14
+ interval: 'weekly'
@@ -12,11 +12,11 @@ jobs:
12
12
  container:
13
13
  image: rubylang/ruby:3.1-focal
14
14
  steps:
15
- - uses: actions/checkout@v2
15
+ - uses: actions/checkout@v3
16
16
  - name: Install dependencies
17
17
  run: |
18
18
  apt-get update
19
- apt-get install -y libdb-dev
19
+ apt-get install -y libdb-dev curl
20
20
  - name: Update rubygems & bundler
21
21
  run: |
22
22
  ruby -v
@@ -35,7 +35,7 @@ jobs:
35
35
  container:
36
36
  image: rubylang/ruby:${{ matrix.container_tag }}
37
37
  steps:
38
- - uses: actions/checkout@v2
38
+ - uses: actions/checkout@v3
39
39
  - name: Install dependencies
40
40
  run: |
41
41
  apt-get update
data/.gitignore CHANGED
@@ -14,7 +14,6 @@
14
14
  **/.rbenv-version
15
15
  **/.versions.conf
16
16
  /vendor/sigs
17
- /Gemfile.lock
18
17
 
19
18
  lib/**/*.bundle
20
19
  lib/**/*.so
data/CHANGELOG.md CHANGED
@@ -2,6 +2,49 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 2.3.0 (2022-04-01)
6
+
7
+ ### Signature updates
8
+
9
+ * `Enumerator` ([\#931](https://github.com/ruby/rbs/pull/931))
10
+ * `FalseClass` ([\#931](https://github.com/ruby/rbs/pull/931))
11
+ * `Integer` ([\#914](https://github.com/ruby/rbs/pull/914))
12
+ * `Module` ([\#931](https://github.com/ruby/rbs/pull/931))
13
+ * `NilClass` ([\#931](https://github.com/ruby/rbs/pull/931))
14
+ * `Object` ([\#931](https://github.com/ruby/rbs/pull/931))
15
+ * `Prime` ([\#934](https://github.com/ruby/rbs/pull/934))
16
+ * `TracePoint` ([\#941](https://github.com/ruby/rbs/pull/941))
17
+ * `TrueClass` ([\#931](https://github.com/ruby/rbs/pull/931))
18
+ * `#to_d` ([\#936](https://github.com/ruby/rbs/pull/936))
19
+ * `IO#wait_writable` ([\#943](https://github.com/ruby/rbs/pull/943))
20
+
21
+ ### Library changes
22
+
23
+ * Add `Resolver::ConstantResolver` and `Resolver::TypeNameResolver` ([\#938](https://github.com/ruby/rbs/pull/938))
24
+ * Fix RBS::Locator ([\#930](https://github.com/ruby/rbs/pull/930))
25
+ * Trying to preserve more locations ([\#915](https://github.com/ruby/rbs/pull/915))
26
+ * Add visibility modifier to method definition json ([\#923](https://github.com/ruby/rbs/pull/923), [\#928](https://github.com/ruby/rbs/pull/928))
27
+ * Add manifest.yaml for rbs gem ([\#921](https://github.com/ruby/rbs/pull/921))
28
+ * Fix Environment type checking ([\#929](https://github.com/ruby/rbs/pull/929))
29
+ * Fix memory violation in C extension ([\#952](https://github.com/ruby/rbs/pull/952))
30
+ * Fix warnings in C extension ([\#954](https://github.com/ruby/rbs/pull/954))
31
+
32
+ #### rbs prototype
33
+
34
+ * Better typing for known `self`-returning method calls ([\#932](https://github.com/ruby/rbs/pull/932))
35
+ * Let constants have literal types ([\#937](https://github.com/ruby/rbs/pull/937))
36
+
37
+ #### rbs collection
38
+
39
+ * Fix error message to tell gem name when source is not found ([\#927](https://github.com/ruby/rbs/pull/927))
40
+
41
+ ### Miscellaneous
42
+
43
+ * Fix `bin/sort` for constants ([\#919](https://github.com/ruby/rbs/pull/919))
44
+ * Use actions/checkout@v3 ([\#944](https://github.com/ruby/rbs/pull/944))
45
+ * Added actions ecosystem for dependabot ([\#946](https://github.com/ruby/rbs/pull/946))
46
+ * Confirm RDoc is up to date ([\#945](https://github.com/ruby/rbs/pull/945))
47
+
5
48
  ## 2.2.2 (2022-02-22)
6
49
 
7
50
  ### Signature updates
data/Gemfile CHANGED
@@ -8,7 +8,6 @@ gem "rake"
8
8
  gem "rake-compiler"
9
9
  gem "test-unit"
10
10
  gem "rspec"
11
- gem "racc"
12
11
  gem "rubocop"
13
12
  gem "rubocop-rubycw"
14
13
  gem "json"
@@ -18,6 +17,8 @@ gem "goodcheck"
18
17
  gem "dbm"
19
18
  gem 'digest'
20
19
  gem 'tempfile'
20
+ gem "prime"
21
+ gem "rdoc"
21
22
 
22
23
  # Test gems
23
24
  gem "rbs-amber", path: "test/assets/test-gem"
data/Gemfile.lock ADDED
@@ -0,0 +1,117 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rbs (2.3.0)
5
+
6
+ PATH
7
+ remote: test/assets/test-gem
8
+ specs:
9
+ rbs-amber (1.0.0)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ addressable (2.8.0)
15
+ public_suffix (>= 2.0.2, < 5.0)
16
+ ast (2.4.2)
17
+ dbm (1.1.0)
18
+ debase (0.2.5.beta2)
19
+ debase-ruby_core_source (>= 0.10.12)
20
+ debase-ruby_core_source (0.10.14)
21
+ diff-lcs (1.5.0)
22
+ digest (3.1.0)
23
+ forwardable (1.3.2)
24
+ goodcheck (3.1.0)
25
+ marcel (>= 1.0, < 2.0)
26
+ psych (>= 3.1, < 5.0)
27
+ rainbow (>= 3.0, < 4.0)
28
+ strong_json (>= 1.1, < 2.2)
29
+ json (2.6.1)
30
+ json-schema (2.8.1)
31
+ addressable (>= 2.4)
32
+ marcel (1.0.2)
33
+ minitest (5.15.0)
34
+ parallel (1.22.1)
35
+ parser (3.1.1.0)
36
+ ast (~> 2.4.1)
37
+ power_assert (2.0.1)
38
+ prime (0.1.2)
39
+ forwardable
40
+ singleton
41
+ psych (4.0.3)
42
+ stringio
43
+ public_suffix (4.0.6)
44
+ rainbow (3.1.1)
45
+ rake (13.0.6)
46
+ rake-compiler (1.1.9)
47
+ rake
48
+ rdoc (6.4.0)
49
+ psych (>= 4.0.0)
50
+ regexp_parser (2.2.1)
51
+ rexml (3.2.5)
52
+ rspec (3.11.0)
53
+ rspec-core (~> 3.11.0)
54
+ rspec-expectations (~> 3.11.0)
55
+ rspec-mocks (~> 3.11.0)
56
+ rspec-core (3.11.0)
57
+ rspec-support (~> 3.11.0)
58
+ rspec-expectations (3.11.0)
59
+ diff-lcs (>= 1.2.0, < 2.0)
60
+ rspec-support (~> 3.11.0)
61
+ rspec-mocks (3.11.1)
62
+ diff-lcs (>= 1.2.0, < 2.0)
63
+ rspec-support (~> 3.11.0)
64
+ rspec-support (3.11.0)
65
+ rubocop (1.26.1)
66
+ parallel (~> 1.10)
67
+ parser (>= 3.1.0.0)
68
+ rainbow (>= 2.2.2, < 4.0)
69
+ regexp_parser (>= 1.8, < 3.0)
70
+ rexml
71
+ rubocop-ast (>= 1.16.0, < 2.0)
72
+ ruby-progressbar (~> 1.7)
73
+ unicode-display_width (>= 1.4.0, < 3.0)
74
+ rubocop-ast (1.16.0)
75
+ parser (>= 3.1.1.0)
76
+ rubocop-rubycw (0.1.6)
77
+ rubocop (~> 1.0)
78
+ ruby-debug-ide (0.7.3)
79
+ rake (>= 0.8.1)
80
+ ruby-progressbar (1.11.0)
81
+ singleton (0.1.1)
82
+ stackprof (0.2.19)
83
+ stringio (3.0.1)
84
+ strong_json (2.1.2)
85
+ tempfile (0.1.2)
86
+ test-unit (3.5.3)
87
+ power_assert
88
+ unicode-display_width (2.1.0)
89
+
90
+ PLATFORMS
91
+ ruby
92
+ x86_64-darwin-20
93
+
94
+ DEPENDENCIES
95
+ dbm
96
+ debase (>= 0.2.5.beta2)
97
+ digest
98
+ goodcheck
99
+ json
100
+ json-schema
101
+ minitest
102
+ prime
103
+ rake
104
+ rake-compiler
105
+ rbs!
106
+ rbs-amber!
107
+ rdoc
108
+ rspec
109
+ rubocop
110
+ rubocop-rubycw
111
+ ruby-debug-ide
112
+ stackprof
113
+ tempfile
114
+ test-unit
115
+
116
+ BUNDLED WITH
117
+ 2.2.32
data/Rakefile CHANGED
@@ -35,7 +35,7 @@ rule ".c" => ".re" do |t|
35
35
  end
36
36
 
37
37
  task :annotate do
38
- sh "rbs annotate core stdlib"
38
+ sh "bin/generate_docs.sh"
39
39
  end
40
40
 
41
41
  task :confirm_annotation do
data/core/dir.rbs CHANGED
@@ -406,7 +406,7 @@ class Dir
406
406
  # Dir.glob("*.[^r]*") #=> ["config.h"]
407
407
  # Dir.glob("*.{rb,h}") #=> ["main.rb", "config.h"]
408
408
  # Dir.glob("*") #=> ["config.h", "main.rb"]
409
- # Dir.glob("*", File::FNM_DOTMATCH) #=> [".", "..", "config.h", "main.rb"]
409
+ # Dir.glob("*", File::FNM_DOTMATCH) #=> [".", "config.h", "main.rb"]
410
410
  # Dir.glob(["*.rb", "*.h"]) #=> ["main.rb", "config.h"]
411
411
  #
412
412
  # Dir.glob("**/*.rb") #=> ["main.rb",
data/core/enumerator.rbs CHANGED
@@ -515,7 +515,7 @@ end
515
515
  #
516
516
  # This type of objects can be created by Enumerable#chain and Enumerator#+.
517
517
  #
518
- class Enumerator::Chain[out Elem] < Object
518
+ class Enumerator::Chain[out Elem] < Enumerator[Elem, void]
519
519
  include Enumerable[Elem]
520
520
 
521
521
  # <!--
data/core/false_class.rbs CHANGED
@@ -27,7 +27,7 @@ class FalseClass
27
27
  # statements.
28
28
  #
29
29
  def ===: (false) -> true
30
- | (untyped obj) -> bool
30
+ | (untyped obj) -> false
31
31
 
32
32
  # <!--
33
33
  # rdoc-file=object.c
data/core/integer.rbs CHANGED
@@ -857,8 +857,8 @@ class Integer < Numeric
857
857
  #
858
858
  # With no block given, returns an Enumerator.
859
859
  #
860
- def downto: (Integer limit) { (Integer) -> void } -> Integer
861
- | (Integer limit) -> ::Enumerator[Integer, self]
860
+ def downto: (Numeric limit) { (Integer) -> void } -> Integer
861
+ | (Numeric limit) -> ::Enumerator[Integer, self]
862
862
 
863
863
  def dup: () -> self
864
864
 
@@ -1432,8 +1432,8 @@ class Integer < Numeric
1432
1432
  #
1433
1433
  # With no block given, returns an Enumerator.
1434
1434
  #
1435
- def upto: (Integer limit) { (Integer) -> void } -> Integer
1436
- | (Integer limit) -> ::Enumerator[Integer, self]
1435
+ def upto: (Numeric limit) { (Integer) -> void } -> Integer
1436
+ | (Numeric limit) -> ::Enumerator[Integer, self]
1437
1437
 
1438
1438
  # <!--
1439
1439
  # rdoc-file=numeric.rb
data/core/io/wait.rbs CHANGED
@@ -54,5 +54,5 @@ class IO
54
54
  # -->
55
55
  # Waits until IO is writable and returns `true` or `false` when times out.
56
56
  #
57
- def wait_writable: (?Numeric? timeout) -> (self | bool | nil)?
57
+ def wait_writable: (?Numeric? timeout) -> boolish
58
58
  end
data/core/module.rbs CHANGED
@@ -363,7 +363,7 @@ class Module < Object
363
363
  #
364
364
  # Hello there!
365
365
  #
366
- def class_exec: (*untyped args) { () -> untyped } -> untyped
366
+ def class_exec: [U] (*untyped args) { () -> U } -> U
367
367
 
368
368
  # <!--
369
369
  # rdoc-file=object.c
@@ -676,6 +676,25 @@ class Module < Object
676
676
  def define_method: (Symbol | String arg0, ?Proc | Method | UnboundMethod arg1) -> Symbol
677
677
  | (Symbol | String arg0) { () -> untyped } -> Symbol
678
678
 
679
+ # <!--
680
+ # rdoc-file=object.c
681
+ # - mod.deprecate_constant(symbol, ...) => mod
682
+ # -->
683
+ # Makes a list of existing constants deprecated. Attempt to refer to them will
684
+ # produce a warning.
685
+ #
686
+ # module HTTP
687
+ # NotFound = Exception.new
688
+ # NOT_FOUND = NotFound # previous version of the library used this name
689
+ #
690
+ # deprecate_constant :NOT_FOUND
691
+ # end
692
+ #
693
+ # HTTP::NOT_FOUND
694
+ # # warning: constant HTTP::NOT_FOUND is deprecated
695
+ #
696
+ def deprecate_constant: (*Symbol) -> self
697
+
679
698
  def eql?: (untyped other) -> bool
680
699
 
681
700
  def equal?: (untyped other) -> bool
@@ -1025,7 +1044,7 @@ class Module < Object
1025
1044
  #
1026
1045
  # Hello there!
1027
1046
  #
1028
- def module_exec: (*untyped args) { () -> untyped } -> untyped
1047
+ def module_exec: [U] (*untyped args) { (*untyped args) -> U } -> U
1029
1048
 
1030
1049
  # <!--
1031
1050
  # rdoc-file=vm_method.c
data/core/nil_class.rbs CHANGED
@@ -4,6 +4,8 @@
4
4
  class NilClass
5
5
  public
6
6
 
7
+ def !: () -> true
8
+
7
9
  # <!--
8
10
  # rdoc-file=object.c
9
11
  # - false & obj -> false
@@ -12,7 +14,7 @@ class NilClass
12
14
  # And---Returns `false`. *obj* is always evaluated as it is the argument to a
13
15
  # method call---there is no short-circuit evaluation in this case.
14
16
  #
15
- def &: (untyped obj) -> bool
17
+ def &: (untyped obj) -> false
16
18
 
17
19
  # <!--
18
20
  # rdoc-file=object.c
@@ -23,7 +25,7 @@ class NilClass
23
25
  # statements.
24
26
  #
25
27
  def ===: (nil) -> true
26
- | (untyped obj) -> bool
28
+ | (untyped obj) -> false
27
29
 
28
30
  # <!--
29
31
  # rdoc-file=object.c
@@ -43,7 +45,7 @@ class NilClass
43
45
  #
44
46
  def ^: (nil) -> false
45
47
  | (false) -> false
46
- | (untyped obj) -> bool
48
+ | (untyped obj) -> true
47
49
 
48
50
  # <!--
49
51
  # rdoc-file=object.c
@@ -59,7 +61,7 @@ class NilClass
59
61
  # -->
60
62
  # Only the object *nil* responds `true` to `nil?`.
61
63
  #
62
- def nil?: () -> bool
64
+ def nil?: () -> true
63
65
 
64
66
  # <!--
65
67
  # rdoc-file=rational.c
@@ -142,7 +144,7 @@ class NilClass
142
144
  #
143
145
  def |: (nil) -> false
144
146
  | (false) -> false
145
- | (untyped obj) -> bool
147
+ | (untyped obj) -> true
146
148
 
147
149
  def clone: (?freeze: true?) -> self
148
150
  end
data/core/object.rbs CHANGED
@@ -912,6 +912,15 @@ class Object < BasicObject
912
912
  #
913
913
  def public_method: (name name) -> Method
914
914
 
915
+ # <!--
916
+ # rdoc-file=object.c
917
+ # - obj.public_methods(all=true) -> array
918
+ # -->
919
+ # Returns the list of public methods accessible to *obj*. If the *all* parameter
920
+ # is set to `false`, only those methods in the receiver will be listed.
921
+ #
922
+ def public_methods: (?boolish all) -> Array[Symbol]
923
+
915
924
  # <!--
916
925
  # rdoc-file=vm_eval.c
917
926
  # - obj.public_send(symbol [, args...]) -> obj
data/core/trace_point.rbs CHANGED
@@ -304,8 +304,8 @@ class TracePoint < Object
304
304
  # trace.enable { p tp.lineno }
305
305
  # #=> RuntimeError: access from outside
306
306
  #
307
- def enable: () -> bool
308
- | () { () -> void } -> void
307
+ def enable: (?target: (Method | UnboundMethod | Proc)?, ?target_line: Integer?, ?target_thread: Thread?) -> bool
308
+ | [R] (?target: (Method | UnboundMethod | Proc)?, ?target_line: Integer?, ?target_thread: Thread?) { () -> R } -> R
309
309
 
310
310
  # <!--
311
311
  # rdoc-file=trace_point.rb
@@ -315,6 +315,16 @@ class TracePoint < Object
315
315
  #
316
316
  def enabled?: () -> bool
317
317
 
318
+ # <!--
319
+ # rdoc-file=trace_point.rb
320
+ # - event()
321
+ # -->
322
+ # Type of event
323
+ #
324
+ # See TracePoint@Events for more information.
325
+ #
326
+ def event: () -> ::Symbol
327
+
318
328
  # <!--
319
329
  # rdoc-file=trace_point.rb
320
330
  # - trace.inspect -> string
@@ -347,6 +357,15 @@ class TracePoint < Object
347
357
  #
348
358
  def path: () -> String
349
359
 
360
+ # <!--
361
+ # rdoc-file=trace_point.rb
362
+ # - parameters()
363
+ # -->
364
+ # Return the parameters definition of the method or block that the current hook
365
+ # belongs to. Format is the same as for Method#parameters
366
+ #
367
+ def parameters: () -> ::Array[[ :req | :opt | :rest | :keyreq | :key | :keyrest | :block, Symbol ] | [ :rest | :keyrest ]]
368
+
350
369
  # <!--
351
370
  # rdoc-file=trace_point.rb
352
371
  # - raised_exception()
@@ -374,5 +393,25 @@ class TracePoint < Object
374
393
  #
375
394
  # trace.binding.eval('self')
376
395
  #
377
- def self: () -> Binding
396
+ def self: () -> untyped
397
+
398
+ # <!--
399
+ # rdoc-file=trace_point.rb
400
+ # - eval_script()
401
+ # -->
402
+ # Compiled source code (String) on *eval methods on the `:script_compiled`
403
+ # event. If loaded from a file, it will return nil.
404
+ #
405
+ def eval_script: () -> String?
406
+
407
+ # <!--
408
+ # rdoc-file=trace_point.rb
409
+ # - instruction_sequence()
410
+ # -->
411
+ # Compiled instruction sequence represented by a RubyVM::InstructionSequence
412
+ # instance on the `:script_compiled` event.
413
+ #
414
+ # Note that this method is MRI specific.
415
+ #
416
+ def instruction_sequence: () -> RubyVM::InstructionSequence
378
417
  end
data/core/true_class.rbs CHANGED
@@ -27,7 +27,7 @@ class TrueClass
27
27
  # statements.
28
28
  #
29
29
  def ===: (true) -> true
30
- | (untyped obj) -> bool
30
+ | (untyped obj) -> false
31
31
 
32
32
  # <!--
33
33
  # rdoc-file=object.c
@@ -67,7 +67,7 @@ VALUE RBS_MethodType;
67
67
 
68
68
  VALUE RBS_ParsingError;
69
69
 
70
- void rbs__init_constants() {
70
+ void rbs__init_constants(void) {
71
71
  ID id_RBS = rb_intern_const("RBS");
72
72
 
73
73
  RBS = rb_const_get(rb_cObject, id_RBS);
@@ -1,4 +1,4 @@
1
1
  require 'mkmf'
2
2
  $INCFLAGS << " -I$(top_srcdir)" if $extmk
3
- $CFLAGS += " -std=c99 "
3
+ $CFLAGS += " -std=c99 -Wold-style-definition"
4
4
  create_makefile 'rbs_extension'
@@ -276,7 +276,7 @@ VALUE rbs_location_pp(VALUE buffer, const position *start_pos, const position *e
276
276
  return rbs_new_location(buffer, rg);
277
277
  }
278
278
 
279
- void rbs__init_location() {
279
+ void rbs__init_location(void) {
280
280
  RBS_Location = rb_define_class_under(RBS, "Location", rb_cObject);
281
281
  rb_define_alloc_func(RBS_Location, location_s_allocate);
282
282
  rb_define_private_method(RBS_Location, "initialize", location_initialize, 3);
@@ -77,7 +77,7 @@ static VALUE string_of_loc(parserstate *state, position start, position end) {
77
77
  /**
78
78
  * Raises RuntimeError with "Unexpected error " messsage.
79
79
  * */
80
- static NORETURN(void) rbs_abort() {
80
+ static NORETURN(void) rbs_abort(void) {
81
81
  rb_raise(
82
82
  rb_eRuntimeError,
83
83
  "Unexpected error"
@@ -1046,7 +1046,6 @@ VALUE parse_type_params(parserstate *state, range *rg, bool module_type_params)
1046
1046
 
1047
1047
  parser_advance_assert(state, tUIDENT);
1048
1048
  name_range = state->current_token.range;
1049
- param_range.end = state->current_token.range.end;
1050
1049
 
1051
1050
  ID id = INTERN_TOKEN(state, state->current_token);
1052
1051
  name = ID2SYM(id);
@@ -1065,6 +1064,8 @@ VALUE parse_type_params(parserstate *state, range *rg, bool module_type_params)
1065
1064
  }
1066
1065
  }
1067
1066
 
1067
+ param_range.end = state->current_token.range.end;
1068
+
1068
1069
  VALUE location = rbs_new_location(state->buffer, param_range);
1069
1070
  rbs_loc *loc = rbs_check_location(location);
1070
1071
  rbs_loc_add_required_child(loc, rb_intern("name"), name_range);
@@ -2495,7 +2496,7 @@ rbsparser_parse_signature(VALUE self, VALUE buffer, VALUE line, VALUE column)
2495
2496
  return signature;
2496
2497
  }
2497
2498
 
2498
- void rbs__init_parser() {
2499
+ void rbs__init_parser(void) {
2499
2500
  RBS_Parser = rb_define_class_under(RBS, "Parser", rb_cObject);
2500
2501
  rb_define_singleton_method(RBS_Parser, "_parse_type", rbsparser_parse_type, 4);
2501
2502
  rb_define_singleton_method(RBS_Parser, "_parse_method_type", rbsparser_parse_method_type, 4);
@@ -2,7 +2,7 @@
2
2
 
3
3
  #define RESET_TABLE_P(table) (table->size == 0)
4
4
 
5
- id_table *alloc_empty_table() {
5
+ id_table *alloc_empty_table(void) {
6
6
  id_table *table = malloc(sizeof(id_table));
7
7
  table->size = 10;
8
8
  table->count = 0;
@@ -11,7 +11,7 @@ id_table *alloc_empty_table() {
11
11
  return table;
12
12
  }
13
13
 
14
- id_table *alloc_reset_table() {
14
+ id_table *alloc_reset_table(void) {
15
15
  id_table *table = malloc(sizeof(id_table));
16
16
  table->size = 0;
17
17
 
@@ -19,6 +19,7 @@ void rbs_unescape_string(VALUE string) {
19
19
 
20
20
  if (!HASH) {
21
21
  HASH = rb_hash_new();
22
+ rb_global_variable(&HASH);
22
23
  rb_hash_aset(HASH, rb_str_new_literal("\\a"), rb_str_new_literal("\a"));
23
24
  rb_hash_aset(HASH, rb_str_new_literal("\\b"), rb_str_new_literal("\b"));
24
25
  rb_hash_aset(HASH, rb_str_new_literal("\\e"), rb_str_new_literal("\e"));
@@ -29,7 +30,6 @@ void rbs_unescape_string(VALUE string) {
29
30
  rb_hash_aset(HASH, rb_str_new_literal("\\t"), rb_str_new_literal("\t"));
30
31
  rb_hash_aset(HASH, rb_str_new_literal("\\v"), rb_str_new_literal("\v"));
31
32
  rb_hash_aset(HASH, rb_str_new_literal("\\\""), rb_str_new_literal("\""));
32
- rb_global_variable(&HASH);
33
33
  }
34
34
 
35
35
  rb_funcall(string, gsub, 2, REGEXP, HASH);
@@ -73,7 +73,8 @@ module RBS
73
73
  annotations: annotations,
74
74
  location: location,
75
75
  comment: comment,
76
- overload: overload
76
+ overload: overload,
77
+ visibility: visibility
77
78
  }.to_json(state)
78
79
  end
79
80
  end
@@ -20,7 +20,10 @@ module RBS
20
20
 
21
21
  private def source_for(config_entry)
22
22
  @source_for ||= {}
23
- key = config_entry['source'] or raise
23
+ key = config_entry['source']
24
+ unless key
25
+ raise "Cannot find source of '#{config_entry['name']}' gem"
26
+ end
24
27
  @source_for[key] ||= Sources.from_config_entry(key)
25
28
  end
26
29
  end
@@ -367,7 +367,7 @@ module RBS
367
367
 
368
368
  align_params = Substitution.build(
369
369
  decl.type_params.each.map(&:name),
370
- Types::Variable.build(entry.type_params.each.map(&:name))
370
+ entry.type_params.map {|param| Types::Variable.new(name: param.name, location: param.location) }
371
371
  )
372
372
 
373
373
  mixin_ancestors0(decl,
@@ -386,7 +386,9 @@ module RBS
386
386
 
387
387
  entry = env.class_decls[type_name] or raise "Unknown name for instance_ancestors: #{type_name}"
388
388
  params = entry.type_params.each.map(&:name)
389
- args = Types::Variable.build(params)
389
+ args = entry.type_params.map do |type_param|
390
+ Types::Variable.new(name: type_param.name, location: type_param.location)
391
+ end
390
392
  self_ancestor = Definition::Ancestor::Instance.new(name: type_name, args: args, source: nil)
391
393
 
392
394
  RecursiveAncestorError.check!(self_ancestor,
@@ -98,7 +98,7 @@ module RBS
98
98
  instance_methods[type_name] ||=
99
99
  begin
100
100
  entry = env.class_decls[type_name]
101
- args = Types::Variable.build(entry.type_params.each.map(&:name))
101
+ args = entry.type_params.map {|param| Types::Variable.new(name: param.name, location: param.location) }
102
102
  type = Types::ClassInstance.new(name: type_name, args: args, location: nil)
103
103
  Methods.new(type: type).tap do |methods|
104
104
  entry.decls.each do |d|