Skip to content

Commit 3691cbf

Browse files
authored
Merge pull request #731 from JuliaRobotics/bugfix/21Q1/fixesforj1.6beta
Bugfixes for julia 1.6.0-beta1
2 parents a6451e3 + 90ebf0c commit 3691cbf

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

src/services/AbstractDFG.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ end
632632

633633
function ls(dfg::G, ::Type{T}) where {G <: AbstractDFG, T <: FunctorInferenceType}
634634
xx = getFactors(dfg)
635-
names = getfield.(typeof.(getFactorType.(xx)), :name) .|> Symbol
635+
names = typeof.(getFactorType.(xx)) .|> nameof
636636
vxx = view(xx, names .== Symbol(T))
637637
map(x->x.label, vxx)
638638
end
@@ -694,7 +694,7 @@ function lsWho(dfg::AbstractDFG, type::Symbol)
694694
vars = getVariables(dfg)
695695
labels = Symbol[]
696696
for v in vars
697-
varType = typeof(getVariableType(v)).name |> Symbol
697+
varType = typeof(getVariableType(v)) |> nameof
698698
varType == type && push!(labels, v.label)
699699
end
700700
return labels
@@ -721,7 +721,7 @@ function lsfWho(dfg::AbstractDFG, type::Symbol)
721721
facs = getFactors(dfg)
722722
labels = Symbol[]
723723
for f in facs
724-
facType = typeof(getFactorType(f)).name |> Symbol
724+
facType = typeof(getFactorType(f)) |> nameof
725725
facType == type && push!(labels, f.label)
726726
end
727727
return labels
@@ -740,7 +740,7 @@ function lsTypes(dfg::AbstractDFG)
740740
vars = getVariables(dfg)
741741
alltypes = Set{Symbol}()
742742
for v in vars
743-
varType = typeof(getVariableType(v)).name |> Symbol
743+
varType = typeof(getVariableType(v)) |> nameof
744744
push!(alltypes, varType)
745745
end
746746
return collect(alltypes)
@@ -756,7 +756,7 @@ function lsTypesDict(dfg::AbstractDFG)
756756
vars = getVariables(dfg)
757757
alltypes = Dict{Symbol,Vector{Symbol}}()
758758
for v in vars
759-
varType = typeof(getVariableType(v)).name |> Symbol
759+
varType = typeof(getVariableType(v)) |> nameof
760760
d = get!(alltypes, varType, Symbol[])
761761
push!(d, v.label)
762762
end
@@ -772,7 +772,7 @@ function lsfTypes(dfg::AbstractDFG)
772772
facs = getFactors(dfg)
773773
alltypes = Set{Symbol}()
774774
for f in facs
775-
facType = typeof(getFactorType(f)).name |> Symbol
775+
facType = typeof(getFactorType(f)) |> nameof
776776
push!(alltypes, facType)
777777
end
778778
return collect(alltypes)
@@ -787,7 +787,7 @@ function lsfTypesDict(dfg::AbstractDFG)
787787
facs = getFactors(dfg)
788788
alltypes = Dict{Symbol,Vector{Symbol}}()
789789
for f in facs
790-
facType = typeof(getFactorType(f)).name |> Symbol
790+
facType = typeof(getFactorType(f)) |> nameof
791791
d = get!(alltypes, facType, Symbol[])
792792
push!(d, f.label)
793793
end
@@ -1099,7 +1099,7 @@ Related
10991099
function isPathFactorsHomogeneous(dfg::AbstractDFG, from::Symbol, to::Symbol)
11001100
# FIXME, must consider all paths, not just shortest...
11011101
pth = intersect(findShortestPathDijkstra(dfg, from, to), lsf(dfg))
1102-
types = getFactorType.(dfg, pth) .|> typeof .|> x->(x).name
1102+
types = getFactorType.(dfg, pth) .|> typeof .|> nameof
11031103
utyp = unique(types)
11041104
(length(utyp) == 1), utyp
11051105
end

test/interfaceTests.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ end
6363
@test printFactor(fac1) === nothing
6464

6565
@test printVariable(iobuf, var1, skipfields=[:timestamp, :solver, :ppe, :nstime]) === nothing
66-
@test String(take!(iobuf)) == "DFGVariable{TestVariableType1}\nlabel:\n:a\ntags:\nSet([:VARIABLE, :POSE])\nsmallData:\nDict{Symbol,Union{Bool, Float64, Int64, Array{Bool,1}, Array{Float64,1}, Array{Int64,1}, Array{String,1}, String}}(:small=>\"data\")\ndataDict:\nDict{Symbol,AbstractDataEntry}()\nsolvable:\n0\n"
66+
67+
if VERSION < v"1.6.0-beta1"
68+
# for julia < v1.6
69+
@test String(take!(iobuf)) == "DFGVariable{TestVariableType1}\nlabel:\n:a\ntags:\nSet([:VARIABLE, :POSE])\nsmallData:\nDict{Symbol,Union{Bool, Float64, Int64, Array{Bool,1}, Array{Float64,1}, Array{Int64,1}, Array{String,1}, String}}(:small=>\"data\")\ndataDict:\nDict{Symbol,AbstractDataEntry}()\nsolvable:\n0\n"
70+
else
71+
# for julia v1.6
72+
@test String(take!(iobuf)) == "DFGVariable{TestVariableType1}\nlabel:\n:a\ntags:\nSet([:VARIABLE, :POSE])\nsmallData:\nDict{Symbol, Union{Bool, Float64, Int64, Vector{Bool}, Vector{Float64}, Vector{Int64}, Vector{String}, String}}(:small=>\"data\")\ndataDict:\nDict{Symbol, AbstractDataEntry}()\nsolvable:\n0\n"
73+
end
6774

6875
@test printVariable(iobuf, var1, short=true) === nothing
6976
varstr = String(take!(iobuf))

test/testBlocks.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,8 +1409,8 @@ function ProducingDotFiles(testDFGAPI,
14091409
#NOTE hardcoded toDot will have different results so test LightGraphs seperately
14101410
if testDFGAPI <: LightDFG || testDFGAPI <: CloudGraphsDFG
14111411
todotstr = toDot(dotdfg)
1412-
todota = todotstr == "graph G {\na [color=red, shape=ellipse];\nb [color=red, shape=ellipse];\nabf1 [color=blue, shape=box];\na -- abf1\nb -- abf1\n}\n"
1413-
todotb = todotstr == "graph G {\na [color=red, shape=ellipse];\nb [color=red, shape=ellipse];\nabf1 [color=blue, shape=box];\nb -- abf1\na -- abf1\n}\n"
1412+
todota = todotstr == "graph G {\na [color=red, shape=ellipse];\nb [color=red, shape=ellipse];\nabf1 [color=blue, shape=box, fontsize=8, fixedsize=false, height=0.1, width=0.1];\na -- abf1\nb -- abf1\n}\n"
1413+
todotb = todotstr == "graph G {\na [color=red, shape=ellipse];\nb [color=red, shape=ellipse];\nabf1 [color=blue, shape=box, fontsize=8, fixedsize=false, height=0.1, width=0.1];\nb -- abf1\na -- abf1\n}\n"
14141414
@test (todota || todotb)
14151415
else
14161416
@test toDot(dotdfg) == "graph graphname {\n2 [\"label\"=\"b\",\"shape\"=\"ellipse\",\"fillcolor\"=\"red\",\"color\"=\"red\"]\n2 -- 3\n3 [\"label\"=\"abf1\",\"shape\"=\"box\",\"fillcolor\"=\"blue\",\"color\"=\"blue\"]\n1 [\"label\"=\"a\",\"shape\"=\"ellipse\",\"fillcolor\"=\"red\",\"color\"=\"red\"]\n1 -- 3\n}\n"

0 commit comments

Comments
 (0)