>From f8cc3b834447f57c2b67a4ba505090e056502b41 Mon Sep 17 00:00:00 2001
From: Peter Bex
Date: Sun, 6 May 2012 21:22:43 +0200
Subject: [PATCH] Ensure error messages carry their line numbers correctly
inside modules by preventing all syntax from being stripped
off of modules
---
compiler.scm | 3 +--
tests/scrutiny-tests.scm | 6 ++++++
tests/scrutiny.expected | 7 +++++--
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/compiler.scm b/compiler.scm
index 8f83feb..cdff872 100644
--- a/compiler.scm
+++ b/compiler.scm
@@ -810,8 +810,7 @@
(walk `(##core#begin ,@(cddr x)) e se dest ldest h ln))))
((##core#module)
- (let* ((x (##sys#strip-syntax x))
- (name (cadr x))
+ (let* ((name (cadr x))
(exports
(or (eq? #t (caddr x))
(map (lambda (exp)
diff --git a/tests/scrutiny-tests.scm b/tests/scrutiny-tests.scm
index 717ad7f..5f0f56a 100644
--- a/tests/scrutiny-tests.scm
+++ b/tests/scrutiny-tests.scm
@@ -128,3 +128,9 @@
(pair? del))
())
())
+
+;; Checking whether reported line numbers inside modules are correct
+(module foo (blabla)
+ (import chicken scheme)
+ (define (blabla)
+ (+ 1 'x)))
diff --git a/tests/scrutiny.expected b/tests/scrutiny.expected
index f4200af..609757c 100644
--- a/tests/scrutiny.expected
+++ b/tests/scrutiny.expected
@@ -37,7 +37,7 @@ Warning: at toplevel:
(scrutiny-tests.scm:28) in procedure call to `+', expected argument #2 of type `number', but was given an argument of type `symbol'
Warning: at toplevel:
- assignment of value of type `fixnum' to toplevel variable `car' does not match declared type `(forall (a124) (procedure car ((pair a124 *)) a124))'
+ assignment of value of type `fixnum' to toplevel variable `car' does not match declared type `(forall (a132) (procedure car ((pair a132 *)) a132))'
Warning: at toplevel:
expected in `let' binding of `g8' a single result, but were given 2 results
@@ -93,4 +93,7 @@ Warning: in toplevel procedure `foo10':
Warning: in toplevel procedure `foo10':
(scrutiny-tests.scm:111) in procedure call to `*', expected argument #1 of type `number', but was given an argument of type `string'
-Warning: redefinition of standard binding: car
+Warning: in toplevel procedure `foo#blabla':
+ (scrutiny-tests.scm:136) in procedure call to `+', expected argument #2 of type `number', but was given an argument of type `symbol'
+
+Warning: redefinition of standard binding: car
\ No newline at end of file
--
1.7.9.1