From c4ece710321ea042fdf1ea3cd724a8fcabb12fa4 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Tue, 12 Sep 2017 10:06:21 +0200 Subject: [PATCH] Don't smash the inferred type for constants Constants indeed don't change throughout the programs so it makes sense not to smash their types since mutation can't occur. --- scrutinizer.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scrutinizer.scm b/scrutinizer.scm index 9720ea0d..62832415 100644 --- a/scrutinizer.scm +++ b/scrutinizer.scm @@ -654,7 +654,10 @@ (not (eq? (variable-mark var '##compiler#inline) 'no)))) (let ((rtlst (list (cons #f (tree-copy rt))))) - (smash-component-types! rtlst "global") + ;; constants cannot be mutated, avoid smashing the + ;; inferred type + (unless (variable-mark var '##compiler#constant) + (smash-component-types! rtlst "global")) (let ((rt (cdar rtlst))) (debugging '|I| (sprintf "(: ~s ~s)" var rt)) ;; [2] sets property, but lambda has already been walked, -- 2.11.0