parlour 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug-report.md +0 -0
  3. data/.github/ISSUE_TEMPLATE/feature-request.md +0 -0
  4. data/.gitignore +1 -1
  5. data/.parlour +0 -0
  6. data/.rspec +0 -0
  7. data/.travis.yml +0 -0
  8. data/CHANGELOG.md +5 -0
  9. data/CODE_OF_CONDUCT.md +0 -0
  10. data/Gemfile +0 -0
  11. data/LICENSE.txt +0 -0
  12. data/README.md +0 -0
  13. data/Rakefile +0 -0
  14. data/lib/parlour.rb +0 -0
  15. data/lib/parlour/conflict_resolver.rb +31 -9
  16. data/lib/parlour/debugging.rb +0 -0
  17. data/lib/parlour/detached_rbi_generator.rb +0 -0
  18. data/lib/parlour/kernel_hack.rb +0 -0
  19. data/lib/parlour/parse_error.rb +0 -0
  20. data/lib/parlour/plugin.rb +0 -0
  21. data/lib/parlour/rbi_generator.rb +0 -0
  22. data/lib/parlour/rbi_generator/arbitrary.rb +0 -0
  23. data/lib/parlour/rbi_generator/attribute.rb +0 -0
  24. data/lib/parlour/rbi_generator/class_namespace.rb +0 -0
  25. data/lib/parlour/rbi_generator/constant.rb +0 -0
  26. data/lib/parlour/rbi_generator/enum_class_namespace.rb +0 -0
  27. data/lib/parlour/rbi_generator/extend.rb +0 -0
  28. data/lib/parlour/rbi_generator/include.rb +0 -0
  29. data/lib/parlour/rbi_generator/method.rb +0 -0
  30. data/lib/parlour/rbi_generator/module_namespace.rb +0 -0
  31. data/lib/parlour/rbi_generator/namespace.rb +0 -0
  32. data/lib/parlour/rbi_generator/options.rb +0 -0
  33. data/lib/parlour/rbi_generator/parameter.rb +0 -0
  34. data/lib/parlour/rbi_generator/rbi_object.rb +0 -0
  35. data/lib/parlour/rbi_generator/struct_class_namespace.rb +0 -0
  36. data/lib/parlour/rbi_generator/struct_prop.rb +0 -0
  37. data/lib/parlour/type_loader.rb +0 -0
  38. data/lib/parlour/type_parser.rb +0 -0
  39. data/lib/parlour/version.rb +1 -1
  40. data/parlour.gemspec +0 -0
  41. data/plugin_examples/foobar_plugin.rb +0 -0
  42. data/rbi/parlour.rbi +1 -1
  43. metadata +7 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f37a6dd2dffd0b59594b4c0ed664cdd27c4ea5bb02d1ca0f944ddff2d6ccda83
4
- data.tar.gz: 38b776b79c349f48e672fbb81534d4ab1b751af13ecdab9e60d3f08562f03332
3
+ metadata.gz: 707934b89fd83fbb876582bd7e66679bc2f8cf2179961eed62358ba6266bf524
4
+ data.tar.gz: 3d0a0c8be95e09275a9b02232ce9b9b062a9f00eb3216a0e74ce63a036025d76
5
5
  SHA512:
6
- metadata.gz: 8da56118b8e784707a054ae7dbdddda63dade826ec19d87a06f468229e8e53ef1669f7b05c4c5be6cc9e75377846e729748b0f31d3400768041079050fb72776
7
- data.tar.gz: c7a39a7a91aee7298fbdf3e5d7ebdebc278001317cb365bc7f3970d62fa49c2d9e3f5d7e1eb4c70a386ef0964f14bde2647871ab8c0b6a3a5adad8c774bc08f5
6
+ metadata.gz: ae723cbe6bebbba12ee3d802b223fa91fcda085f6b1fce4ec107efa3f9e3cc5df53ee0269a6e9d1391ff32c903d15b72153c67fae61392b7e5495688b69b7b0a
7
+ data.tar.gz: 98626719eb9d2c08f7e87c1ae48933d8b1afb9badab000bb408a8df26c57716846b71278654193c821ce59a552c83456d1f61523ce5bd9ff0e52d296ab34e274
File without changes
File without changes
data/.gitignore CHANGED
@@ -8,7 +8,7 @@
8
8
  /tmp/
9
9
  Gemfile.lock
10
10
  /.vscode
11
- /sorbte/rbi/hidden-definitions/errors.txt
11
+ /sorbet/rbi/hidden-definitions/errors.txt
12
12
 
13
13
  # rspec failure tracking
14
14
  .rspec_status
data/.parlour CHANGED
File without changes
data/.rspec CHANGED
File without changes
File without changes
@@ -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
+ ## [4.0.1] - 2020-08-05
7
+ ### Fixed
8
+ - Fixed duplicate includes and extends.
9
+ - Fixed the block return type for `#resolve_conflicts` not being nilable.
10
+
6
11
  ## [4.0.0] - 2020-05-23
7
12
  ### Added
8
13
  - Parlour now defaults to loading the current project when running its command
File without changes
data/Gemfile CHANGED
File without changes
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
File without changes
@@ -13,7 +13,7 @@ module Parlour
13
13
  resolver: T.proc.params(
14
14
  desc: String,
15
15
  choices: T::Array[RbiGenerator::RbiObject]
16
- ).returns(RbiGenerator::RbiObject)
16
+ ).returns(T.nilable(RbiGenerator::RbiObject))
17
17
  ).void
18
18
  end
19
19
  # Given a namespace, attempts to automatically resolve conflicts in the
@@ -23,13 +23,13 @@ module Parlour
23
23
  # All children of the given namespace which are also namespaces are
24
24
  # processed recursively, so passing {RbiGenerator#root} will eliminate all
25
25
  # conflicts in the entire object tree.
26
- #
26
+ #
27
27
  # If automatic resolution is not possible, the block passed to this method
28
28
  # is invoked and passed two arguments: a message on what the conflict is,
29
29
  # and an array of candidate objects. The block should return one of these
30
30
  # candidate objects, which will be kept, and all other definitions are
31
31
  # deleted. Alternatively, the block may return nil, which will delete all
32
- # definitions. The block may be invoked many times from one call to
32
+ # definitions. The block may be invoked many times from one call to
33
33
  # {resolve_conflicts}, one for each unresolvable conflict.
34
34
  #
35
35
  # @param namespace [RbiGenerator::Namespace] The starting namespace to
@@ -52,14 +52,14 @@ module Parlour
52
52
  child.name
53
53
  end
54
54
  end
55
-
55
+
56
56
  grouped_by_name_children.each do |name, children|
57
57
  Debugging.debug_puts(self, Debugging::Tree.begin("Checking children named #{name}..."))
58
58
 
59
59
  if children.length > 1
60
60
  Debugging.debug_puts(self, Debugging::Tree.here("Possible conflict between #{children.length} objects"))
61
61
 
62
- # Special case: do we have two methods, one of which is a class method
62
+ # Special case: do we have two methods, one of which is a class method
63
63
  # and the other isn't? If so, do nothing - this is fine
64
64
  if children.length == 2 &&
65
65
  children.all? { |c| c.is_a?(RbiGenerator::Method) } &&
@@ -78,12 +78,13 @@ module Parlour
78
78
  c.is_a?(RbiGenerator::Include) || c.is_a?(RbiGenerator::Extend)
79
79
  end
80
80
  end
81
-
81
+ deduplicate_mixins_of_name(namespace, name)
82
+
82
83
  Debugging.debug_puts(self, Debugging::Tree.end("Includes/extends do not conflict with namespaces; no resolution required"))
83
84
  next
84
85
  end
85
86
 
86
- # Special case: do we have two attributes, one of which is a class
87
+ # Special case: do we have two attributes, one of which is a class
87
88
  # attribute and the other isn't? If so, do nothing - this is fine
88
89
  if children.length == 2 &&
89
90
  children.all? { |c| c.is_a?(RbiGenerator::Attribute) } &&
@@ -93,13 +94,13 @@ module Parlour
93
94
  next
94
95
  end
95
96
 
96
- # Special case: are they all clearly equal? If so, remove all but one
97
+ # Optimization for Special case: are they all clearly equal? If so, remove all but one
97
98
  if all_eql?(children)
98
99
  Debugging.debug_puts(self, Debugging::Tree.end("All children are identical"))
99
100
 
100
101
  # All of the children are the same, so this deletes all of them
101
102
  namespace.children.delete(T.must(children.first))
102
-
103
+
103
104
  # Re-add one child
104
105
  namespace.children << T.must(children.first)
105
106
  next
@@ -239,5 +240,26 @@ module Parlour
239
240
  def all_eql?(arr)
240
241
  arr.each_cons(2).all? { |x, y| x == y }
241
242
  end
243
+
244
+ sig { params(namespace: RbiGenerator::Namespace, name: T.nilable(String)).void }
245
+ # Given a namespace and a child name, removes all duplicate children that are mixins
246
+ # and that have the given name, except the first found instance.
247
+ #
248
+ # @param namespace [RbiGenerator::Namespace] The namespace to deduplicate mixins in.
249
+ # @param name [String] The name of the mixin modules to deduplicate.
250
+ # @return [void]
251
+ def deduplicate_mixins_of_name(namespace, name)
252
+ found_map = {}
253
+ namespace.children.delete_if do |x|
254
+ # ignore children whose names don't match
255
+ next unless x.name == name
256
+ # ignore children that are not mixins
257
+ next unless x.is_a?(RbiGenerator::Include) || x.is_a?(RbiGenerator::Extend)
258
+
259
+ delete = found_map.key?(x.class)
260
+ found_map[x.class] = true
261
+ delete
262
+ end
263
+ end
242
264
  end
243
265
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  # typed: strong
2
2
  module Parlour
3
3
  # The library version.
4
- VERSION = '4.0.0'
4
+ VERSION = '4.0.1'
5
5
  end
File without changes
File without changes
@@ -11,7 +11,7 @@ module Parlour
11
11
  sig { params(namespace: RbiGenerator::Namespace, resolver: T.proc.params(
12
12
  desc: String,
13
13
  choices: T::Array[RbiGenerator::RbiObject]
14
- ).returns(RbiGenerator::RbiObject)).void }
14
+ ).returns(T.nilable(RbiGenerator::RbiObject))).void }
15
15
  def resolve_conflicts(namespace, &resolver); end
16
16
 
17
17
  sig { params(arr: T::Array[T.untyped]).returns(T.nilable(Symbol)) }
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.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Christiansen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-23 00:00:00.000000000 Z
11
+ date: 2020-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime
@@ -136,7 +136,7 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
- description:
139
+ description:
140
140
  email:
141
141
  - hello@aaronc.cc
142
142
  executables:
@@ -190,7 +190,7 @@ homepage: https://github.com/AaronC81/parlour
190
190
  licenses:
191
191
  - MIT
192
192
  metadata: {}
193
- post_install_message:
193
+ post_install_message:
194
194
  rdoc_options: []
195
195
  require_paths:
196
196
  - lib
@@ -205,8 +205,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  - !ruby/object:Gem::Version
206
206
  version: '0'
207
207
  requirements: []
208
- rubygems_version: 3.0.3
209
- signing_key:
208
+ rubygems_version: 3.1.2
209
+ signing_key:
210
210
  specification_version: 4
211
211
  summary: An RBI generator, merger and parser for Sorbet
212
212
  test_files: []