parlour 5.0.0.beta.3 → 5.0.0.beta.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/parlour/conversion/rbi_to_rbs.rb +6 -0
- data/lib/parlour/rbi_generator/type_alias.rb +1 -1
- data/lib/parlour/type_parser.rb +22 -5
- data/lib/parlour/types.rb +6 -6
- data/lib/parlour/version.rb +1 -1
- data/rbi/parlour.rbi +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28a746eeb5c6322d0dfbfc53336bde66a65a35462f8e7685098aadd8720d3ade
|
4
|
+
data.tar.gz: 5cd5e9fe8cd248e1b7685134b3116f04c28e481d30ed6ac01b77b6f82aa7236b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51d1cdde17b3d84ae927343e7627efc2ef832440907b8f3ae40ec3cf20edcd20a8f7f76f3991933251a7542ccc7b6ac1269a98a268603e34eaaf043322e05625
|
7
|
+
data.tar.gz: d84ae4f6260e82de62dafdc67a7715c9cd74f01a68bbce8f5e89d0aa1f00509bd4a5230ec0fa7c850898f57936e29aee07c8f607935dbc1c784f4212ff709246
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
5
5
|
|
6
|
+
## [5.0.0.beta.4] - 2020-09-22
|
7
|
+
### Added
|
8
|
+
- Added support for parsing type aliases from RBI
|
9
|
+
- Added conversion from RBI to RBS type aliases
|
10
|
+
|
6
11
|
## [5.0.0.beta.3] - 2020-09-15
|
7
12
|
### Changed
|
8
13
|
- Changed the RBS keyword warning to come from "RBS generation" rather than
|
@@ -121,6 +121,12 @@ module Parlour
|
|
121
121
|
type: node.value,
|
122
122
|
).add_comments(node.comments)
|
123
123
|
|
124
|
+
when RbiGenerator::TypeAlias
|
125
|
+
new_parent.create_type_alias(
|
126
|
+
node.name,
|
127
|
+
type: node.type,
|
128
|
+
).add_comments(node.comments)
|
129
|
+
|
124
130
|
when RbiGenerator::Extend
|
125
131
|
new_parent.create_extend(node.name).add_comments(node.comments)
|
126
132
|
|
data/lib/parlour/type_parser.rb
CHANGED
@@ -345,11 +345,28 @@ module Parlour
|
|
345
345
|
end.flatten
|
346
346
|
when :casgn
|
347
347
|
_, name, body = *node
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
348
|
+
|
349
|
+
# Determine whether this is a constant or a type alias
|
350
|
+
# A type alias looks like:
|
351
|
+
# (block (send (const nil :T) :type_alias) (args) (type_to_alias))
|
352
|
+
if body.type == :block &&
|
353
|
+
body.to_a[0].type == :send &&
|
354
|
+
body.to_a[0].to_a[0].type == :const &&
|
355
|
+
body.to_a[0].to_a[0].to_a == [nil, :T] &&
|
356
|
+
body.to_a[0].to_a[1] == :type_alias
|
357
|
+
|
358
|
+
[Parlour::RbiGenerator::TypeAlias.new(
|
359
|
+
generator,
|
360
|
+
name: T.must(name).to_s,
|
361
|
+
type: T.must(node_to_s(body.to_a[2])),
|
362
|
+
)]
|
363
|
+
else
|
364
|
+
[Parlour::RbiGenerator::Constant.new(
|
365
|
+
generator,
|
366
|
+
name: T.must(name).to_s,
|
367
|
+
value: T.must(node_to_s(body)),
|
368
|
+
)]
|
369
|
+
end
|
353
370
|
else
|
354
371
|
if unknown_node_errors
|
355
372
|
parse_err "don't understand node type #{node.type}", node
|
data/lib/parlour/types.rb
CHANGED
@@ -230,7 +230,7 @@ module Parlour
|
|
230
230
|
class Array < SingleElementCollection
|
231
231
|
sig { override.returns(String) }
|
232
232
|
def collection_name
|
233
|
-
'Array'
|
233
|
+
'::Array'
|
234
234
|
end
|
235
235
|
|
236
236
|
sig { params(other: Object).returns(T::Boolean) }
|
@@ -243,7 +243,7 @@ module Parlour
|
|
243
243
|
class Set < SingleElementCollection
|
244
244
|
sig { override.returns(String) }
|
245
245
|
def collection_name
|
246
|
-
'Set'
|
246
|
+
'::Set'
|
247
247
|
end
|
248
248
|
|
249
249
|
sig { params(other: Object).returns(T::Boolean) }
|
@@ -256,7 +256,7 @@ module Parlour
|
|
256
256
|
class Range < SingleElementCollection
|
257
257
|
sig { override.returns(String) }
|
258
258
|
def collection_name
|
259
|
-
'Range'
|
259
|
+
'::Range'
|
260
260
|
end
|
261
261
|
|
262
262
|
sig { params(other: Object).returns(T::Boolean) }
|
@@ -269,7 +269,7 @@ module Parlour
|
|
269
269
|
class Enumerable < SingleElementCollection
|
270
270
|
sig { override.returns(String) }
|
271
271
|
def collection_name
|
272
|
-
'Enumerable'
|
272
|
+
'::Enumerable'
|
273
273
|
end
|
274
274
|
|
275
275
|
sig { params(other: Object).returns(T::Boolean) }
|
@@ -282,7 +282,7 @@ module Parlour
|
|
282
282
|
class Enumerator < SingleElementCollection
|
283
283
|
sig { override.returns(String) }
|
284
284
|
def collection_name
|
285
|
-
'Enumerator'
|
285
|
+
'::Enumerator'
|
286
286
|
end
|
287
287
|
|
288
288
|
sig { params(other: Object).returns(T::Boolean) }
|
@@ -317,7 +317,7 @@ module Parlour
|
|
317
317
|
|
318
318
|
sig { override.returns(String) }
|
319
319
|
def generate_rbs
|
320
|
-
"Hash[#{key.generate_rbs}, #{value.generate_rbs}]"
|
320
|
+
"::Hash[#{key.generate_rbs}, #{value.generate_rbs}]"
|
321
321
|
end
|
322
322
|
|
323
323
|
sig { override.returns(String) }
|
data/lib/parlour/version.rb
CHANGED
data/rbi/parlour.rbi
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parlour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.0.beta.
|
4
|
+
version: 5.0.0.beta.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Christiansen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sorbet-runtime
|