parlour 7.0.0 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +6 -2
- data/CHANGELOG.md +15 -0
- data/exe/parlour +1 -1
- data/lib/parlour/mixin/searchable.rb +1 -1
- data/lib/parlour/type_parser.rb +18 -3
- data/lib/parlour/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3849a9995ec5ce41eeee0c180ac14d76d6e5ee2c7c7f9ecd61760d4279fc887
|
4
|
+
data.tar.gz: bd5ee90c62e2c55eebd233fec2bff3a0974e24204d79cecc627bce48e413dd64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2de0e9b4aa6cd1c52a55453b7bf03da1247815a090de02ae0b105057c16e1aad0ed1ddf32d20dffc0727510321fb69b902b07a7e0bd03f268cb7331c0449b8cc
|
7
|
+
data.tar.gz: af13b87ff52638b9cefb29356dd7dec277667ef36ff656b4ced99c348cb9252828345c3de7f20d443594a7c09757ecd273e33d704df00109e5e4d2eafd5d3b0d
|
data/.github/workflows/ruby.yml
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
name: Run tests
|
2
2
|
|
3
|
-
on:
|
3
|
+
on:
|
4
|
+
push: {}
|
5
|
+
pull_request: {}
|
6
|
+
schedule:
|
7
|
+
- cron: "18 18 * * *"
|
4
8
|
|
5
9
|
jobs:
|
6
10
|
test:
|
7
11
|
strategy:
|
8
12
|
matrix:
|
9
|
-
ruby: [2.4, 2.5, 2.6, 2.7, 3.0]
|
13
|
+
ruby: [2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2]
|
10
14
|
continue-on-error: false
|
11
15
|
|
12
16
|
runs-on: ubuntu-latest
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,21 @@ 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
|
+
## [8.1.0] - 2023-01-01
|
7
|
+
### Added
|
8
|
+
- Parsed method definitions can now have a modifier before the `def` keyword.
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
- Use `File#exist?` instead of `File#exists?` in CLI, fixing an exception on
|
12
|
+
Ruby 3.2.0.
|
13
|
+
- Resolved incorrect code generation for `T::Enum`s with only one variant.
|
14
|
+
|
15
|
+
## [8.0.0] - 2022-05-10
|
16
|
+
### Changed
|
17
|
+
- The parser now loads untyped methods named `initialize` as returning `void`, rather than
|
18
|
+
`untyped`. Potentially breaking if you are relying on this behaviour, though Sorbet now considers
|
19
|
+
this an error.
|
20
|
+
|
6
21
|
## [7.0.0] - 2022-04-18
|
7
22
|
### Added
|
8
23
|
- `#describe` now uses a new, clearer format.
|
data/exe/parlour
CHANGED
@@ -18,7 +18,7 @@ command :run do |c|
|
|
18
18
|
working_dir = Dir.pwd
|
19
19
|
config_filename = File.join(working_dir, '.parlour')
|
20
20
|
|
21
|
-
if File.
|
21
|
+
if File.exist?(config_filename)
|
22
22
|
configuration = keys_to_symbols(YAML.load_file(config_filename))
|
23
23
|
else
|
24
24
|
configuration = {}
|
data/lib/parlour/type_parser.rb
CHANGED
@@ -245,7 +245,16 @@ module Parlour
|
|
245
245
|
(body.type == :begin ? body.to_a : [body]).find { |x| x.type == :block && x.to_a[0].type == :send && x.to_a[0].to_a[1] == :enums }
|
246
246
|
|
247
247
|
# Find the constant assigments within this block
|
248
|
-
|
248
|
+
# (If there's only one constant assignment, then that `casgn` node
|
249
|
+
# will be a direct child, not wrapped in a body)
|
250
|
+
enum_inner = enums_node.to_a[2]
|
251
|
+
if enum_inner.nil?
|
252
|
+
constant_nodes = []
|
253
|
+
elsif enum_inner.type == :begin
|
254
|
+
constant_nodes = enum_inner.to_a
|
255
|
+
else
|
256
|
+
constant_nodes = [enum_inner]
|
257
|
+
end
|
249
258
|
|
250
259
|
# Convert this to an array to enums as EnumClassNamespace expects
|
251
260
|
enums = constant_nodes.map do |constant_node|
|
@@ -490,6 +499,10 @@ module Parlour
|
|
490
499
|
# A :def node represents a definition like "def x; end"
|
491
500
|
# A :defs node represents a definition like "def self.x; end"
|
492
501
|
def_node = path.sibling(1).traverse(ast)
|
502
|
+
if def_node.type == :send && [:def, :defs].include?(def_node.children.last.type)
|
503
|
+
# bypass inline modifier (e.g. "private")
|
504
|
+
def_node = def_node.children.last
|
505
|
+
end
|
493
506
|
case def_node.type
|
494
507
|
when :def
|
495
508
|
class_method = false
|
@@ -672,7 +685,9 @@ module Parlour
|
|
672
685
|
class_method = true
|
673
686
|
end
|
674
687
|
|
675
|
-
return_type = "
|
688
|
+
return_type = unless def_names == ["initialize"]
|
689
|
+
"T.untyped"
|
690
|
+
end
|
676
691
|
|
677
692
|
if kind == :def
|
678
693
|
parameters = def_params.map do |def_param|
|
@@ -704,7 +719,7 @@ module Parlour
|
|
704
719
|
elsif kind == :attr
|
705
720
|
case attr_direction
|
706
721
|
when :reader, :accessor, :writer
|
707
|
-
attr_type = return_type
|
722
|
+
attr_type = return_type || "T.untyped"
|
708
723
|
else
|
709
724
|
raise "unknown attribute direction #{attr_direction}"
|
710
725
|
end
|
data/lib/parlour/version.rb
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:
|
4
|
+
version: 8.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Christiansen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sorbet-runtime
|
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
243
|
- !ruby/object:Gem::Version
|
244
244
|
version: '0'
|
245
245
|
requirements: []
|
246
|
-
rubygems_version: 3.
|
246
|
+
rubygems_version: 3.4.1
|
247
247
|
signing_key:
|
248
248
|
specification_version: 4
|
249
249
|
summary: A type information generator, merger and parser for Sorbet and Ruby 3/Steep
|