rbs 2.2.0 → 2.2.1

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: f4afaa0d6ac4b7b74aae38aa7cd04679dad881ad073ca496aa06f272a7261cfe
4
- data.tar.gz: 041f1bf758d156f9a968ae3cb460da45a99f80aacb2868513549687ee4e4ad76
3
+ metadata.gz: 148d69843b5a84c07daea0f8729c7f72c693daf327ef82045cb312c2211c09fe
4
+ data.tar.gz: 4df8267989d27a0b9d807e5149681ba854e73976e3e9e8ea610f480d89ac261d
5
5
  SHA512:
6
- metadata.gz: 8891199897e1ef1574b8009bc810c0d60a1a8fbe4a9f2d5d6658b703c75d515d6e89022e5246a6196657775d8f0ea2bd44db13718a425face5d16d3e5cff38dd
7
- data.tar.gz: faa9199018c944a87de33fc99a4bf203e73f2f24d27960d79cd92fb82aaa6be2218cae07a2bb6887ad1dee2df96e8abc7b43ec818bf11d5a40dfabf3e782f1c2
6
+ metadata.gz: b7ed92c4b514890fbe54072a32e3f114cc5f403167b14cbaf6ac3809abff21af854ab004f6752731e169040e536be364e56ef3d5063c6695b98a6b8b8b78d3ed
7
+ data.tar.gz: 0704c9b4623410f6f83563c04d2497c0f35b3cf1bc68ae1e146d48f7ca8994848f3d58d34bcb70178efeee3bc0283b519d4aa0f664e812e879711bc830678802
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 2.2.1 (2022-02-22)
6
+
7
+ ### Library changes
8
+
9
+ * Let `validate_type_alias` run without an error on unknown type ([\#912](https://github.com/ruby/rbs/pull/912))
10
+
5
11
  ## 2.2.0 (2022-02-22)
6
12
 
7
13
  RBS 2.2 ships with a new syntax to specify the visibility of a method per definition bases.
@@ -55,7 +55,7 @@ module RBS
55
55
  end
56
56
 
57
57
  def build_alias_type(name)
58
- entry = env.alias_decls[name] or raise "Unknown alias name: #{name}"
58
+ entry = env.alias_decls[name] or return
59
59
  unless entry.decl.type_params.empty?
60
60
  as = entry.decl.type_params.each.map {|param| Types::Variable.new(name: param.name, location: nil) }
61
61
  Types::Alias.new(name: name, args: as, location: nil)
@@ -85,9 +85,11 @@ module RBS
85
85
  end
86
86
  # @type var each_child: TSort::_EachChild[TypeName]
87
87
  each_child = __skip__ = -> (name, &block) do
88
- type = builder.expand_alias1(name)
89
- each_alias_type(type) do |ty|
90
- block[ty.name]
88
+ if env.alias_decls.key?(name)
89
+ type = builder.expand_alias1(name)
90
+ each_alias_type(type) do |ty|
91
+ block[ty.name]
92
+ end
91
93
  end
92
94
  end
93
95
 
data/lib/rbs/validator.rb CHANGED
@@ -89,6 +89,10 @@ module RBS
89
89
  location: entry.decl.location&.aref(:type_params)
90
90
  )
91
91
  end
92
+
93
+ if block_given?
94
+ yield entry.decl.type
95
+ end
92
96
  end
93
97
 
94
98
  def validate_method_definition(method_def, type_name:)
data/lib/rbs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RBS
2
- VERSION = "2.2.0"
2
+ VERSION = "2.2.1"
3
3
  end
data/sig/validator.rbs CHANGED
@@ -23,7 +23,9 @@ module RBS
23
23
  # - The generics type parameter variance annotation is consistent with respect to their usage
24
24
  # - There is no circular dependencies between the generics type parameter bounds
25
25
  #
26
- def validate_type_alias: (entry: Environment::SingleEntry[TypeName, AST::Declarations::Alias]) -> void
26
+ # It yields the rhs type if block is given, so that you can validate the rhs type.
27
+ #
28
+ def validate_type_alias: (entry: Environment::SingleEntry[TypeName, AST::Declarations::Alias]) ?{ (Types::t rhs_type) -> void } -> void
27
29
 
28
30
  # Validates the type parameters in generic methods.
29
31
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto