Fix for multi-line use calls#335
Open
katafrakt wants to merge 6 commits into
Open
Conversation
Contributor
Author
|
@lukaszsamson do you think it's ok to merge? I would love to pull these new changes to Expert, but I think this fix is necessary for that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When I tried to plug #333 into Expert, I found it not working for some Ecto definitions. At first I thought this is due to transitive use of
use(likeuse AshPostgres.Repowhich callsuse Ecto.Repoinside its__using__), but ultimately I found this is because of multi-lineuses, like AshPostgres does:When we were calling
use_site?/3on the first line, it tried to doCode.string_to_quotedon a line ending with a comma, returning{:error, _}and not finding it as a use site. This PR replaces the check with a regex-based. I was trying to find some false positives it can generate, but I don't think there are some. The obvious one is about comments, but I don't think a line with a comment can be a param touse_site?currently.The commit history is a mess here of all my previous attempt, so it needs squashing.