Summary
Type information doesn't survive calls to define-inline procedures
Metadata
- Id: 7829f1f58d282600bc01a9c2e57243ebd13570d1
- Trac id: 1859
- Type: defect
- Reporter: sjamaan
- Owner:
- Cc:
- Status: new
- Component: scrutinizer
- Estimated difficulty: medium
- Resolution:
- Priority: major
- Milestone: someday
- Version: 6.0.0
- Changetime: 2025-08-20 09:03:21 UTC
- Created: 2025-08-20 08:48:57 UTC
- Keywords:
Description
Compile the following to C:
(module foo ()
(import scheme (chicken base) (chicken plist))
(let ((x (gensym)))
(put! 'foo x 1))
(define-inline (put-one! sym prop)
(put! sym prop 1))
(let ((y (gensym)))
(put-one! 'foo y)))
Note that the first call to put! gets rewritten to C_a_i_putprop(&a,3,lf[[1]|],t1,C_fix(1)), but the second call remains a CPS call to chicken.plist#put! via procedure lookup.
This is unexpected, as inlining by hand should give the same results as calling a define-inline procedure.
If you restore the typing info by hand, it also works as expected:
(define-inline (put-one! sym prop) (put! (the symbol sym) (the symbol prop) 1))
Changes and comments
[2025-08-20 09:03:21 UTC] sjamaan wrote:
BTW, it's also a bit strange that the types can't be determined for procedures that get contracted or inlined by the compiler when using regular define.