Skip to content

Commit

Permalink
Fix LittleSet constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
Tokazama committed Jan 20, 2025
1 parent ccf7637 commit ee2d90d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/little_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ struct LittleSet{T, D<:StoreType{T}} <: AbstractSet{T}
data::D

LittleSet{T, D}(data) where {T,D} = new{T, D}(data)
function OpaqueLittleSet{T}(@nospecialize(data)) where {T}
function LittleSet{T, Tuple{Vararg{T}}}(@nospecialize(data)) where {T}
new_data = isa(data, Tuple) ? data : Tuple(data)
new{T, Tuple{Vararg{T}}}(new_data)
end
function OpaquetleSet(@nospecialize(data))
T = eltype(data)
new{T, Tuple{Vararg{T}}}(data)
function (LittleSet{T, Tuple{Vararg{T}}} where {T})(@nospecialize(data))
T2 = eltype(data)
new{T2, Tuple{Vararg{T2}}}(data)
end
function LittleSet{T}(data::AbstractVector) where {T}
if eltype(data) == T
Expand Down Expand Up @@ -45,7 +45,7 @@ struct LittleSet{T, D<:StoreType{T}} <: AbstractSet{T}
end

function Base.empty(s::LittleSet{T, D}) where {T, D}
if isa(s, OpaqueLittleSet)
if isa(s, LittleSet{T, Tuple{Vararg{T}}})
return new{T, Tuple{Vararg{T}}}(())
elseif D <: Tuple
return new{T, Tuple{}}(())
Expand All @@ -63,9 +63,9 @@ struct LittleSet{T, D<:StoreType{T}} <: AbstractSet{T}
end
end

const OpaqueLittleSet{T} = LittleSet{T, Tuple{Vararg{T}}}
const UnfrozenLittleSet{T} = LittleSet{T, <:AbstractVector{T}}
const FrozenLittleSet{T} = LittleSet{T, <:Tuple}
const OpaqueLittleSet{T} = LittleSet{T, Tuple{Vararg{T}}}

function Base.Tuple(s::LittleSet)
data = getfield(s, :data)
Expand Down

0 comments on commit ee2d90d

Please sign in to comment.