~ chicken-core (chicken-5) 87422d23af61871b1a2fb8c6c835e9d5e40b1c27
commit 87422d23af61871b1a2fb8c6c835e9d5e40b1c27 Author: Peter Bex <peter@more-magic.net> AuthorDate: Mon May 25 15:42:03 2015 +0200 Commit: Peter Bex <peter@more-magic.net> CommitDate: Mon May 25 15:47:41 2015 +0200 Don't consider #t not always-true Signed-off-by: Peter Bex <peter@more-magic.net> Conflicts: tests/scrutiny.expected diff --git a/scrutinizer.scm b/scrutinizer.scm index a68dc210..ef0e5fb2 100644 --- a/scrutinizer.scm +++ b/scrutinizer.scm @@ -209,7 +209,7 @@ ((or) (every always-true1 (cdr t))) ((forall) (always-true1 (third t))) (else #t))) - ((memq t '(* boolean true false undefined noreturn)) #f) + ((memq t '(* boolean false undefined noreturn)) #f) (else #t))) (define (always-true t loc x) diff --git a/tests/scrutiny-tests.scm b/tests/scrutiny-tests.scm index 81c7c1a4..1d12b4c4 100644 --- a/tests/scrutiny-tests.scm +++ b/tests/scrutiny-tests.scm @@ -6,6 +6,10 @@ (let ((x (+ 3 4))) (if x 1 2))))) ; expected boolean but got number in conditional +(define (b) + (let ((x #t)) + (if x 1 2))) ; #t is always true + (define (foo x) (if x ; branches return differing number of results (values 1 2) diff --git a/tests/scrutiny.expected b/tests/scrutiny.expected index e33e84ca..ff2c0453 100644 --- a/tests/scrutiny.expected +++ b/tests/scrutiny.expected @@ -7,16 +7,22 @@ Note: in local procedure `c', (if x 1 2) +Note: in toplevel procedure `b': + expected value of type boolean in conditional but were given a value of type + `true' which is always true: + +(if x 1 2) + Warning: in toplevel procedure `foo': branches in conditional expression differ in the number of results: (if x (values 1 2) (values 1 2 (+ (+ ...)))) Warning: at toplevel: - (scrutiny-tests.scm:15) in procedure call to `bar', expected argument #2 of type `number', but was given an argument of type `symbol' + (scrutiny-tests.scm:19) in procedure call to `bar', expected argument #2 of type `number', but was given an argument of type `symbol' Warning: at toplevel: - (scrutiny-tests.scm:17) in procedure call to `pp', expected 1 argument, but was given 0 arguments + (scrutiny-tests.scm:21) in procedure call to `pp', expected 1 argument, but was given 0 arguments Warning: at toplevel: expected in argument #1 of procedure call `(print (cpu-time))' a single result, but were given 2 results @@ -25,58 +31,58 @@ Warning: at toplevel: expected in argument #1 of procedure call `(print (values))' a single result, but were given zero results Warning: at toplevel: - (scrutiny-tests.scm:23) in procedure call to `x', expected a value of type `(procedure () *)', but was given a value of type `fixnum' + (scrutiny-tests.scm:27) in procedure call to `x', expected a value of type `(procedure () *)', but was given a value of type `fixnum' Warning: at toplevel: - (scrutiny-tests.scm:25) in procedure call to `+', expected argument #1 of type `number', but was given an argument of type `symbol' + (scrutiny-tests.scm:29) in procedure call to `+', expected argument #1 of type `number', but was given an argument of type `symbol' Warning: at toplevel: - (scrutiny-tests.scm:25) in procedure call to `+', expected argument #2 of type `number', but was given an argument of type `symbol' + (scrutiny-tests.scm:29) 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 (a175) (procedure car ((pair a175 *)) a175))' + assignment of value of type `fixnum' to toplevel variable `car' does not match declared type `(forall (a178) (procedure car ((pair a178 *)) a178))' Warning: at toplevel: - expected in `let' binding of `g8' a single result, but were given 2 results + expected in `let' binding of `g10' a single result, but were given 2 results Warning: at toplevel: - in procedure call to `g8', expected a value of type `(procedure () *)', but was given a value of type `fixnum' + in procedure call to `g10', expected a value of type `(procedure () *)', but was given a value of type `fixnum' Note: in toplevel procedure `foo': expected value of type boolean in conditional but were given a value of type - `(procedure bar30 () *)' which is always true: + `(procedure bar32 () *)' which is always true: (if bar 3 (##core#undefined)) Warning: in toplevel procedure `foo2': - (scrutiny-tests.scm:54) in procedure call to `string-append', expected argument #1 of type `string', but was given an argument of type `number' + (scrutiny-tests.scm:58) in procedure call to `string-append', expected argument #1 of type `string', but was given an argument of type `number' Warning: at toplevel: - (scrutiny-tests.scm:62) in procedure call to `foo3', expected argument #1 of type `string', but was given an argument of type `fixnum' + (scrutiny-tests.scm:66) in procedure call to `foo3', expected argument #1 of type `string', but was given an argument of type `fixnum' Warning: in toplevel procedure `foo4': - (scrutiny-tests.scm:67) in procedure call to `+', expected argument #1 of type `number', but was given an argument of type `string' + (scrutiny-tests.scm:71) in procedure call to `+', expected argument #1 of type `number', but was given an argument of type `string' Warning: in toplevel procedure `foo5': - (scrutiny-tests.scm:73) in procedure call to `+', expected argument #1 of type `number', but was given an argument of type `string' + (scrutiny-tests.scm:77) in procedure call to `+', expected argument #1 of type `number', but was given an argument of type `string' Warning: in toplevel procedure `foo6': - (scrutiny-tests.scm:79) in procedure call to `+', expected argument #1 of type `number', but was given an argument of type `string' + (scrutiny-tests.scm:83) in procedure call to `+', expected argument #1 of type `number', but was given an argument of type `string' Warning: at toplevel: - (scrutiny-tests.scm:86) in procedure call to `+', expected argument #1 of type `number', but was given an argument of type `string' + (scrutiny-tests.scm:90) in procedure call to `+', expected argument #1 of type `number', but was given an argument of type `string' Warning: in toplevel procedure `foo10': - (scrutiny-tests.scm:100) in procedure call to `foo9', expected argument #1 of type `string', but was given an argument of type `number' + (scrutiny-tests.scm:104) in procedure call to `foo9', expected argument #1 of type `string', but was given an argument of type `number' Warning: in toplevel procedure `foo10': - (scrutiny-tests.scm:101) in procedure call to `+', expected argument #1 of type `number', but was given an argument of type `string' + (scrutiny-tests.scm:105) in procedure call to `+', expected argument #1 of type `number', but was given an argument of type `string' Note: in toplevel procedure `foo10': expression returns a result of type `string', but is declared to return `pair', which is not a subtype Warning: in toplevel procedure `foo10': - (scrutiny-tests.scm:105) in procedure call to `string-append', expected argument #1 of type `string', but was given an argument of type `pair' + (scrutiny-tests.scm:109) in procedure call to `string-append', expected argument #1 of type `string', but was given an argument of type `pair' Warning: in toplevel procedure `foo10': expression returns 2 values but is declared to have a single result @@ -88,10 +94,10 @@ Warning: in toplevel procedure `foo10': expression returns zero values but is declared to have a single result of type `*' Warning: in toplevel procedure `foo10': - (scrutiny-tests.scm:108) in procedure call to `*', expected argument #1 of type `number', but was given an argument of type `string' + (scrutiny-tests.scm:112) in procedure call to `*', expected argument #1 of type `number', but was given an argument of type `string' Warning: in toplevel procedure `foo#blabla': - (scrutiny-tests.scm:133) in procedure call to `+', expected argument #2 of type `number', but was given an argument of type `symbol' + (scrutiny-tests.scm:137) in procedure call to `+', expected argument #2 of type `number', but was given an argument of type `symbol' Warning: at toplevel: use of deprecated `deprecated-procedure' @@ -100,45 +106,45 @@ Warning: at toplevel: use of deprecated `another-deprecated-procedure' - consider `replacement-procedure' Warning: at toplevel: - (scrutiny-tests.scm:158) in procedure call to `apply1', expected argument #2 of type `(list-of number)', but was given an argument of type `(list symbol fixnum fixnum)' + (scrutiny-tests.scm:162) in procedure call to `apply1', expected argument #2 of type `(list-of number)', but was given an argument of type `(list symbol fixnum fixnum)' Warning: at toplevel: - (scrutiny-tests.scm:159) in procedure call to `apply1', expected argument #2 of type `(list-of number)', but was given an argument of type `(list symbol fixnum fixnum)' + (scrutiny-tests.scm:163) in procedure call to `apply1', expected argument #2 of type `(list-of number)', but was given an argument of type `(list symbol fixnum fixnum)' Note: at toplevel: - (scrutiny-tests.scm:172) in procedure call to `fixnum?', the predicate is called with an argument of type + (scrutiny-tests.scm:176) in procedure call to `fixnum?', the predicate is called with an argument of type `fixnum' and will always return true Note: at toplevel: - (scrutiny-tests.scm:180) in procedure call to `symbol?', the predicate is called with an argument of type + (scrutiny-tests.scm:184) in procedure call to `symbol?', the predicate is called with an argument of type `(or char string)' and will always return false Note: at toplevel: - (scrutiny-tests.scm:184) in procedure call to `char-or-string?', the predicate is called with an argument of type + (scrutiny-tests.scm:188) in procedure call to `char-or-string?', the predicate is called with an argument of type `fixnum' and will always return false Note: at toplevel: - (scrutiny-tests.scm:185) in procedure call to `symbol?', the predicate is called with an argument of type + (scrutiny-tests.scm:189) in procedure call to `symbol?', the predicate is called with an argument of type `(or char string)' and will always return false Note: at toplevel: - (scrutiny-tests.scm:186) in procedure call to `string?', the predicate is called with an argument of type + (scrutiny-tests.scm:190) in procedure call to `string?', the predicate is called with an argument of type `fixnum' and will always return false Note: at toplevel: - (scrutiny-tests.scm:190) in procedure call to `symbol?', the predicate is called with an argument of type + (scrutiny-tests.scm:194) in procedure call to `symbol?', the predicate is called with an argument of type `char' and will always return false Note: at toplevel: - (scrutiny-tests.scm:191) in procedure call to `string?', the predicate is called with an argument of type + (scrutiny-tests.scm:195) in procedure call to `string?', the predicate is called with an argument of type `symbol' and will always return false Note: at toplevel: - (scrutiny-tests.scm:195) in procedure call to `symbol?', the predicate is called with an argument of type + (scrutiny-tests.scm:199) in procedure call to `symbol?', the predicate is called with an argument of type `(or char string)' and will always return false Note: at toplevel: - (scrutiny-tests.scm:196) in procedure call to `string?', the predicate is called with an argument of type + (scrutiny-tests.scm:200) in procedure call to `string?', the predicate is called with an argument of type `symbol' and will always return false Warning: redefinition of standard binding: carTrap