digego / extempore

A cyber-physical programming environment
1.41k stars 127 forks source link

pset! does not work with generic memory pointers contained in generic tuples #315

Open cianoc opened 6 years ago

cianoc commented 6 years ago

Test Code:

(bind-type Test <!a*,i64> (printer? . #f))

(bind-func Test:[Test{!a}*,i64]*
  (lambda (x)
    (let ((arr:!a* (halloc x)))
      (Test_z arr x))))

(bind-func put:[void,Test{!a}*,i64,!a]*
  (lambda (arr idx val)
    (pset! (tref arr 0) idx val)))

($ (let ((arr:Test{i64}* (Test 16)))
     (put arr 6 4)
     (println "finished")))

Produces the following error: Type Error in pointer-set!, got i64*, was expecting i64

It seems that the compiler is inserting a spurious '*' somewhere in the process.