Opened 7 years ago
#1471 new enhancement
[types] Enforce parameter types on specialization
Reported by: | megane | Owned by: | |
---|---|---|---|
Priority: | not urgent at all | Milestone: | someday |
Component: | scrutinizer | Version: | 5.0.0 |
Keywords: | Cc: | ||
Estimated difficulty: | medium |
Description
Currently no enforcing happens if specialization takes place.
Here's a case from scrutiny-tests.
Note that scheme#+ has a specialization for parameters (* *).
When using -A
flag no specialization takes place, so the enforcing happens.
In this example you'd like to have the type for x
to be enforced to number
after the if
.
;; noreturn conditional branch enforces "number" on x (define (foo2 x) (if (string? x) (error "foo") (+ x 3)) (string-append x "abc")) ;; $ csc -O3 enforce-fail.scm ;; ;; Warning: in toplevel procedure `foo2': ;; (enforce-fail.scm:7) in procedure call to `scheme#string-append', expected argument #1 of type `string' but was given an argument of type `(not string)' ;; $ csc -A enforce-fail.scm ;; ;; Warning: in toplevel procedure `foo2': ;; (enforce-fail.scm:7) in procedure call to `scheme#string-append', expected argument #1 of type `string' but was given an argument of type `number'
Note: See
TracTickets for help on using
tickets.