Contraction of function causing it to disappear pasted by sjamaan on Fri Sep 13 11:23:19 2024

(declare (block))

(define (myfun x)
  (display x)
  (newline))

(myfun 1)
(myfun 1 2)

Potential fix added by sjamaan on Sat Sep 14 10:51:40 2024

diff --git a/core.scm b/core.scm
index 406fbe53..ebe7c5ea 100644
--- a/core.scm
+++ b/core.scm
@@ -2088,6 +2088,11 @@
 	     (when (eq? '##core#variable (node-class fun))
 	       (let* ((name (first (node-parameters fun)))
                       (val (db-get db name 'value)))
+                 (when (and val
+                            (eq? '##core#lambda (node-class val))
+                            (not (llist-match? (third (node-parameters val))
+                                               (cdr subs))))
+                   (db-put! db name 'has-bad-calls #t))
                  (when (and first-analysis
                             val
                             (not (db-get db name 'global))
@@ -2354,7 +2359,7 @@
 				  (lambda (v) (db-get db v 'global))
 				  (nth-value 0 (scan-free-variables
 						value block-compilation)) ) ) )
-		    (if (and (= 1 nreferences) (= 1 ncall-sites))
+		    (if (and (not (db-get db sym 'has-bad-calls)) (= 1 nreferences) (= 1 ncall-sites))
 			(quick-put! plist 'contractable #t)
 			(quick-put! plist 'inlinable #t) ) ) ) )
 	       (local-value