Fix regression with making class bodies
:ac should add a class body when given a class name, but a previous
change stopped this working. Test added to prevent similar accidents in
future.
commit6011227566bc38cf48c75b7d4a7f62ce874cc6d2
authorEdwin Brady <ecb10@st-andrews.ac.uk>
dateSat 14 Nov 2015, 17:41 (11 years ago)
parent70b6c86
idris.cabal+4
@@ -541,6 +541,10 @@ Extra-source-files:
541541 test/interactive010/expected
542542 test/interactive010/input
543543 test/interactive010/run
544+ test/interactive011/expected
545+ test/interactive011/input
546+ test/interactive011/run
547+ test/interactive011/*.idr
544548
545549 test/io001/run
546550 test/io001/*.idr
src/Idris/CaseSplit.hs+1−1
@@ -362,7 +362,7 @@ getClause :: Int -- ^ line number that the type is declared on
362362 -> Idris String
363363getClause l fn un fp
364364 = do i <- getIState
365− case lookupCtxt fn (idris_classes i) of
365+ case lookupCtxt un (idris_classes i) of
366366 [c] -> return (mkClassBodies i (class_methods c))
367367 _ -> do ty_in <- getInternalApp fp l
368368 let ty = case ty_in of
test/interactive011/expectednew file+3
@@ -0,0 +1,3 @@
1+ show x = ?Show_rhs_1
2+ showPrec d x = ?Show_rhs_2
3+append [] _ = ?append_rhs_1
test/interactive011/inputnew file+2
@@ -0,0 +1,2 @@
1+:ac 5 Show
2+:ac 7 append
test/interactive011/interactive011.idrnew file+11
@@ -0,0 +1,11 @@
1+import Data.Vect
2+
3+data Foo = Bar | Baz
4+
5+instance Show Foo where
6+
7+append : Vect n a -> Vect m a -> Vect (n + m) a
8+append (x :: xs) ys = ?append_rhs_2
9+
10+
11+
test/interactive011/runnew file+3
@@ -0,0 +1,3 @@
1+#!/usr/bin/env bash
2+idris --quiet interactive011.idr < input
3+rm -f *.ibc