Menu

#5 make-delegate broken for ValueType parameters

v1.0_(example)
open
nobody
None
7
2015-02-19
2015-02-19
Mark Hurd
No

The definition of (an internal method of) make-delegate as provided in the boot.lisp of the 0.6 download (and in my subsequent external downloads) is broken when the delegate refers to value types in its parameters.

E.g. This will fail:
(.Invoke (make-delegate System.Threading.WaitOrTimerCallback. (o f) (prn (str o) f)) nil true)

(The actual failure varies a bit because the problem is invalid emitted IL.)

Specifically the fix is, in (def (__make-delegator-type type):

            (when (.IsValueType (i invoke-arg-types))
                (mil.Emit OpCodes:Box))

should become

            (when (.IsValueType (i invoke-arg-types))
                (mil.Emit OpCodes:Box (i invoke-arg-types)))

and this is also the case for my modified boot.lisp that caters for single method interfaces where the surrounding code is adjusted.

Discussion


Log in to post a comment.