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

circular reference hangs getproperty_fallback #12

Merged
merged 2 commits into from
Jan 4, 2024

Conversation

t-bltg
Copy link
Contributor

@t-bltg t-bltg commented Dec 26, 2023

I have a complicated example where accessing a missing property of an object with nested circular references hangs indefinitely.

I narrowed this down to

error("unknown property '$name' for object '$self'")

One solution would be to limit the repr output:

function getproperty_fallback(self::T, name) where T
    rself = repr(self; context = (:limit => true, :compact => true))
    error("unknown property '$name' for object '$rself' of type '$T'")
end

Another would be to avoid displaying the object in the error message, and only display the type:

function getproperty_fallback(_::T, name) where T
    error("unknown property '$name' for object of type '$T'")
end

Unfortunately I couldn't come up with a reduced mwe for adding a regression test in CI, or as a simple reproducer.

@t-bltg t-bltg changed the title circular reference on missing property circular reference hangs getproperty_fallback Dec 26, 2023
@thautwarm
Copy link
Member

Thanks for your PR. The limit repr seems not a solid solution.
Only showing type in the error looks fine to me, consider this:

julia> struct S
       end

julia> S().a
ERROR: type S has no field a

@thautwarm thautwarm merged commit 80c1049 into Suzhou-Tongyuan:main Jan 4, 2024
2 of 4 checks passed
@t-bltg t-bltg deleted the circ-ref branch January 5, 2024 21:20
@t-bltg
Copy link
Contributor Author

t-bltg commented Jan 5, 2024

Thanks for merging !

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