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

Fix dot head #19

Merged
merged 1 commit into from
Jan 5, 2022
Merged

Fix dot head #19

merged 1 commit into from
Jan 5, 2022

Conversation

t-bltg
Copy link
Contributor

@t-bltg t-bltg commented Dec 31, 2021

While working on this example (to bypass JuliaLang/julia#18466), I encountered an issue using Base.RefValue:

using ComputedFieldTypes
import Base: RefValue

@computed struct Foo{T <: AbstractFloat, N}
  a::Array{T, N}
  b::Array{T, N + 1}
  Foo(a::Array{T, N}) where {T, N} = new{T, N}(a, zeros((2, size(a)...)))
end

struct Bar{T <: AbstractFloat, N}
  # r::RefValue{Foo{T, N}}  # obviously fails, but should it ? (fixed by ComputedFieldTypes.jl/pull/20)
  r::RefValue{Foo{T, N, 3}}  # works, but what's the point of using @computed then ? 
  Bar(r::Foo{T, N}) where {T, N} = new{T, N}(Ref(r))
end

@computed struct Baz{T <: AbstractFloat, N}
  r::Base.RefValue{Foo{T, N, N + 1}}  # <==== fails without this PR
  Baz(r::Foo{T, N}) where {T, N} = new{T, N}(Ref(r))
end

main() = begin
  foo = Foo([0. 1.])
  Bar(foo)
  Baz(foo)
  return
end

main()

@t-bltg t-bltg mentioned this pull request Dec 31, 2021
@vtjnash vtjnash merged commit cb65e56 into vtjnash:master Jan 5, 2022
@t-bltg t-bltg deleted the ref branch January 5, 2022 18:16
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.

2 participants