Summary
[types] Enforce parameter types on specialization
Metadata
- Id: b8336d60b2eb5bf00187044d0ab85ff15fe7a025
- Trac id: 1471
- Type: enhancement
- Reporter: megane
- Owner:
- Cc:
- Status: new
- Component: scrutinizer
- Estimated difficulty: medium
- Resolution:
- Priority: not urgent at all
- Milestone: someday
- Version: 5.0.0
- Changetime: 2018-06-06 09:02:43 UTC
- Created: 2018-06-06 09:02:43 UTC
- Keywords:
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'