Skip to content

Fix -Wall in retrie plugin#4071

Merged
fendor merged 2 commits into
haskell:masterfrom
jhrcek:jhrcek/fix-Wall-retrie
Feb 14, 2024
Merged

Fix -Wall in retrie plugin#4071
fendor merged 2 commits into
haskell:masterfrom
jhrcek:jhrcek/fix-Wall-retrie

Conversation

@jhrcek

@jhrcek jhrcek commented Feb 13, 2024

Copy link
Copy Markdown
Collaborator

No description provided.

@jhrcek
jhrcek requested a review from pepeiborra as a code owner February 13, 2024 06:49
-- Run retrie to get a list of changes
-- Select the change that inlines the identifier in the given position
-- Apply the edit
ast <- runActionE "retrie" state $

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these bindings were unused. Not sure if they can be removed (if something is relying on the side effects of these?) or not, but the tests are passing so.. 🤷‍♂️

@soulomoon soulomoon Feb 14, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think they are necessary.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the tests are passing, let's remove them for now and wait for bug reports :)

case rn of
(HsGroup{hs_valds, hs_ruleds, hs_tyclds}, _, _, _) -> do
topLevelBinds <- case hs_valds of
ValBinds{} -> throwError $ PluginInternalError "getBinds: ValBinds not supported"

@jhrcek jhrcek Feb 13, 2024

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above was giving warning:

    Pattern match(es) are non-exhaustive
    In a pattern binding:
        Patterns of type ‘GHCGHC.RenamedSource’ not matched:
            ((HsGroup _ (ValBinds _ _ _) _ _ _ _ _ _ _ _ _ _), _, _, _)

Throwing error for the unhandled case seems far from ideal but I still consider it step forward (better visibility into where the error is coming from compared to "anonymous" pattern match failure).

@jhrcek
jhrcek marked this pull request as draft February 13, 2024 06:58
runRetrieCmd state token RunRetrieParams{originatingFile = uri, ..} = ExceptT $
withIndefiniteProgress description token Cancellable $ \_updater -> do
runExceptT $ do
_ <- runExceptT $ do

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely suspicious: wouldn't we want to send the failure to client instead of ignoring it?

@soulomoon soulomoon Feb 13, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, or we can atleast log the error?

@jhrcek jhrcek Feb 14, 2024

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought it's actually sending some errors notifications to the client within the ExceptT block if errors occur, so this is probably ok.

@jhrcek
jhrcek marked this pull request as ready for review February 13, 2024 08:20
@soulomoon
soulomoon self-requested a review February 14, 2024 13:49

@soulomoon soulomoon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fendor fendor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@fendor
fendor merged commit 7b6986b into haskell:master Feb 14, 2024
@jhrcek
jhrcek deleted the jhrcek/fix-Wall-retrie branch February 22, 2024 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants