From 83dccb7acfc0ee28af01e128333dc157766e5e71 Mon Sep 17 00:00:00 2001 From: Shiro Kawai Date: Wed, 21 Aug 2024 08:52:44 -0400 Subject: [PATCH] Remove check of class constraints for specialization The original code rejects specializing a function/variable of type without class constraints. That restriction seems unecessary. --- src/typechecker/specialize.lisp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/typechecker/specialize.lisp b/src/typechecker/specialize.lisp index 1cfb70fd..1fd707d6 100644 --- a/src/typechecker/specialize.lisp +++ b/src/typechecker/specialize.lisp @@ -62,10 +62,8 @@ (let ((from-qual-ty (tc:fresh-inst from-ty)) (to-qual-ty (tc:fresh-inst to-ty))) - (when (null (tc:qualified-ty-predicates from-qual-ty)) - (tc-error "Invalid specialization" - (tc-note (parser:toplevel-specialize-from specialize) - "must be a function or variable with class constraints"))) + ;; NB: There used to be a check if from-ty contains predicates, and raises an + ;; error if not. It doesn't seem necessary. (unless (equalp to-ty scheme) (tc-error "Invalid specialization"