From 78abdc318184b3e7999ceb2186d9bb5b9b020e92 Mon Sep 17 00:00:00 2001 From: kalmarek Date: Mon, 30 Jul 2018 14:07:42 +0200 Subject: [PATCH] fix elem_types: they dispatch on TYPE of parent --- src/DirectProducts.jl | 4 ++-- src/FreeGroup.jl | 7 +++---- src/WreathProducts.jl | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/DirectProducts.jl b/src/DirectProducts.jl index d6d5a11..c833daa 100644 --- a/src/DirectProducts.jl +++ b/src/DirectProducts.jl @@ -102,8 +102,8 @@ end # ############################################################################### -elem_type(G::DirectProductGroup{T}) where {T} = - DirectProductGroupElem{elem_type(G.group)} +elem_type(::Type{DirectProductGroup{T}}) where {T} = + DirectProductGroupElem{elem_type(T)} parent_type(::Type{DirectProductGroupElem{T}}) where {T} = DirectProductGroup{parent_type(T)} diff --git a/src/FreeGroup.jl b/src/FreeGroup.jl index ef8f911..c502cf3 100644 --- a/src/FreeGroup.jl +++ b/src/FreeGroup.jl @@ -13,8 +13,7 @@ FreeGroupElem = GroupWord{FreeSymbol} mutable struct FreeGroup <: AbstractFPGroup gens::Vector{FreeSymbol} - # order::Vector{T} - # fastmult_table::Array{Int,2} + function FreeGroup{T<:GSymbol}(gens::Vector{T}) G = new(gens) G.gens = gens @@ -30,9 +29,9 @@ export FreeGroupElem, FreeGroup # ############################################################################### -parent_type(::Type{FreeGroupElem}) = FreeGroup +elem_type(::Type{FreeGroup}) = FreeGroupElem -elem_type(::FreeGroup) = FreeGroupElem +parent_type(::Type{FreeGroupElem}) = FreeGroup ############################################################################### # diff --git a/src/WreathProducts.jl b/src/WreathProducts.jl index 5232446..08ed9ad 100644 --- a/src/WreathProducts.jl +++ b/src/WreathProducts.jl @@ -49,7 +49,7 @@ end # ############################################################################### -elem_type(::WreathProduct{T, I}) where {T, I} = WreathProductElem{elem_type(T), I} +elem_type(::Type{WreathProduct{T, I}}) where {T, I} = WreathProductElem{elem_type(T), I} parent_type(::Type{WreathProductElem{T, I}}) where {T, I} = WreathProduct{parent_type(T), I}