samrushing / irken-compiler

Irken is a statically typed variant of Scheme. Or a lisp-like variant of ML.
http://nightmare.com/rushing/irken.html
BSD 2-Clause "Simplified" License
210 stars 17 forks source link

Duplicate field names in record literals. #42

Open samrushing opened 7 years ago

samrushing commented 7 years ago

{a=1 b=2 a=3} makes it all the way to the C compiler before failing.

The type signature for %rextend is accidentally using a "free extension" sig.

jeske commented 7 years ago

Sam says this is fixed with a patch he applied and hasn't hit the mainline yet.

@@ -533,14 +536,16 @@
       '%rmake       -> (:scheme '() (arrow (rproduct (rdefault (rabs)))
'()))
       '%ensure-heap -> (:scheme '() (arrow undefined-type (LIST int-type)))
       '%rextend     -> (match params with
-                        (sexp:symbol label)
-                        -> (let ((plabel (make-label label)))
-                             (:scheme (LIST T0 T1 T2)
-                                      (arrow (rproduct (rlabel plabel
(rpre T2) T1))
-                                             (LIST
-                                              (rproduct (rlabel plabel
T0 T1))
-                                              T2))))
-                        _ -> (prim-error name))
+                         (sexp:symbol label)
+                         -> (let ((plabel (make-label label)))
+                              ;; forall('a,'b).({lab=(abs) 'a} 'b ->
{lab=(pre 'b) 'a})
+                              (:scheme (LIST T0 T1)
+                                       (arrow (rproduct (rlabel plabel
(rpre T1) T0))
+                                              (LIST
+                                               (rproduct (rlabel plabel
(rabs) T0))
+                                               T1)))
+                              )
+                         _ -> (prim-error name))