diff options
author | Phil Ruffwind <rf@rufflewind.com> | 2017-03-13 15:17:47 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-03-13 15:17:47 -0400 |
commit | c77b767098be53087e0b06ba23d613dd7c3bcf8e (patch) | |
tree | 164e70adf6123e7e8d17331483ad5eccd10478e5 | |
parent | ae0ccf8c16f5ed394ab01a1863abd98a7a44ab60 (diff) | |
download | haskell-c77b767098be53087e0b06ba23d613dd7c3bcf8e.tar.gz |
unlit: replace the SHEBANG with an empty line
This corrects the line numbers for literate code after a shebang.
Fixes #13414.
Test Plan: validate
Reviewers: austin, bgamari, trofi
Reviewed By: bgamari, trofi
Subscribers: trofi, rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3333
-rw-r--r-- | testsuite/tests/parser/should_fail/T13414.lhs | 3 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/T13414.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/parser/should_fail/all.T | 1 | ||||
-rw-r--r-- | utils/unlit/unlit.c | 3 |
4 files changed, 9 insertions, 0 deletions
diff --git a/testsuite/tests/parser/should_fail/T13414.lhs b/testsuite/tests/parser/should_fail/T13414.lhs new file mode 100644 index 0000000000..fe6b960d87 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T13414.lhs @@ -0,0 +1,3 @@ +#!/usr/bin/env runhaskell +> module T13414 where +> main = invalid_ident_ diff --git a/testsuite/tests/parser/should_fail/T13414.stderr b/testsuite/tests/parser/should_fail/T13414.stderr new file mode 100644 index 0000000000..f5b0001ef1 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T13414.stderr @@ -0,0 +1,2 @@ + +T13414.lhs:3:10: error: Variable not in scope: invalid_ident_ diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T index 1496feca4a..b897484c6e 100644 --- a/testsuite/tests/parser/should_fail/all.T +++ b/testsuite/tests/parser/should_fail/all.T @@ -97,3 +97,4 @@ test('T12051', normal, compile_fail, ['']) test('T12429', normal, compile_fail, ['']) test('T12811', normal, compile_fail, ['']) test('T13260', normal, compile_fail, ['']) +test('T13414', literate, compile_fail, ['']) diff --git a/utils/unlit/unlit.c b/utils/unlit/unlit.c index c0e3b983ea..9a697eba95 100644 --- a/utils/unlit/unlit.c +++ b/utils/unlit/unlit.c @@ -296,6 +296,9 @@ static void unlit(char *file, FILE *istream, FILE *ostream) } } #endif + if (this == SHEBANG) { + myputc('\n', ostream); + } } while(this!=ENDFILE); if (defnsread==0) |