ccl icon indicating copy to clipboard operation
ccl copied to clipboard

The compiler claims to mismatch the arguments.

Open hyotang666 opened this issue 5 years ago • 1 comments
trafficstars

The behavior that I got is below (the dribbled one).

"dribble"
? (lisp-implementation-version)
"Version 1.12 (v1.12) LinuxX8664"
? (defclass fun ()
  ()
  (:metaclass c2mop:funcallable-standard-class))
#<FUNCALLABLE-STANDARD-CLASS FUN>
? 
(defmethod initialize-instance :after
           ((fun fun) &key function &allow-other-keys)
  (c2mop:set-funcallable-instance-function fun function))
#<STANDARD-METHOD INITIALIZE-INSTANCE :AFTER (FUN)>
? 
(setf (symbol-function 'test) (make-instance 'fun :function #'car))
#<FUN #x3020018014FF>

;; Works fine.
? 
(test '(1 2 3))
1

;; But ccl:arglist could not detect correct arglist.
? (ccl:arglist 'test)
NIL
:ANALYSIS

;; The compiler claims.
? (compile nil (lambda () (test '(1 2 3))))
;Compiler warnings :
;   In an anonymous lambda form at position 24: In the call to TEST with arguments ('(1
;                                                                                         2
;                                                                                         3)),
;     1 argument was provided, but at most 0 are accepted
;     by the current global definition of TEST
#<Anonymous Function #x30200183958F>
NIL
NIL
? (dribble)

This may be related to #43

What I want to do is muffling the compiler warnings (of course I can do it with cl:muffle-warning though).

hyotang666 avatar Oct 31 '20 10:10 hyotang666

Has there been any update to this? I can reproduce the issue in CCL 1.12 / x86-64 with adhoc-polymorphic-functions which basically is using a custom function class.

The most I have been able to figure out so far is that the warning comes from compile-named-function (and perhaps nx1-check-call-args, which calls innermost-lfun-bits-keyvect).

EDIT: Solved at least a part of it; one needs to set the appropriate lfun-bits from inside set-funcallable-instance-function; cloning, bootstrapping and issuing a PR

digikar99 avatar May 17 '21 13:05 digikar99