Skip to content

Commit b9550be

Browse files
authored
Merge pull request #206 from flafflar/update-deprecated-typename
Update deprecated `RBS::TypeName()` with `RBS::TypeName.parse()`
2 parents 3820614 + cc2f841 commit b9550be

File tree

12 files changed

+49
-44
lines changed

12 files changed

+49
-44
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ gem "rake", "~> 13.2"
99

1010
gem "minitest", "~> 5.25"
1111

12-
gem "steep", "~> 1.8.3", require: false
12+
gem "steep", "~> 1.9.0", require: false
1313
gem "strscan"

Gemfile.lock

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
PATH
22
remote: .
33
specs:
4-
rbs-inline (0.11.0)
4+
rbs-inline (0.11.1)
55
prism (>= 0.29, < 1.3)
6-
rbs (>= 3.5.0)
6+
rbs (>= 3.8.0)
77

88
GEM
99
remote: https://rubygems.org/
@@ -51,10 +51,10 @@ GEM
5151
rb-fsevent (0.11.2)
5252
rb-inotify (0.11.1)
5353
ffi (~> 1.0)
54-
rbs (3.6.1)
54+
rbs (3.9.4)
5555
logger
5656
securerandom (0.4.1)
57-
steep (1.8.3)
57+
steep (1.9.4)
5858
activesupport (>= 5.1)
5959
concurrent-ruby (>= 1.1.10)
6060
csv (>= 3.0.9)
@@ -65,16 +65,18 @@ GEM
6565
logger (>= 1.3.0)
6666
parser (>= 3.1)
6767
rainbow (>= 2.2.2, < 4.0)
68-
rbs (~> 3.6.0)
68+
rbs (~> 3.8)
6969
securerandom (>= 0.1)
7070
strscan (>= 1.0.0)
7171
terminal-table (>= 2, < 4)
72+
uri (>= 0.12.0)
7273
strscan (3.1.2)
7374
terminal-table (3.0.2)
7475
unicode-display_width (>= 1.1.1, < 3)
7576
tzinfo (2.0.6)
7677
concurrent-ruby (~> 1.0)
7778
unicode-display_width (2.6.0)
79+
uri (1.0.3)
7880

7981
PLATFORMS
8082
arm64-darwin-22
@@ -88,7 +90,7 @@ DEPENDENCIES
8890
minitest (~> 5.25)
8991
rake (~> 13.2)
9092
rbs-inline!
91-
steep (~> 1.8.3)
93+
steep (~> 1.9.0)
9294
strscan
9395

9496
BUNDLED WITH

lib/rbs/inline/ast/annotations.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ def initialize(tree, source)
494494
end
495495
end
496496

497-
typename = TypeName(token_strs.join)
497+
typename = TypeName.parse(token_strs.join)
498498
@clauses << RBS::AST::Directives::Use::SingleClause.new(
499499
type_name: typename,
500500
new_name: new_name,

lib/rbs/inline/ast/declarations.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module ConstantUtil
1010
def type_name(node)
1111
case node
1212
when Prism::ConstantReadNode, Prism::ConstantPathNode
13-
TypeName(node.full_name)
13+
TypeName.parse(node.full_name)
1414
end
1515
end
1616

lib/rbs/inline/node_utils.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module NodeUtils
88
def type_name(node)
99
case node
1010
when Prism::ConstantReadNode
11-
TypeName(node.name.to_s)
11+
TypeName.parse(node.name.to_s)
1212
end
1313
end
1414
end

lib/rbs/inline/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module RBS
44
module Inline
5-
VERSION = "0.11.0"
5+
VERSION = "0.11.1"
66
end
77
end

lib/rbs/inline/writer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def translate_data_assign_decl(decl, rbs) #: void
267267
members = [:singleton, :instance].map do |kind|
268268
RBS::AST::Members::MethodDefinition.new(
269269
name: :members,
270-
kind: kind, #: RBS::AST::MethodDefinition::Kind
270+
kind: kind, #: RBS::AST::Members::MethodDefinition::kind
271271
overloads: [
272272
RBS::AST::Members::MethodDefinition::Overload.new(
273273
method_type: RBS::MethodType.new(

rbs-inline.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ Gem::Specification.new do |spec|
2929
spec.require_paths = ["lib"]
3030

3131
spec.add_dependency "prism", ">= 0.29", "< 1.3"
32-
spec.add_dependency "rbs", ">= 3.5.0"
32+
spec.add_dependency "rbs", ">= 3.8.0"
3333
end

rbs_collection.lock.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ gems:
1414
source:
1515
type: stdlib
1616
- name: minitest
17-
version: '0'
17+
version: '5.25'
1818
source:
19-
type: stdlib
19+
type: git
20+
name: ruby/gem_rbs_collection
21+
revision: 43b158b1fc209960643ca6baf5f883b186997e8d
22+
remote: https://github.com/ruby/gem_rbs_collection.git
23+
repo_dir: gems
2024
- name: monitor
2125
version: '0'
2226
source:
2327
type: stdlib
24-
- name: mutex_m
25-
version: '0'
26-
source:
27-
type: stdlib
2828
- name: optparse
2929
version: '0'
3030
source:
@@ -42,11 +42,11 @@ gems:
4242
source:
4343
type: git
4444
name: ruby/gem_rbs_collection
45-
revision: 218cf130d31f63e110e350efc3fa265311b0f238
45+
revision: 43b158b1fc209960643ca6baf5f883b186997e8d
4646
remote: https://github.com/ruby/gem_rbs_collection.git
4747
repo_dir: gems
4848
- name: rbs
49-
version: 3.6.1
49+
version: 3.9.4
5050
source:
5151
type: rubygems
5252
- name: rdoc

test/rbs/inline/annotation_parser_test.rb

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
require "test_helper"
44

55
class RBS::Inline::AnnotationParserTest < Minitest::Test
6+
include RBS
67
include RBS::Inline
78

89
def parse_comments(src)
@@ -289,11 +290,11 @@ def test_inherits
289290
RUBY
290291

291292
annots[0].annotations[0].tap do |annotation|
292-
assert_equal TypeName("Object"), annotation.super_name
293+
assert_equal TypeName.parse("Object"), annotation.super_name
293294
assert_equal [], annotation.args.map(&:to_s)
294295
end
295296
annots[0].annotations[1].tap do |annotation|
296-
assert_equal TypeName("Array"), annotation.super_name
297+
assert_equal TypeName.parse("Array"), annotation.super_name
297298
assert_equal ["String"], annotation.args.map(&:to_s)
298299
end
299300
annots[0].annotations[2].tap do |annotation|
@@ -338,39 +339,39 @@ def test_use
338339
assert_instance_of AST::Annotations::Use, annotation
339340

340341
annotation.clauses[0].tap do |clause|
341-
assert_equal TypeName("::Foo"), clause.type_name
342+
assert_equal TypeName.parse("::Foo"), clause.type_name
342343
assert_nil clause.new_name
343344
end
344345
end
345346
annots[0].annotations[1].tap do |annotation|
346347
assert_instance_of AST::Annotations::Use, annotation
347348

348349
annotation.clauses[0].tap do |clause|
349-
assert_equal TypeName("Foo"), clause.type_name
350+
assert_equal TypeName.parse("Foo"), clause.type_name
350351
assert_nil clause.new_name
351352
end
352353
end
353354
annots[0].annotations[2].tap do |annotation|
354355
assert_instance_of AST::Annotations::Use, annotation
355356

356357
annotation.clauses[0].tap do |clause|
357-
assert_equal TypeName("Foo::Bar"), clause.type_name
358+
assert_equal TypeName.parse("Foo::Bar"), clause.type_name
358359
assert_nil clause.new_name
359360
end
360361
end
361362
annots[0].annotations[3].tap do |annotation|
362363
assert_instance_of AST::Annotations::Use, annotation
363364

364365
annotation.clauses[0].tap do |clause|
365-
assert_equal TypeName("Foo::bar"), clause.type_name
366+
assert_equal TypeName.parse("Foo::bar"), clause.type_name
366367
assert_nil clause.new_name
367368
end
368369
end
369370
annots[0].annotations[4].tap do |annotation|
370371
assert_instance_of AST::Annotations::Use, annotation
371372

372373
annotation.clauses[0].tap do |clause|
373-
assert_equal TypeName("Foo::_Bar"), clause.type_name
374+
assert_equal TypeName.parse("Foo::_Bar"), clause.type_name
374375
assert_nil clause.new_name
375376
end
376377
end
@@ -385,15 +386,15 @@ def test_use
385386
assert_instance_of AST::Annotations::Use, annotation
386387

387388
annotation.clauses[0].tap do |clause|
388-
assert_equal TypeName("Foo::Bar"), clause.type_name
389+
assert_equal TypeName.parse("Foo::Bar"), clause.type_name
389390
assert_equal :Bar2, clause.new_name
390391
end
391392
annotation.clauses[1].tap do |clause|
392-
assert_equal TypeName("Foo::bar"), clause.type_name
393+
assert_equal TypeName.parse("Foo::bar"), clause.type_name
393394
assert_equal :bar2, clause.new_name
394395
end
395396
annotation.clauses[2].tap do |clause|
396-
assert_equal TypeName("Foo::_Bar"), clause.type_name
397+
assert_equal TypeName.parse("Foo::_Bar"), clause.type_name
397398
assert_equal :_Bar2, clause.new_name
398399
end
399400
end
@@ -663,29 +664,29 @@ def test_module_decl_annotation
663664

664665
annots[0].annotations[0].tap do |annotation|
665666
assert_instance_of AST::Annotations::ModuleDecl, annotation
666-
assert_equal TypeName("Foo"), annotation.name
667+
assert_equal TypeName.parse("Foo"), annotation.name
667668
assert_empty annotation.type_params
668669
assert_empty annotation.self_types
669670
end
670671
annots[0].annotations[1].tap do |annotation|
671672
assert_instance_of AST::Annotations::ModuleDecl, annotation
672-
assert_equal TypeName("::Foo::Bar"), annotation.name
673+
assert_equal TypeName.parse("::Foo::Bar"), annotation.name
673674
assert_empty annotation.type_params
674675
assert_empty annotation.self_types
675676
end
676677
annots[0].annotations[2].tap do |annotation|
677678
assert_instance_of AST::Annotations::ModuleDecl, annotation
678-
assert_equal TypeName("Foo"), annotation.name
679+
assert_equal TypeName.parse("Foo"), annotation.name
679680
annotation.type_params[0].tap do |param|
680681
assert_equal :A, param.name
681682
assert_equal "Integer", param.upper_bound.to_s
682683
end
683684
annotation.self_types[0].tap do |self_type|
684-
assert_equal TypeName("BasicObject"), self_type.name
685+
assert_equal TypeName.parse("BasicObject"), self_type.name
685686
assert_empty self_type.args
686687
end
687688
annotation.self_types[1].tap do |self_type|
688-
assert_equal TypeName("_Each"), self_type.name
689+
assert_equal TypeName.parse("_Each"), self_type.name
689690
assert_equal ["String"], self_type.args.map(&:to_s)
690691
end
691692
end
@@ -705,18 +706,18 @@ def test_class_decl_annotation
705706

706707
annots[0].annotations[0].tap do |annotation|
707708
assert_instance_of AST::Annotations::ClassDecl, annotation
708-
assert_equal TypeName("Foo"), annotation.name
709+
assert_equal TypeName.parse("Foo"), annotation.name
709710
assert_empty annotation.type_params
710711
assert_nil annotation.super_class
711712
end
712713
annots[0].annotations[1].tap do |annotation|
713714
assert_instance_of AST::Annotations::ClassDecl, annotation
714-
assert_equal TypeName("Foo"), annotation.name
715+
assert_equal TypeName.parse("Foo"), annotation.name
715716
annotation.type_params[0].tap do |param|
716717
assert_equal :A, param.name
717718
assert_equal "Integer", param.upper_bound.to_s
718719
end
719-
assert_equal TypeName("Array"), annotation.super_class.name
720+
assert_equal TypeName.parse("Array"), annotation.super_class.name
720721
assert_equal ["A"], annotation.super_class.args.map(&:to_s)
721722
end
722723
end

0 commit comments

Comments
 (0)