thofma / Hecke.jl

Computational algebraic number theory
Other
236 stars 65 forks source link

Missing `hash` methods (or bad `==` methods) #1594

Open thofma opened 1 month ago

thofma commented 1 month ago

Before I forget. Here are the types with missing hash methods (or for which == should be removed). (Courtesy of @lgoettgens (https://github.com/oscar-system/Oscar.jl/issues/2222). Needs julia version 1.10.5:

list = map(
         filter(names(Hecke; all=true)) do name
           isdefined(Hecke, name) || return false            # remove all wrong exports (see #1964)
           T = getfield(Hecke, name)
           T isa DataType || T isa UnionAll || return false  # remove all non-types and non-parametric-types
           parentmodule(==, (T, T)) == Base && return false  # remove everything without custom ==
           loc = functionloc(==, (T, T))
           endswith(loc[1], "julia/base/Base.jl") && loc[2] == 165 && return false  # remove everything without custom ==
           parentmodule(hash, (T, UInt)) == Base             # keep iff there is no custom hash
         end,
       ) do name
         T = getfield(Hecke, name)
         loc = functionloc(==, (T, T))
         if occursin("Hecke.jl/", loc[1])
           loc_cleaned = loc[1][first(findlast("Hecke.jl/", loc[1])):end]
         elseif occursin("packages/", loc[1])
           loc_cleaned = loc[1][(first(findlast("packages/", loc[1])) + length("packages/")):end]
         elseif occursin("julia/base/", loc[1])
           loc_cleaned = loc[1][first(findlast("julia/base/", loc[1])):end]
         else
           loc_cleaned = loc[1]
         end
         name, parentmodule(T), (loc_cleaned, loc[2])
       end

This yields

 (:AbsAlgAssIdl, Hecke, ("/Users/thofma/software/Hecke2/src/AlgAss/Ideal.jl", 276))
 (:AbsNumFieldOrder, Hecke, ("/Users/thofma/software/Hecke2/src/NumFieldOrd/NfOrd/NfOrd.jl", 1160))
 (:AbsNumFieldOrderFractionalIdealSet, Hecke, ("/Users/thofma/software/Hecke2/src/NumFieldOrd/NfOrd/FracIdeal.jl", 197))
 (:AbsNumFieldOrderIdealSet, Hecke, ("/Users/thofma/software/Hecke2/src/NumFieldOrd/NfOrd/Ideal/Ideal.jl", 99))
 (:AbsNumFieldOrderSet, Hecke, ("/Users/thofma/software/Hecke2/src/NumFieldOrd/NfOrd/NfOrd.jl", 1179))
 (:AbsOrdQuoRing, Hecke, ("/Users/thofma/software/Hecke2/src/NumFieldOrd/NfOrd/ResidueRing.jl", 404))
 (:AbsSimpleNumFieldEmbedding, Hecke, ("/Users/thofma/software/Hecke2/src/NumField/ComplexEmbeddings/NfAbs.jl", 66))
 (:AbsSimpleNumFieldOrder, Hecke, ("/Users/thofma/software/Hecke2/src/NumFieldOrd/NfOrd/NfOrd.jl", 1160))
 (:AbsSimpleNumFieldOrderQuoRing, Hecke, ("/Users/thofma/software/Hecke2/src/NumFieldOrd/NfOrd/ResidueRing.jl", 404))
 (:AcbFieldElem, Nemo, ("Nemo/u9kPx/src/arb/acb.jl", 340))
 (:AlgAssAbsOrd, Hecke, ("/Users/thofma/software/Hecke2/src/AlgAssAbsOrd/Order.jl", 550))
 (:AlgAssAbsOrdIdlSet, Hecke, ("/Users/thofma/software/Hecke2/src/AlgAssAbsOrd/Ideal.jl", 1492))
 (:AlgAssAbsOrdQuoRing, Hecke, ("/Users/thofma/software/Hecke2/src/NumFieldOrd/NfOrd/ResidueRing.jl", 404))
 (:AlgAssRelOrd, Hecke, ("/Users/thofma/software/Hecke2/src/AlgAssRelOrd/Order.jl", 371))
 (:AlgAssRelOrdElem, Hecke, ("AbstractAlgebra/tABFQ/src/NCRings.jl", 86))
 (:ArbFieldElem, Nemo, ("Nemo/u9kPx/src/arb/arb.jl", 365))
 (:CMType, Hecke, ("/Users/thofma/software/Hecke2/src/NumField/CM.jl", 60))
 (:ClassField, Hecke, ("/Users/thofma/software/Hecke2/src/RCF/class_fields.jl", 240))
 (:ComplexFieldElem, Nemo, ("Nemo/u9kPx/src/arb/Complex.jl", 336))
 (:Divisor, Hecke, ("/Users/thofma/software/Hecke2/src/FunField/Divisor.jl", 225))
 (:EllCrvIso, Hecke, ("/Users/thofma/software/Hecke2/src/EllCrv/Isomorphisms.jl", 605))
 (:EllipticCurve, Hecke, ("/Users/thofma/software/Hecke2/src/EllCrv/EllCrv.jl", 401))
 (:FakeAbsOrdQuoRingElem, Hecke, ("/Users/thofma/software/Hecke2/src/AlgAssAbsOrd/FakeAbsOrdQuoRing.jl", 76))
 (:FinGenAbGroupHom, Hecke, ("/Users/thofma/software/Hecke2/src/GrpAb/Map.jl", 245))
 (:FunFldDiff, Hecke, ("/Users/thofma/software/Hecke2/src/FunField/Differential.jl", 78))
 (:GenOrdFracIdl, Hecke, ("/Users/thofma/software/Hecke2/src/GenOrd/FractionalIdeal.jl", 272))
 (:KodairaSymbol, Hecke, ("/Users/thofma/software/Hecke2/src/EllCrv/LocalData.jl", 849))
 (:Line, Hecke, ("/Users/thofma/software/Hecke2/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl", 90))
 (:LocElem, AbstractAlgebra.Generic, ("AbstractAlgebra/tABFQ/src/NCRings.jl", 86))
 (:LocalQuadSpaceCls, Hecke, ("/Users/thofma/software/Hecke2/src/QuadForm/Quad/Spaces.jl", 2144))
 (:LocalizedEuclideanRingElem, AbstractAlgebra.Generic, ("AbstractAlgebra/tABFQ/src/NCRings.jl", 86))
 (:MapParent, Hecke, ("/Users/thofma/software/Hecke2/src/GrpAb/Map.jl", 569))
 (:OrdLocElem, Hecke, ("AbstractAlgebra/tABFQ/src/NCRings.jl", 86))
 (:Polygon, Hecke, ("/Users/thofma/software/Hecke2/src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl", 94))
 (:QmodnZ, Hecke, ("/Users/thofma/software/Hecke2/src/GrpAb/Dual.jl", 143))
 (:QuadBin, Hecke, ("/Users/thofma/software/Hecke2/src/QuadForm/QuadBin.jl", 291))
 (:QuadSpaceCls, Hecke, ("/Users/thofma/software/Hecke2/src/QuadForm/Quad/Spaces.jl", 2340))
 (:RCFCharacter, Hecke, ("/Users/thofma/software/Hecke2/src/RCF/rcf_stark.jl", 23))
 (:RealFieldElem, Nemo, ("Nemo/u9kPx/src/arb/Real.jl", 345))
 (:RealNumberFieldElem, Hecke, ("/Users/thofma/software/Hecke2/src/Misc/RealNumberField.jl", 92))
 (:RelFinFieldElem, Hecke, ("AbstractAlgebra/tABFQ/src/NCRings.jl", 86))
 (:RelNumFieldOrder, Hecke, ("/Users/thofma/software/Hecke2/src/NumFieldOrd/NfRelOrd/NfRelOrd.jl", 622))
 (:RelOrdQuoRing, Hecke, ("/Users/thofma/software/Hecke2/src/NumFieldOrd/NfRelOrd/ResidueRing.jl", 221))
 (:RelSimpleNumFieldEmbedding, Hecke, ("/Users/thofma/software/Hecke2/src/NumField/ComplexEmbeddings/NfRel.jl", 61))
 (:ZZFracIdl, Hecke, ("/Users/thofma/software/Hecke2/src/NumField/QQ.jl", 96))
 (:acb, Nemo, ("Nemo/u9kPx/src/arb/acb.jl", 340))
 (:arb, Nemo, ("Nemo/u9kPx/src/arb/arb.jl", 365))
 (:nf_elem_mod, Hecke, ("AbstractAlgebra/tABFQ/src/NCRings.jl", 86))
lgoettgens commented 1 month ago

The above code is dependent on a specific julia version. E.g. for julia 1.10.5, you need to replace loc[2] == 127 by loc[2] == 165.

thofma commented 1 month ago

Thanks