Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orphan instances detection in haskell-process-trigger-suggestions is outdated #1110

Open
geraldus opened this issue Jan 25, 2016 · 8 comments
Assignees

Comments

@geraldus
Copy link
Contributor

I can't be certain, but it looks like orphan instance warning have changed in recent versions of GHC. Currently haskell-process-trigger-suggestions function uses following regex to detect orphan instance warnings in compiler response "Warning: orphan instance: " [1], while GHC 7.10.3 gives a bit different formatting:

/Users/oman/dev/haskell/sol/solitaire/src/Solitaire.hs:12:10: Warning:
    Orphan instance: instance Show Layer
    To avoid this
        move the instance declaration to the module of the class or of the type, or
        wrap the type with a newtype and declare the instance on the new type.

As a result, haskell-process-trigger-suggestions does not suggest to add OPTIONS pragma as intended.

@gracjan I know we need tests for this function, it's quite big and good test suite should rely on genuine GHC response, what will you say?

@geraldus
Copy link
Contributor Author

TODO test other suggestions:

  • Use … to permit this (example file created)
  • Use … to allow (example file created)
  • Use … if you want to disable this (example file created)
  • use …
  • You need
  • against inferred type [Char] (can't find such string in GHC 8 sources)
  • with actual type [Char] (can't find such string in GHC 8 sources)
  • haskell-process-suggest-google-imports
  • haskell-process-suggest-haskell-docs-import
  • haskell-process-suggest-hayoo-imports
  • haskell-process-suggest-add-package

@geraldus
Copy link
Contributor Author

geraldus commented Feb 2, 2016

It looks like orphan instances warning was changed really long ago: ghc/ghc@5508ada#diff-e8ff0f7ff4e9411e2df0dba1dbd4bdd8L846

@gracjan
Copy link
Contributor

gracjan commented Feb 2, 2016

We should have a test file per each warning message. Then we should run each supported GHC version with each file producing a matrix of NxM messages.

And then we need to support all of that :)

@gracjan
Copy link
Contributor

gracjan commented Feb 2, 2016

@geraldus: Can you do first step, that is generate X.hs files, each generating one message of interest?

@geraldus
Copy link
Contributor Author

geraldus commented Feb 3, 2016

@gracjan Maybe at the of week, but no promises.

@geraldus
Copy link
Contributor Author

@gracjan I have created few files, but have no idea what to do with them :D

@gracjan
Copy link
Contributor

gracjan commented Feb 21, 2016

We need a test case. Can you put them in a directory under tests and then create a pull request? We will make something sensible with this.

@geraldus
Copy link
Contributor Author

Done #1168

@geraldus geraldus self-assigned this Mar 25, 2016
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

No branches or pull requests

2 participants