Skip to content

Fix dot head #19

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

Merged
merged 1 commit into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/ComputedFieldTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ with a dummy type-variable
"""
getenv!(@nospecialize(e), tvars, def) = e
function getenv!(e::Expr, tvars, def)
if e.head === :curly || e.head === :where
if e.head === :curly || e.head === :where || e.head === :.
for i = 1:length(e.args)
e.args[i] = getenv!(e.args[i], tvars, def)
end
Expand Down
12 changes: 10 additions & 2 deletions test/inheritance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ end
x::Base.promote_op(+, Int, Float64)
end

struct Foo{T} x::T end

@computed struct ParametricRef{T}
x::Base.RefValue{Foo{T}}
ParametricRef(x::Foo{T}) where T = new{T}(Ref(x))
end

@testset "inheritance" begin
@test isa(@inferred(Parametric{Int}(1)), Parametric{Int, Float64})
@test isa(Parametric{Int}(1), Bar)
Expand All @@ -26,7 +33,8 @@ end

@test isa(@inferred(NonParametricNoParent(1)), NonParametricNoParent{Float64})
@test !isa(NonParametricNoParent(1), Bar)

@test isa(@inferred(ParametricRef(Foo(1.0))), ParametricRef{Float64})
@test isa(ParametricRef(Foo(1)).x[], Foo{Int})
end
end