Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jl_egal_types: don't reject equivalence just for gensyms #39778

Merged
merged 1 commit into from
Feb 25, 2021

Conversation

timholy
Copy link
Sponsor Member

@timholy timholy commented Feb 21, 2021

This fixes the following:

julia> struct Symmetric{T,S<:AbstractMatrix{<:T}} <: AbstractMatrix{T}
           data::S
           uplo::Char
       end

julia> struct Symmetric{T,S<:AbstractMatrix{<:T}} <: AbstractMatrix{T}
           data::S
           uplo::Char
       end
ERROR: invalid redefinition of constant Symmetric

Core._equiv_typedef returns false which ends up triggering the error.

This is the main part of fixing timholy/Revise.jl#599.

@timholy
Copy link
Sponsor Member Author

timholy commented Feb 21, 2021

I'm not certain this is sufficiently safe, but a safer version would seem to require checking equivalent usage of different names...which seems like a lot of overhead for something that needs to be fast. But if others think this is necessary, please do offer a hint or two, I'm rusty on this code. (Presumably a list-of-pair substitutions would suffice, but there's quite a lot of overhead to that.)

test/core.jl Outdated Show resolved Hide resolved
@JeffBezanson
Copy link
Sponsor Member

I think the right way to do this is to have equiv_typedef call jl_types_egal instead of jl_egal, so egal doesn't need to lie.

This fixes the following:

```
julia> struct Symmetric{T,S<:AbstractMatrix{<:T}} <: AbstractMatrix{T}
           data::S
           uplo::Char
       end

julia> struct Symmetric{T,S<:AbstractMatrix{<:T}} <: AbstractMatrix{T}
           data::S
           uplo::Char
       end
ERROR: invalid redefinition of constant Symmetric
```

`Core._equiv_typedef` returns false which ends up triggering the error.
@timholy timholy added the backport 1.6 Change should be backported to release-1.6 label Feb 23, 2021
@JeffBezanson JeffBezanson merged commit 6968e47 into master Feb 25, 2021
@JeffBezanson JeffBezanson deleted the teh/egal_types_gensym branch February 25, 2021 17:07
KristofferC pushed a commit that referenced this pull request Mar 2, 2021
This fixes the following:

```
julia> struct Symmetric{T,S<:AbstractMatrix{<:T}} <: AbstractMatrix{T}
           data::S
           uplo::Char
       end

julia> struct Symmetric{T,S<:AbstractMatrix{<:T}} <: AbstractMatrix{T}
           data::S
           uplo::Char
       end
ERROR: invalid redefinition of constant Symmetric
```

`Core._equiv_typedef` returns false which ends up triggering the error.

(cherry picked from commit 6968e47)
@KristofferC KristofferC mentioned this pull request Mar 2, 2021
52 tasks
@KristofferC KristofferC removed the backport 1.6 Change should be backported to release-1.6 label Mar 14, 2021
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
…9778)

This fixes the following:

```
julia> struct Symmetric{T,S<:AbstractMatrix{<:T}} <: AbstractMatrix{T}
           data::S
           uplo::Char
       end

julia> struct Symmetric{T,S<:AbstractMatrix{<:T}} <: AbstractMatrix{T}
           data::S
           uplo::Char
       end
ERROR: invalid redefinition of constant Symmetric
```

`Core._equiv_typedef` returns false which ends up triggering the error.
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this pull request May 9, 2021
…9778)

This fixes the following:

```
julia> struct Symmetric{T,S<:AbstractMatrix{<:T}} <: AbstractMatrix{T}
           data::S
           uplo::Char
       end

julia> struct Symmetric{T,S<:AbstractMatrix{<:T}} <: AbstractMatrix{T}
           data::S
           uplo::Char
       end
ERROR: invalid redefinition of constant Symmetric
```

`Core._equiv_typedef` returns false which ends up triggering the error.
staticfloat pushed a commit that referenced this pull request Dec 23, 2022
This fixes the following:

```
julia> struct Symmetric{T,S<:AbstractMatrix{<:T}} <: AbstractMatrix{T}
           data::S
           uplo::Char
       end

julia> struct Symmetric{T,S<:AbstractMatrix{<:T}} <: AbstractMatrix{T}
           data::S
           uplo::Char
       end
ERROR: invalid redefinition of constant Symmetric
```

`Core._equiv_typedef` returns false which ends up triggering the error.

(cherry picked from commit 6968e47)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants