Loading a file under test-suite fails when importing library

Aperta
#1,837 2 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
emacs-lisp, haskell
Ambito
tooling

Direzione di ricerca

Inizia con il percorso di caricamento C-c C-l e riproduci il problema con test/Main.hs e l’importazione di QuickCheck; segui come la diagnostica del pacchetto nascosto diventa un suggerimento di dipendenza. Il lavoro è completato quando il contesto della test-suite viene gestito senza la richiesta falsa, oppure quando un avviso esplicito relativo a una funzionalità non supportata sopprime i suggerimenti di modifica, e il riproduttore fornito non rimane più bloccato in attesa di una risposta.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

When I load a file from a test-suite, I am getting suggestions to add dependencies to the cabal file that are already listed as dependencies in the test-suite.

Reproducer:

mkdir foo
cd foo
cabal init -n --lib --tests

We now add dependency QuickCheck to the testsuite.

echo "        , QuickCheck" >> *.cabal

In Emacs,

  • load test/Main.hs
  • add line import Test.QuickCheck
  • load the file into the haskell-mode with C-c C-l

This will suggest "Add QuickCheck to foo.cabal? (y or n)" and block until an answer is given. (Of course, we do not want to add anything to our cabal file because it is perfectly ok.)
The suggestion seems to be harvested from the error:

  Could not load module ‘Test.QuickCheck’.
    It is a member of the hidden package ‘QuickCheck-2.14.3’.
    Perhaps you need to add ‘QuickCheck’ to the build-depends in your .cabal file.

haskell-mode seems to load the file in the wrong context.

  1. I suspect loading files from test-suites is not supported yet. It would be good if the haskell-mode would warn about the missing feature (and then not making any suggestions on code modification) rather than blindly doing wrong things.
  2. The helpful suggestions by haskell-mode are well-meant, but rather disruptive when they are just garbage, which seems to happen in different scenarios (cf. #1834).

Note: there is a previous instance of this issue that the author closed, but there is no evidence it was fixed:

  • #1535
Lingua principale
Emacs Lisp
Stelle
1.4k
Fork
357
Merge medio
7h 50m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di haskell/haskell-mode

Tutte le issue di haskell/haskell-mode

Issue simili

Altre issue su DevTools

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.