Skip to content

Commit f3c890f

Browse files
authored
Fix missing subsumes methods for different lens types (#145)
1 parent ae5e987 commit f3c890f

4 files changed

Lines changed: 11 additions & 1 deletion

File tree

HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.13.4
2+
3+
Added missing methods for `subsumes(::IndexLens, ::PropertyLens)` and vice versa.
4+
15
## 0.13.3
26

37
Bumped compatibility for JSON.jl to include v1.

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ uuid = "7a57a42e-76ec-4ea3-a279-07e840d6d9cf"
33
keywords = ["probablistic programming"]
44
license = "MIT"
55
desc = "Common interfaces for probabilistic programming"
6-
version = "0.13.3"
6+
version = "0.13.4"
77

88
[deps]
99
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"

src/varname/subsumes.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ subsumes(t::PropertyLens{name}, u::PropertyLens{name}) where {name} = true
103103
# Otherwise they represent different properties, and thus are not the same.
104104
subsumes(t::PropertyLens, u::PropertyLens) = false
105105

106+
# PropertyLens and IndexLens can't subsume each other
107+
subsumes(::PropertyLens, ::IndexLens) = false
108+
subsumes(::IndexLens, ::PropertyLens) = false
109+
106110
# Indices subsumes if they are subindices, i.e. we just call `_issubindex`.
107111
# FIXME: Does not support `DynamicIndexLens`.
108112
# FIXME: Does not correctly handle cases such as `subsumes(x, x[:])`

test/varname.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ end
126126
@test @varname(x) @varname(y)
127127
@test @varname(x.a) @varname(y.a)
128128
@test @varname(a.x) @varname(a.y)
129+
@test @varname(a.x[1]) @varname(a.x.z)
129130
@test @varname(x[1]) @varname(y[1])
131+
@test @varname(x[1]) @varname(x.y)
130132

131133
# x ∘ ℓ ⊑ x
132134
@test_strict_subsumption x.a x

0 commit comments

Comments
 (0)