Skip to content

Commit

Permalink
Fix bug in decoration site tree construction when impl prod signature…
Browse files Browse the repository at this point in the history
… names don't match the dispatch signature
  • Loading branch information
krame505 committed Sep 27, 2024
1 parent 70fec54 commit 309a4ad
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions grammars/silver/compiler/definition/flow/env/DecSites.sv
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,20 @@ DecSiteTree ::= prodName::String vt::VertexType seen::[(String, VertexType)] flo
forwardDec(prodName, just(fName))
-- Via projected remote equation
| subtermVertexType(_, prodOrSig, sigName) ->
foldAllDecSite(
map(recurse(_, rhsVertexType(sigName)),
if !null(getValueDcl(prodOrSig, realEnv))
then [prodOrSig]
else getImplementingProds(prodOrSig, flowEnv)))
if !null(getValueDcl(prodOrSig, realEnv))
-- Projected from a production
then recurse(prodOrSig, rhsVertexType(sigName))
-- Projected from a dispatch signature
else foldAllDecSite(map(
\ prod ->
case getTypeDcl(prodOrSig, realEnv), getValueDcl(prod, realEnv) of
| sigDcl :: _, prodDcl :: _
when drop(positionOf(sigName, sigDcl.dispatchSignature.inputNames), prodDcl.namedSignature.inputNames)
matches sn :: _ ->
recurse(prod, rhsVertexType(sn))
| _, _ -> neverDec()
end,
getImplementingProds(prodOrSig, flowEnv)))
-- Via signature/dispatch sharing
| rhsVertexType(sigName) when lookupSignatureInputElem(sigName, ns).elementShared ->
foldAllDecSite(unzipWith(recurse,
Expand Down

0 comments on commit 309a4ad

Please sign in to comment.