Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I just ran into a similar issue based on this signature recognition bug: if you have a method with
(::Any)
signature and another one with type parameters, you cannot selectively print the one with type parameters only in the documentation, as the generic one will always be found.Regarding your analysis, I would propose a change that still allows to differentiate parametric constructors. For this, I add the parameters of the constructor as a unique type to the front of the method signature.
Here, I also preserve the behavior that you need not specify the
where
part for constructors, but I completely agree with your analysis that in this way, it is impossible to make the distinction between existing types and parametric types (which cannot be done well during macro deconstruction). This is also an issue in the code currently in Base; any type parameter will always be seen as parametric. For this reason, I'd rather see this whole behavior disappear; in the end, you cannot write Julia code like this. Removing theif isempty
would prevent this. A kind of middle ground would be to allow the current behavior, but only if the type is constrained (because this would not be possible for existing types).