>From 67e4305b1f6011e2991ab4b5512ce158ae824e02 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Sat, 7 Jul 2012 11:40:23 +0200 Subject: [PATCH] Resolve user-defined scrutiny types at canonicalization time, before with-property-restore in each module's expansion is compiled away and ##compiler#type-abbreviation properties are restored. Fixes #884. --- compiler.scm | 2 +- tests/scrutiny-tests.scm | 8 ++++++++ tests/scrutiny.expected | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/compiler.scm b/compiler.scm index 94d178d..68061e0 100644 --- a/compiler.scm +++ b/compiler.scm @@ -538,7 +538,7 @@ ((##core#the) `(##core#the - ,(##sys#strip-syntax (cadr x)) + ,(validate-type (##sys#strip-syntax (cadr x)) #f) ,(caddr x) ,(walk (cadddr x) e se dest ldest h ln))) diff --git a/tests/scrutiny-tests.scm b/tests/scrutiny-tests.scm index 5f0f56a..abe01f7 100644 --- a/tests/scrutiny-tests.scm +++ b/tests/scrutiny-tests.scm @@ -134,3 +134,11 @@ (import chicken scheme) (define (blabla) (+ 1 'x))) + +;; Reported by megane in #884: +;; +;; Custom types defined in modules need to be resolved during canonicalization +(module bar () + (import chicken scheme) + (define-type footype string) + (the footype "bar")) \ No newline at end of file diff --git a/tests/scrutiny.expected b/tests/scrutiny.expected index 609757c..a79e854 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 (a132) (procedure car ((pair a132 *)) a132))' + assignment of value of type `fixnum' to toplevel variable `car' does not match declared type `(forall (a140) (procedure car ((pair a140 *)) a140))' Warning: at toplevel: expected in `let' binding of `g8' a single result, but were given 2 results -- 1.7.9.1