# " Warning: Replacing docs for ... " repeated

**URL:** https://discourse.julialang.org/t/warning-replacing-docs-for-repeated/132396
**Category:** New to Julia
**Tags:** question
**Created:** [September 15, 2025, 12:14pm UTC](https://discourse.julialang.org/t/warning-replacing-docs-for-repeated/132396 "2025-09-15T12:14:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![JJMerelo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jjmerelo/32/217998_2.png) [@JJMerelo](https://discourse.julialang.org/u/JJMerelo)
#### Post date: [September 15, 2025, 12:14pm UTC](https://discourse.julialang.org/t/warning-replacing-docs-for-repeated/132396/1 "2025-09-15T12:14:25Z")

</div>

Hi  
After introducing a test for a function, this one

```julia
"""
    mutation_operator(offspring, mutation_percentage)

Apply mutation to `offspring` based on `mutation_percentage`.
"""
function mutation_operator(offspring, mutation_percentage)
    mutated_offspring = Array{Float64,1}()
    genes_to_mutate = floor(Int, mutation_percentage * length(offspring) / 100)
    indexes_to_mutate = rand(1:length(offspring), genes_to_mutate)

    for (index, gene) in enumerate(offspring)
        if index in indexes_to_mutate
            new_gene = rand()
            push!(mutated_offspring, new_gene)
        else
            push!(mutated_offspring, gene)
        end
    end

    return mutated_offspring
end

```

And here’s the test

```julia
include("../../src/methods/evolution.jl")

using Test

@testset "create_new_individual" begin
    # Use higher mutation rate (50%) to ensure mutation happens with small chromosome size
    test_mutation_rate = 50

    parents = (
        Individual([1.0, 2.0], 0.5, ALPHA()),
        Individual([3.0, 4.0], 0.8, ALPHA())
    )

    offspring1, offspring2 = create_new_individual(parents, test_mutation_rate)

    # Test that function returns two offspring arrays
    @test typeof(offspring1) == Array{Float64,1}
    @test typeof(offspring2) == Array{Float64,1}
    @test length(offspring1) == 2
    @test length(offspring2) == 2

    # Test that offspring are different from each other
    @test offspring1 != offspring2

    # Test that offspring are different from original parents (crossover + mutation should change them)
    @test offspring1 != parents[1].chromosome || offspring1 != parents[2].chromosome
    @test offspring2 != parents[1].chromosome || offspring2 != parents[2].chromosome
end

```

I’m getting repeated errors of the kind:

```plaintext
┌ Warning: Replacing docs for `Main.BraveNewAlgorithm.mutation_operator :: Tuple{Any, Any}` in module `Main.BraveNewAlgorithm`
└ @ Base.Docs docs/Docs.jl:243
┌ Warning: Replacing docs for `Main.BraveNewAlgorithm.mutation_operator :: Tuple{Any, Any}` in module `Main.BraveNewAlgorithm`
└ @ Base.Docs docs/Docs.jl:243
┌ Warning: Replacing docs for `Main.BraveNewAlgorithm.mutation_operator :: Tuple{Any, Any}` in module `Main.BraveNewAlgorithm`
└ @ Base.Docs docs/Docs.jl:243
┌ Warning: Replacing docs for `Main.BraveNewAlgorithm.mutation_operator :: Tuple{Any, Any}` in module `Main.BraveNewAlgorithm`
└ @ Base.Docs docs/Docs.jl:243
┌ Warning: Replacing docs for `Main.BraveNewAlgorithm.mutation_operator :: Tuple{Any, Any}` in module `Main.BraveNewAlgorithm`
└ @ Base.Docs docs/Docs.jl:243

```

I have no idea why this is. There’s no other definition of the function, here’s the git grep:

```julia-auto
src/methods/evolution.jl: mutated_chromosome = mutation_operator(chromosome, config_parameters.mutation_rate[caste.name])
src/methods/evolution.jl: return mutation_operator(chromosome, config_parameters.mutation_rate[caste.name])
src/methods/evolution.jl: offspring1_mutated = mutation_operator(offspring1, mutation_rate)
src/methods/evolution.jl: offspring2_mutated = mutation_operator(offspring2, mutation_rate)
src/methods/local_search.jl: mutated_offspring = mutation_operator(final_chromosome, population_model.config_parameters.mutation_rate[caste.name])
src/operators/mutation.jl: mutation_operator(offspring, mutation_percentage)
src/operators/mutation.jl:function mutation_operator(offspring, mutation_percentage)
test/operators/mutation_test.jl:mutated_chromosomes = [mutation_operator(embryo.chromosome, config_parameters_entity.mutation_rate["ALPHA"]) for embryo in embryos]
test/operators/mutation_test.jl:@testset "Test mutation_operator when called then different chromosome returned" begin
test/operators/mutation_test.jl:# @testset "Test mutation_operator when called then different chromosomes returned" begin
test/operators/mutation_test.jl:# mutated_offspring = mutation_operator(offspring, config_parameters_entity.mutation_rate["ALPHA"])

```

There’s a single definition of the function. Although there’s no error, I feel I’m missing something important here so I’d like to know. Please notice that the “redefinition” warning does not correspond to the actual signature of the function that’s defined.

---

<div class="post-metadata">

### Author: ![mxhbl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mxhbl/32/211886_2.png) [@mxhbl](https://discourse.julialang.org/u/mxhbl)
#### Post date: [September 15, 2025, 2:29pm UTC](https://discourse.julialang.org/t/warning-replacing-docs-for-repeated/132396/2 "2025-09-15T14:29:25Z")

</div>

Hi,

maybe I am missing it, but I cannot see where in your test your function is actually being called, so it is a bit hard to tell.

Maybe the reason for the redefinition is the `include` statement at the top of the test? Is there a reason you are directly `include`ing your source file instead of simply `using` the module being tested?

---

<div class="post-metadata">

### Author: ![JJMerelo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jjmerelo/32/217998_2.png) [@JJMerelo](https://discourse.julialang.org/u/JJMerelo)
#### Post date: [September 15, 2025, 3:13pm UTC](https://discourse.julialang.org/t/warning-replacing-docs-for-repeated/132396/3 "2025-09-15T15:13:54Z")

</div>

It’s been called from within create\_new\_individual.  
The reason is that it does not work without that include. I know, I have no idea. Suggestions are welcome.
