ffi: fix _x-pointer/null' when
_x' has a supertype
This is more specifically a bug in `_cpointer/null', but it shows up most easily through C structs.
This commit is contained in:
parent
a71ac65a27
commit
f461d9f67d
|
@ -1105,7 +1105,10 @@
|
|||
(if (cpointer? p)
|
||||
(and p (if (cpointer-has-tag? p t) p (error* p)))
|
||||
(error* p))))
|
||||
(make-ctype (or ptr-type _pointer)
|
||||
(make-ctype (cond
|
||||
[(and nullable? ptr-type) (_or-null ptr-type)]
|
||||
[ptr-type]
|
||||
[else _pointer])
|
||||
;; bad hack: `if's outside the lambda for efficiency
|
||||
(if nullable?
|
||||
(if scheme->c
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
(test '(4 5 6) tri->list tv2)
|
||||
(test '(4 5 6) tri->list* tv2)
|
||||
(test '(7 8 9) tri->list* (list*->tri '(7 8 9)))
|
||||
(test #f cast #f _tri-pointer/null _pointer)
|
||||
(test #f cast #f _pointer _tri-pointer/null)
|
||||
(test #t tri? tv)
|
||||
(test #f tri? 'tv)
|
||||
(test #f tri? (cast 1 _intptr _pointer))
|
||||
|
@ -40,6 +42,8 @@
|
|||
(test #f tri? 'tv)
|
||||
(test #f tri? (cast 1 _intptr _pointer))
|
||||
(q-more qv)
|
||||
(test #f cast #f _quad-pointer/null _pointer)
|
||||
(test #f cast #f _pointer _quad-pointer/null)
|
||||
|
||||
(define-cstruct _quint ([pre _quad]
|
||||
[r _float]))
|
||||
|
|
Loading…
Reference in New Issue
Block a user