Support prefabs for unsafe-struct-ref

This commit is contained in:
Asumu Takikawa 2015-02-01 17:00:24 -05:00
parent 5d708ab53f
commit 8e6710438f
2 changed files with 5 additions and 0 deletions

View File

@ -81,6 +81,8 @@
(match (single-value #'struct)
[(tc-result1: (and struct-t (app resolve (Struct: _ _ (list (fld: flds _ _) ...) _ _ _))))
(tc/hetero-ref #'index flds struct-t "struct")]
[(tc-result1: (and struct-t (app resolve (Prefab: _ (list flds ...)))))
(tc/hetero-ref #'index flds struct-t "prefab struct")]
[s-ty (tc/app-regular #'form expected)]))
;; vector-ref on het vectors
(pattern (~and form ((~or vector-ref unsafe-vector-ref unsafe-vector*-ref) vec:expr index:expr))

View File

@ -34,3 +34,6 @@
(poly-x (poly "foo"))
(poly-x (poly 3))
(poly-x #s(poly "foo"))
;; Test match (indirectly tests unsafe-struct-ref)
(match (foo 'x) [(foo s) s])