From: Mark Wooding Date: Sun, 30 Aug 2015 10:03:22 +0000 (+0100) Subject: src/module-impl.lisp: Don't emit `#line' to non-position-aware streams. X-Git-Tag: 0.2.0~48 X-Git-Url: https://git.distorted.org.uk/~mdw/sod/commitdiff_plain/d07588d4c069c5b62f7e5792ea173038d090e531?hp=59146e6e6846ce273a66f990c414e3f1a9c42da5 src/module-impl.lisp: Don't emit `#line' to non-position-aware streams. Because we can't switch back afterwards, the compiler will blame the wrong thing. Also, if the output stream isn't position-aware, it's probably because we're in the midst of pretty-printing something, and forcing `#line' directives will produce hideous results. This is all rather unfortunate. It's clearly a bug that we can't produce pretty output and have useful error location information, but I think this is the best I can manage right now. --- diff --git a/src/module-impl.lisp b/src/module-impl.lisp index 9e74b27..fe6b545 100644 --- a/src/module-impl.lisp +++ b/src/module-impl.lisp @@ -167,7 +167,8 @@ (line (file-location-line location)) (filename (file-location-filename location))) (cond (line - (format stream "~&#line ~D~@[ ~S~]~%" line filename) + (when (typep stream 'position-aware-stream) + (format stream "~&#line ~D~@[ ~S~]~%" line filename)) (funcall thunk) (when (typep stream 'position-aware-stream) (fresh-line stream)