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

Adjust to upcoming base Julia change #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/macro.jl
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ end

genstate(v::VarInfo) = begin
name = Meta.quot(v.name)
alias = Meta.quot(v.alias)
alias = Meta.quot(v.alias)
value = istag(v, :extern) ? genextern(v, gendefault(v)) : gendefault(v)
stargs = [:($(esc(k))=$v) for (k, v) in filterconstructortags(v)]
@q $C.$(v.state)(; _name=$name, _alias=$alias, _value=$value, $(stargs...))
Expand Down Expand Up @@ -459,9 +459,14 @@ genstruct(name, type, infos, consts, substs, incl, scope) = begin
system = quote
Core.@__doc__ abstract type $S <: $T end
$S(; kw...) = $_S(; kw...)
$C.typefor(::Type{<:$S}) = $_S
let $(constpatches...)
Core.@__doc__ mutable struct $_S <: $S
# HACK: We want to define `typefor` before the type is fully defined
# because it may be used in the `fields`. Because of the order that
# struct definitions happen to get evaluated in, type supertype definition
# is the only place where we have access to the incomplete $_S before evaluating
# the fields. The extra let is required to due a lowering bug
# (https://github.com/JuliaLang/julia/issues/56510).
Core.@__doc__ mutable struct $_S <: ((let $_S=$_S; ($C.typefor(::Type{<:$S}) = $_S); end); $S)
$(fields...)
function $_S(; __kwargs__...)
$predecl
Expand Down