rbs-inline 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5a68634b62b49714735e0b84f748c4e2a646dc1f785644202b76dcbcb7a3937
4
- data.tar.gz: 19d106b8ff48e0eab47f30751764611437fb13a1cf54bb382738e849217fb2fe
3
+ metadata.gz: f73d1f3ac7e111f773fe9b2d034dc5ccc3a8732f50aacf1a07655ad3450e24f4
4
+ data.tar.gz: '082c1f8a6ef85a239f29563f1e95d6af0ac0af89c5860a6c552d56505a0a27ba'
5
5
  SHA512:
6
- metadata.gz: b8f197fbd6ed4bbb17f3715aa314320405561ee2dd8fe61c7a1d61279e8f1c7d2ba166308cee7282114f004a195853f0bb1f736a932466e58000ced915f844d7
7
- data.tar.gz: 7ae9e4c5a8ecbdc3c9935c698ed5964454c5d1b152e3f637457b96220f959e3489df7906c674f88a99f346879d9cd66768dd4ec7b4a39206030e41c880493344
6
+ metadata.gz: 6002e610f1440abbfe351ee3c746e6c4c1f6dcae1a885fc9a5f60d701ebd0548620d8c6ffc6211bffd5830fd9c65901f7d7155d6de049a8670f0b72749f55b0c
7
+ data.tar.gz: 61041de88fbc0048f48fc46c012e1d1a7ff66760aef73e288f60351705425f466d84a4d50488feac54bb58e50fb504916596a8ceaf8ee5f99c76919227ee431e
data/README.md CHANGED
@@ -34,7 +34,7 @@ class Person
34
34
  end
35
35
 
36
36
  # @rbs &block: (String) -> void
37
- def each_address(&block) #:: void
37
+ def each_address(&block) #: void
38
38
  addresses.each(&block)
39
39
  end
40
40
  end
@@ -274,6 +274,7 @@ module RBS
274
274
  # @rbs override
275
275
  def visit_call_node(node)
276
276
  return if ignored_node?(node)
277
+ return super unless current_class_module_decl
277
278
 
278
279
  case node.name
279
280
  when :include, :prepend, :extend
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RBS
4
4
  module Inline
5
- VERSION = "0.8.0"
5
+ VERSION = "0.9.0"
6
6
  end
7
7
  end
@@ -180,7 +180,7 @@ module RBS
180
180
 
181
181
  rbs << RBS::AST::Declarations::Constant.new(
182
182
  name: decl.constant_name,
183
- type: decl.type,
183
+ type: constant_decl_to_type(decl),
184
184
  comment: comment,
185
185
  location: nil
186
186
  )
@@ -608,6 +608,28 @@ module RBS
608
608
  comment: comment
609
609
  )
610
610
  end
611
+
612
+ # @rbs decl: AST::Declarations::ConstantDecl
613
+ # @rbs return: RBS::Types::t
614
+ def constant_decl_to_type(decl)
615
+ type = decl.type
616
+ return type unless type.is_a?(RBS::Types::ClassInstance)
617
+ return type if type.args.any?
618
+
619
+ case decl.node.value
620
+ when Prism::ArrayNode
621
+ RBS::BuiltinNames::Array.instance_type(untyped)
622
+ when Prism::HashNode
623
+ RBS::BuiltinNames::Hash.instance_type(untyped, untyped)
624
+ else
625
+ type
626
+ end
627
+ end
628
+
629
+ # @rbs return: RBS::Types::Bases::Any
630
+ def untyped
631
+ @untyped ||= RBS::Types::Bases::Any.new(location: nil)
632
+ end
611
633
  end
612
634
  end
613
635
  end
@@ -34,7 +34,7 @@ gems:
34
34
  source:
35
35
  type: stdlib
36
36
  - name: prism
37
- version: 0.30.0
37
+ version: 1.0.0
38
38
  source:
39
39
  type: rubygems
40
40
  - name: rake
@@ -42,11 +42,11 @@ gems:
42
42
  source:
43
43
  type: git
44
44
  name: ruby/gem_rbs_collection
45
- revision: 03121e6bbf2340e3b179edcc351deac45476f4d0
45
+ revision: 25b8cf2135233e112d93d6b64083ee5e419875b6
46
46
  remote: https://github.com/ruby/gem_rbs_collection.git
47
47
  repo_dir: gems
48
48
  - name: rbs
49
- version: 3.5.3
49
+ version: 3.6.0
50
50
  source:
51
51
  type: rubygems
52
52
  - name: rdoc
@@ -107,6 +107,13 @@ module RBS
107
107
  # @rbs rbs: _Content
108
108
  # @rbs return: void
109
109
  def translate_class_block_decl: (AST::Declarations::BlockDecl block, _Content rbs) -> void
110
+
111
+ # @rbs decl: AST::Declarations::ConstantDecl
112
+ # @rbs return: RBS::Types::t
113
+ def constant_decl_to_type: (AST::Declarations::ConstantDecl decl) -> RBS::Types::t
114
+
115
+ # @rbs return: RBS::Types::Bases::Any
116
+ def untyped: () -> RBS::Types::Bases::Any
110
117
  end
111
118
  end
112
119
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs-inline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.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: 2024-09-17 00:00:00.000000000 Z
11
+ date: 2024-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prism
@@ -34,14 +34,14 @@ dependencies:
34
34
  name: rbs
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: 3.5.0
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "~>"
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: 3.5.0
47
47
  description: Inline RBS type declaration.