Skip to content

Commit

Permalink
added @nospecialize on some functions
Browse files Browse the repository at this point in the history
  • Loading branch information
longemen3000 committed Oct 25, 2020
1 parent 741efd4 commit f261288
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ end
==#

function Base.show(io::IO, ::MIME"text/plain", sp::ThermodynamicState)
@nospecialize sp
lcall = length(sp.callables)
lsp = length(sp.specs)
subscripts = '':''
Expand Down
8 changes: 6 additions & 2 deletions src/state_type.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ _stateorder(x::VariableSpec) = 10006


function _static_specs(x::Type{ThermodynamicState{S,C}}) where {S,C}
@nospecialize S,C
tvec = S.parameters
res1 = [tvec[i].parameters[1]() for i in 1:length(tvec)]
if C === Tuple{}
Expand All @@ -71,6 +72,7 @@ function _static_specs(x::Type{ThermodynamicState{S,C}}) where {S,C}
end

function _static_specs_types(x::Type{ThermodynamicState{S,C}}) where {M,C,S}
@nospecialize S,C
tvec = S.parameters
res1 = [tvec[i].parameters[1] for i in 1:length(tvec)]
if C === Tuple{}
Expand All @@ -96,7 +98,8 @@ end
end


function _state_from_type(x::Type{ThermodynamicState{S,C}}) where {S,C}
function _state_from_type(x::T) where T<: ThermodynamicState
@nospecialize x
state_specs = _static_specs(x)
has_compound = false
for spec in state_specs
Expand Down Expand Up @@ -125,7 +128,8 @@ function _state_from_type(x::Type{ThermodynamicState{S,C}}) where {S,C}
res = (sorted_specs[1],sorted_specs[2],comp_spec)
end

function _static_get_spec_idx(x::Type{ThermodynamicState{S,C}},sp::Type{S2})::Int where {S,C,S2}
function _static_get_spec_idx(@nospecialize(x::Type{ThermodynamicState{S,C}}),@nospecialize(sp::Type{S2}))::Int where {S,C,S2}
@nospecialize S,C,S2
state_specs = _static_specs(x)
for (i,spec) in pairs(state_specs)
if spec isa sp
Expand Down

0 comments on commit f261288

Please sign in to comment.