Browse Source

Fix bug exposed by previous commit

fruit
Tony Garnock-Jones 4 years ago
parent
commit
6e06c4d502
  1. 2
      syndicate/HOWITWORKS.md
  2. 2
      syndicate/skeleton.rkt
  3. 26
      syndicate/test/core/complex-pattern.rkt

2
syndicate/HOWITWORKS.md

@ -295,7 +295,7 @@ cases where handlers are dynamically installed. @@ -295,7 +295,7 @@ cases where handlers are dynamically installed.
classof (project v h) = class }
edges[selector][class] := ((innercache, {}), {})
let node' = edges[selector][class]
let h' = update-path h n_pop 0
let h' = update-path h 0 0
walk-edge h' node' 0 0 [s_0, ..., s_i]
update-path :: H -> 𝐍 -> 𝐍 -> H

2
syndicate/skeleton.rkt

@ -212,7 +212,7 @@ @@ -212,7 +212,7 @@
(hash-set! filtered a #t))))
(make-empty-skeleton/cache filtered))
(define next (hash-ref! table class make-skeleton-node-with-cache))
(walk-edge! (update-path path pop-count 0) next 0 0 pieces)]
(walk-edge! (update-path path 0 0) next 0 0 pieces)]
[_
(values pop-count sk)]))
(define (walk-edge! path sk pop-count index pieces)

26
syndicate/test/core/complex-pattern.rkt

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
#lang imperative-syndicate/test-implementation
(test-case
[(message-struct b (v))
(message-struct c (v))
(spawn #:name 'respondent
(on (asserted ($ val (list _ (vector _) (b (c _)) (vector _) _)))
;; ^ exercises a corner-case in `extend-skeleton!`
;; that exposed why `(update-path path pop-count 0)`
;; was wrong, and `(update-path path 0 0)` was right.
(send! 'ok)))]
no-crashes)
;;
;; Trie steps:
;;
;; ·
;; - () must be list/5
;; pop 0, get 1
;; - (1) must be vector/1
;; pop 1, get 2
;; - (2) must be b/1
;; pop 0, get 0
;; - (2 0) must be c/1
;; pop 2, get 3
;; - (3) must be vector/1
Loading…
Cancel
Save