Re: [Chicken-hackers] [PATCH] Fix arguments to scrutiny reporting procedure for `append'

2019-03-31 Thread Peter Bex
On Sun, Mar 31, 2019 at 03:38:30PM +1300, Evan Hanson wrote:
> WFM. Signoff attached.

Thanks!  I've pushed this now.

Cheers,
Peter


signature.asc
Description: PGP signature
___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] [PATCH] Fix arguments to scrutiny reporting procedure for `append'

2019-03-30 Thread Evan Hanson
WFM. Signoff attached.

Evan
>From 499a97da7830d3a9fba998c0e25821492e8c401e Mon Sep 17 00:00:00 2001
From: megane 
Date: Sat, 30 Mar 2019 09:26:59 +0200
Subject: [PATCH] Make scrutinizer message format test suite more comprehensive

Signed-off-by: Evan Hanson 
---
 tests/scrutinizer-message-format.expected | 349 --
 tests/test-scrutinizer-message-format.scm |  35 ++-
 2 files changed, 212 insertions(+), 172 deletions(-)

diff --git a/tests/scrutinizer-message-format.expected b/tests/scrutinizer-message-format.expected
index f6f3b256..13e0361d 100644
--- a/tests/scrutinizer-message-format.expected
+++ b/tests/scrutinizer-message-format.expected
@@ -306,110 +306,37 @@ Warning: List index out of range
 
   Procedure `list-ref' from module `scheme' is called with index `1' for a list of length `0'.
 
-Warning: Negative vector index
+Warning: Invalid argument
   In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `vector-ref-out-of-range',
+  In procedure `append-invalid-arg',
   In procedure call:
 
-(scheme#vector-ref (scheme#vector) -1)
-
-  Procedure `vector-ref' from module `scheme' is called with a negative index -1.
+(scheme#append 1 (scheme#list 1))
 
-Warning: Let binding to `a' has zero values
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `zero-values-for-let',
-  In let expression:
+  Argument #1 to procedure `append' has an invalid type:
 
-(let ((a (scheme#values))) a)
-
-  Variable `a' is bound to an expression that returns 0 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
-
-  This is the expression:
-
-(scheme#values)
-
-Warning: Let binding to `a' has 2 values
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `multiple-values-for-let',
-  In let expression:
-
-(let ((a (scheme#values 1 2))) a)
-
-  Variable `a' is bound to an expression that returns 2 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
-
-  This is the expression:
-
-(scheme#values 1 2)
-
-Warning: Zero values for conditional
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `zero-values-for-conditional',
-  In conditional:
-
-(if (scheme#values) 1 (##core#undefined))
-
-  The test expression returns 0 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
-
-  This is the expression:
-
-(scheme#values)
-
-Warning: Too many values for conditional
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `multiple-values-for-conditional',
-  In conditional:
-
-(if (scheme#values 1 2) 1 (##core#undefined))
-
-  The test expression returns 2 values.
+fixnum
 
-  It is a call to `values' from module `scheme' which has this type:
+  The expected type is:
 
-(procedure (#!rest values) . *)
+list
 
   This is the expression:
 
-(scheme#values 1 2)
-
-Note: Test is always true
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `multiple-values-for-conditional',
-  In conditional expression:
+1
 
-(if (scheme#values 1 2) 1 (##core#undefined))
+  Procedure `append' from module `scheme' has this type:
 
-  Test condition has always true value of type:
+(#!rest * -> *)
 
-fixnum
-
-Warning: Let binding to `gXXX' has 2 values
+Warning: Negative vector index
   In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `multiple-values-for-conditional',
-  In let expression:
-
-(if (scheme#values 1 2) 1 (##core#undefined))
-
-  Variable `gXXX' is bound to an expression that returns 2 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
+  In procedure `vector-ref-out-of-range',
+  In procedure call:
 
-  This is the expression:
+(scheme#vector-ref (scheme#vector) -1)
 
-(scheme#values 1 2)
+  Procedure `vector-ref' from module `scheme' is called with a negative index -1.
 
 Warning: Wrong number of arguments
   In file `test-scrutinizer-message-format.scm:XXX',
@@ -493,26 +420,6 @@ Warning: Not enough argument values
 
 (scheme#values)
 
-Warning: Let binding to `gXXX' has zero values
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In module `m',
-  In procedure `toplevel-foo',
-  In procedure `local-bar',
-  In procedure `r-proc-call-argument-value-count',
-  In let expression:
-
-(let ((gXXX (scheme#values))) (gXXX))
-
-  Variable `gXXX' is bound to an expression that returns 0 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
-
-  This is the expression:
-
-(scheme#values)
-
 Warning: Branch values mismatch
   In file `test-scrutinizer-message-format.scm:XXX',
   In module `m',
@@ -534,10 +441,28 @@ Warning: Branch values mismatch
 (chicken.time#cpu-time)
 
 

Re: [Chicken-hackers] [PATCH] Fix arguments to scrutiny reporting procedure for `append'

2019-03-30 Thread megane

Evan Hanson  writes:

> On 2019-03-25 14:23, megane wrote:
>> The last patchset contained a more comprehensive message format test
>> suite. I guess I just forgot to mention that, sorry :P
>>
>> Here's a patch that applies on top of this fix.
>
> Thanks megane, here's a signed-off copy.
>
> I changed the new TVs ('foo et al.) to 'a, 'b, and 'c so the gensym
> redaction script would pick them up, and reenabled the commented-out
> `zero-values-for-conditional' tests. If there's a reason those really
> should be disabled, just shout.

Hi,

Yeah those conditional tests shouldn't be commented, my bad.

I don't think the format-clashing-typevars is a good test either. It was
supposed to test that identically named type variables coming from
different sources should be printed with different names (but still not
with the internally renamed names used by scrutinizer).

Currently they are printed with identical names. How this case should be
printed needs some thinking. Let's just drop this test for now.

Attached is a new version. I tweaked the formatting a bit and added some
comments, too.

>From c0e84a6410d522c71df2363f2ec0b4a1eb7c7ba2 Mon Sep 17 00:00:00 2001
From: megane 
Date: Sat, 30 Mar 2019 09:26:59 +0200
Subject: [PATCH] Make scrutinizer message format test suite more comprehensive

---
 tests/scrutinizer-message-format.expected | 349 --
 tests/test-scrutinizer-message-format.scm |  34 ++-
 2 files changed, 211 insertions(+), 172 deletions(-)

diff --git a/tests/scrutinizer-message-format.expected 
b/tests/scrutinizer-message-format.expected
index f6f3b25..13e0361 100644
--- a/tests/scrutinizer-message-format.expected
+++ b/tests/scrutinizer-message-format.expected
@@ -306,110 +306,37 @@ Warning: List index out of range
 
   Procedure `list-ref' from module `scheme' is called with index `1' for a 
list of length `0'.
 
-Warning: Negative vector index
+Warning: Invalid argument
   In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `vector-ref-out-of-range',
+  In procedure `append-invalid-arg',
   In procedure call:
 
-(scheme#vector-ref (scheme#vector) -1)
-
-  Procedure `vector-ref' from module `scheme' is called with a negative index 
-1.
+(scheme#append 1 (scheme#list 1))
 
-Warning: Let binding to `a' has zero values
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `zero-values-for-let',
-  In let expression:
+  Argument #1 to procedure `append' has an invalid type:
 
-(let ((a (scheme#values))) a)
-
-  Variable `a' is bound to an expression that returns 0 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
-
-  This is the expression:
-
-(scheme#values)
-
-Warning: Let binding to `a' has 2 values
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `multiple-values-for-let',
-  In let expression:
-
-(let ((a (scheme#values 1 2))) a)
-
-  Variable `a' is bound to an expression that returns 2 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
-
-  This is the expression:
-
-(scheme#values 1 2)
-
-Warning: Zero values for conditional
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `zero-values-for-conditional',
-  In conditional:
-
-(if (scheme#values) 1 (##core#undefined))
-
-  The test expression returns 0 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
-
-  This is the expression:
-
-(scheme#values)
-
-Warning: Too many values for conditional
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `multiple-values-for-conditional',
-  In conditional:
-
-(if (scheme#values 1 2) 1 (##core#undefined))
-
-  The test expression returns 2 values.
+fixnum
 
-  It is a call to `values' from module `scheme' which has this type:
+  The expected type is:
 
-(procedure (#!rest values) . *)
+list
 
   This is the expression:
 
-(scheme#values 1 2)
-
-Note: Test is always true
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `multiple-values-for-conditional',
-  In conditional expression:
+1
 
-(if (scheme#values 1 2) 1 (##core#undefined))
+  Procedure `append' from module `scheme' has this type:
 
-  Test condition has always true value of type:
+(#!rest * -> *)
 
-fixnum
-
-Warning: Let binding to `gXXX' has 2 values
+Warning: Negative vector index
   In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `multiple-values-for-conditional',
-  In let expression:
-
-(if (scheme#values 1 2) 1 (##core#undefined))
-
-  Variable `gXXX' is bound to an expression that returns 2 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
+  In procedure `vector-ref-out-of-range',
+  In procedure call:
 
-  This is the expression:
+

Re: [Chicken-hackers] [PATCH] Fix arguments to scrutiny reporting procedure for `append'

2019-03-29 Thread Evan Hanson
Actually attached this time.
>From a9d1c0efe1ee5315d16233a016f88617b47f9075 Mon Sep 17 00:00:00 2001
From: megane 
Date: Mon, 25 Mar 2019 14:15:19 +0200
Subject: [PATCH] Make scrutinizer message format test suite more comprehensive

Signed-off-by: Evan Hanson 
---
 tests/runtests.bat|   2 +-
 tests/runtests.sh |   2 +-
 tests/scrutinizer-message-format.expected | 547 +++---
 tests/test-scrutinizer-message-format.scm |  55 ++-
 4 files changed, 389 insertions(+), 217 deletions(-)

diff --git a/tests/runtests.bat b/tests/runtests.bat
index 49fa8348..edbd1bb1 100644
--- a/tests/runtests.bat
+++ b/tests/runtests.bat
@@ -105,7 +105,7 @@ if errorlevel 1 exit /b 1
 rem Replace foo123 -> fooXX so gensyms don't trigger failures
 %compile% redact-gensyms.scm -o redact-gensyms
 if errorlevel 1 exit /b 1
-redact-gensyms "tmp,g,scm:,a,b" < scrutinizer-message-format.out > scrutinizer-message-format.redacted
+redact-gensyms "tmp,g,scm:,a,b,c" < scrutinizer-message-format.out > scrutinizer-message-format.redacted
 if errorlevel 1 exit /b 1
 redact-gensyms < scrutiny-2.out > scrutiny-2.redacted
 if errorlevel 1 exit /b 1
diff --git a/tests/runtests.sh b/tests/runtests.sh
index fc90ebbe..17c83448 100755
--- a/tests/runtests.sh
+++ b/tests/runtests.sh
@@ -119,7 +119,7 @@ $compile specialization-tests.scm -A -specialize 2>specialization.out
 
 # Replace foo123 -> fooXX so gensyms don't trigger failures
 $compile redact-gensyms.scm -o redact-gensyms
-./redact-gensyms "tmp,g,scm:,a,b" < scrutinizer-message-format.out > scrutinizer-message-format.redacted
+./redact-gensyms "tmp,g,scm:,a,b,c" < scrutinizer-message-format.out > scrutinizer-message-format.redacted
 ./redact-gensyms < scrutiny-2.out > scrutiny-2.redacted
 ./redact-gensyms < scrutiny.out > scrutiny.redacted
 ./redact-gensyms < specialization.out > specialization.redacted
diff --git a/tests/scrutinizer-message-format.expected b/tests/scrutinizer-message-format.expected
index f6f3b256..40dae789 100644
--- a/tests/scrutinizer-message-format.expected
+++ b/tests/scrutinizer-message-format.expected
@@ -1,5 +1,5 @@
 ;; numbers replaced with XXX by redact-gensyms.scm
-;; prefixes: (tmp g scm: a b)
+;; prefixes: (tmp g scm: a b c)
 
 Warning: literal in operator position: (1 2)
 
@@ -75,29 +75,12 @@ Warning: Not enough argument values
 
 (scheme#values)
 
-Warning: Let binding to `gXXX' has zero values
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `r-proc-call-argument-value-count',
-  In let expression:
-
-(let ((gXXX (scheme#values))) (gXXX))
-
-  Variable `gXXX' is bound to an expression that returns 0 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
-
-  This is the expression:
-
-(scheme#values)
-
 Warning: Branch values mismatch
   In file `test-scrutinizer-message-format.scm:XXX',
   In procedure `r-cond-branch-value-count-mismatch',
   In conditional expression:
 
-(if (the * 1) 1 (scheme#values 1 2))
+(if (the * 1) 1 (chicken.time#cpu-time))
 
   The branches have different numbers of values.
 
@@ -107,7 +90,7 @@ Warning: Branch values mismatch
 
   The false branch returns 2 values:
 
-(scheme#values 1 2)
+(chicken.time#cpu-time)
 
 Warning: Invalid procedure
   In procedure `r-invalid-called-procedure-type',
@@ -306,110 +289,37 @@ Warning: List index out of range
 
   Procedure `list-ref' from module `scheme' is called with index `1' for a list of length `0'.
 
-Warning: Negative vector index
+Warning: Invalid argument
   In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `vector-ref-out-of-range',
+  In procedure `append-invalid-arg',
   In procedure call:
 
-(scheme#vector-ref (scheme#vector) -1)
-
-  Procedure `vector-ref' from module `scheme' is called with a negative index -1.
-
-Warning: Let binding to `a' has zero values
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `zero-values-for-let',
-  In let expression:
-
-(let ((a (scheme#values))) a)
-
-  Variable `a' is bound to an expression that returns 0 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
-
-  This is the expression:
-
-(scheme#values)
-
-Warning: Let binding to `a' has 2 values
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `multiple-values-for-let',
-  In let expression:
-
-(let ((a (scheme#values 1 2))) a)
-
-  Variable `a' is bound to an expression that returns 2 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
-
-  This is the expression:
-
-(scheme#values 1 2)
-
-Warning: Zero values for conditional
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `zero-values-for-conditional',
-  In conditional:
-
-(if (scheme#values) 1 (##core#undefined))
-
-  The test 

Re: [Chicken-hackers] [PATCH] Fix arguments to scrutiny reporting procedure for `append'

2019-03-29 Thread Evan Hanson
On 2019-03-25 14:23, megane wrote:
> The last patchset contained a more comprehensive message format test
> suite. I guess I just forgot to mention that, sorry :P
> 
> Here's a patch that applies on top of this fix.

Thanks megane, here's a signed-off copy.

I changed the new TVs ('foo et al.) to 'a, 'b, and 'c so the gensym
redaction script would pick them up, and reenabled the commented-out
`zero-values-for-conditional' tests. If there's a reason those really
should be disabled, just shout.

Cheers,

Evan

___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] [PATCH] Fix arguments to scrutiny reporting procedure for `append'

2019-03-29 Thread Peter Bex
On Mon, Mar 25, 2019 at 09:46:59PM +1300, Evan Hanson wrote:
> Hi folks,
> 
> Here's a patch that fixes #1592, which was also discovered by Kooda in
> IRC this morning.
> 
> I'm pretty sure I introduced this bug while applying megane's patches,
> or at least made the problem worse. In my defense, the variable names in
> this bit of code didn't help, so this patch also tries to address that.
> The commit message has the details.

Excellent work, pushed.

Cheers,
Peter


signature.asc
Description: PGP signature
___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] [PATCH] Fix arguments to scrutiny reporting procedure for `append'

2019-03-25 Thread megane

Evan Hanson  writes:

> Hi folks,
>
> Here's a patch that fixes #1592, which was also discovered by Kooda in
> IRC this morning.
>
> I'm pretty sure I introduced this bug while applying megane's patches,
> or at least made the problem worse. In my defense, the variable names in
> this bit of code didn't help, so this patch also tries to address that.
> The commit message has the details.
>

The last patchset contained a more comprehensive message format test
suite. I guess I just forgot to mention that, sorry :P

Here's a patch that applies on top of this fix.

>From 5cac6464f29b660745bbaef2bbe8cc4a2c43302f Mon Sep 17 00:00:00 2001
From: megane 
Date: Mon, 25 Mar 2019 14:15:19 +0200
Subject: [PATCH] Make scrutinizer message format test suite more comprehensive

---
 tests/scrutinizer-message-format.expected | 518 ++
 tests/test-scrutinizer-message-format.scm |  55 +++-
 2 files changed, 352 insertions(+), 221 deletions(-)

diff --git a/tests/scrutinizer-message-format.expected 
b/tests/scrutinizer-message-format.expected
index f6f3b25..3adf131 100644
--- a/tests/scrutinizer-message-format.expected
+++ b/tests/scrutinizer-message-format.expected
@@ -75,29 +75,12 @@ Warning: Not enough argument values
 
 (scheme#values)
 
-Warning: Let binding to `gXXX' has zero values
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `r-proc-call-argument-value-count',
-  In let expression:
-
-(let ((gXXX (scheme#values))) (gXXX))
-
-  Variable `gXXX' is bound to an expression that returns 0 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
-
-  This is the expression:
-
-(scheme#values)
-
 Warning: Branch values mismatch
   In file `test-scrutinizer-message-format.scm:XXX',
   In procedure `r-cond-branch-value-count-mismatch',
   In conditional expression:
 
-(if (the * 1) 1 (scheme#values 1 2))
+(if (the * 1) 1 (chicken.time#cpu-time))
 
   The branches have different numbers of values.
 
@@ -107,7 +90,7 @@ Warning: Branch values mismatch
 
   The false branch returns 2 values:
 
-(scheme#values 1 2)
+(chicken.time#cpu-time)
 
 Warning: Invalid procedure
   In procedure `r-invalid-called-procedure-type',
@@ -306,110 +289,37 @@ Warning: List index out of range
 
   Procedure `list-ref' from module `scheme' is called with index `1' for a 
list of length `0'.
 
-Warning: Negative vector index
+Warning: Invalid argument
   In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `vector-ref-out-of-range',
+  In procedure `append-invalid-arg',
   In procedure call:
 
-(scheme#vector-ref (scheme#vector) -1)
+(scheme#append 1 (scheme#list 1))
 
-  Procedure `vector-ref' from module `scheme' is called with a negative index 
-1.
-
-Warning: Let binding to `a' has zero values
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `zero-values-for-let',
-  In let expression:
-
-(let ((a (scheme#values))) a)
-
-  Variable `a' is bound to an expression that returns 0 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
-
-  This is the expression:
-
-(scheme#values)
-
-Warning: Let binding to `a' has 2 values
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `multiple-values-for-let',
-  In let expression:
-
-(let ((a (scheme#values 1 2))) a)
-
-  Variable `a' is bound to an expression that returns 2 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
-
-  This is the expression:
+  Argument #1 to procedure `append' has an invalid type:
 
-(scheme#values 1 2)
-
-Warning: Zero values for conditional
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `zero-values-for-conditional',
-  In conditional:
-
-(if (scheme#values) 1 (##core#undefined))
-
-  The test expression returns 0 values.
-
-  It is a call to `values' from module `scheme' which has this type:
-
-(procedure (#!rest values) . *)
-
-  This is the expression:
-
-(scheme#values)
-
-Warning: Too many values for conditional
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `multiple-values-for-conditional',
-  In conditional:
-
-(if (scheme#values 1 2) 1 (##core#undefined))
-
-  The test expression returns 2 values.
+fixnum
 
-  It is a call to `values' from module `scheme' which has this type:
+  The expected type is:
 
-(procedure (#!rest values) . *)
+list
 
   This is the expression:
 
-(scheme#values 1 2)
-
-Note: Test is always true
-  In file `test-scrutinizer-message-format.scm:XXX',
-  In procedure `multiple-values-for-conditional',
-  In conditional expression:
+1
 
-(if (scheme#values 1 2) 1 (##core#undefined))
+  Procedure `append' from module `scheme' has this type:
 
-  Test condition has always true value of type:
+(#!rest * -> *)
 
-

[Chicken-hackers] [PATCH] Fix arguments to scrutiny reporting procedure for `append'

2019-03-25 Thread Evan Hanson
Hi folks,

Here's a patch that fixes #1592, which was also discovered by Kooda in
IRC this morning.

I'm pretty sure I introduced this bug while applying megane's patches,
or at least made the problem worse. In my defense, the variable names in
this bit of code didn't help, so this patch also tries to address that.
The commit message has the details.

Cheers,

Evan
>From a4ee8bb3054e7927c2e391a5d27c4bdf508de4ec Mon Sep 17 00:00:00 2001
From: Evan Hanson 
Date: Mon, 25 Mar 2019 21:14:43 +1300
Subject: [PATCH] Fix arguments to scrutiny reporting procedure for `append'

This commit fixes two issues introduced by 8301457, which updated the
scrutinizer's special case handling for `append' to use the new
`r-proc-call-argument-type-mismatch' procedure to report problems.

Firstly, the arguments for the call node and its type were flipped,
leading to an error when printing what was expected to be a node.

Secondly, the first item in the `arg-types' list was not resolved to a
type, so a `##core#the/result' node was passed instead. This wouldn't
cause an error, but it would give a confusing report.

Finally, for clarity, rename the `arg-types' variable to `args' within
that procedure (since it actually refers to nodes and not types), and
the `arg1' variable to `arg1-t' (which is a type and not a node).
---
 scrutinizer.scm | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/scrutinizer.scm b/scrutinizer.scm
index 7d767df2..b728d5eb 100644
--- a/scrutinizer.scm
+++ b/scrutinizer.scm
@@ -2198,24 +2198,25 @@
 (define (potentially-proper-list? l) (match-types l 'list '()))
 
 (define (derive-result-type)
-  (let lp ((arg-types (cdr args))
+  (let lp ((args (cdr args))
 	   (index 1))
-	(if (null? arg-types)
+	(if (null? args)
 	'null
-	(let ((arg1 (walked-result (car arg-types
+	(let* ((arg1 (car args))
+		   (arg1-t (walked-result arg1)))
 	  (cond
-	   ((and (pair? arg1) (eq? (car arg1) 'list))
-		(and-let* ((rest-t (lp (cdr arg-types) (add1 index
+	   ((and (pair? arg1-t) (eq? (car arg1-t) 'list))
+		(and-let* ((rest-t (lp (cdr args) (add1 index
 		  ;; decanonicalize, then recanonicalize to make it
 		  ;; easy to append a variety of types.
 		  (canonicalize-list-type
 		   (foldl (lambda (rest t) `(pair ,t ,rest))
-			  rest-t (reverse (cdr arg1))
+			  rest-t (reverse (cdr arg1-t))
 
-	   ((and (pair? arg1) (eq? (car arg1) 'list-of))
-		(and-let* ((rest-t (lp (cdr arg-types) (add1 index
+	   ((and (pair? arg1-t) (eq? (car arg1-t) 'list-of))
+		(and-let* ((rest-t (lp (cdr args) (add1 index
 		  ;; list-of's length unsurety is "contagious"
-		  (simplify-type `(or ,arg1 ,rest-t
+		  (simplify-type `(or ,arg1-t ,rest-t
 
 	   ;; TODO: (append (pair x (pair y z)) lst) =>
 	   ;; (pair x (pair y (or z lst)))
@@ -2223,11 +2224,10 @@
 
 	   (else
 		;; The final argument may be an atom or improper list
-		(unless (or (null? (cdr arg-types))
-			(potentially-proper-list? arg1))
+		(unless (or (null? (cdr args))
+			(potentially-proper-list? arg1-t))
 		  (r-proc-call-argument-type-mismatch
-		   loc node index 'list arg1
-		   (car arg-types)
+		   loc node index arg1 'list arg1-t
 		   (variable-mark 'scheme#append '##compiler#type)))
 		#f))
 (cond ((derive-result-type) => list)
-- 
2.11.0

___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers