Fix bug exposed by previous commit

This commit is contained in:
Tony Garnock-Jones 2018-10-20 19:09:25 +01:00
parent 8ff6dc5ff8
commit 6e06c4d502
3 changed files with 28 additions and 2 deletions

View File

@ -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

View File

@ -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)

View File

@ -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