Skip to content

Conversation

@MasonProtter
Copy link
Contributor

This should address the # TODO item in #57550.

Unconditionally indexing DataTypeFieldDesc(dt::DataType)[fidx] will error when dt has no layout because we define

struct DataTypeFieldDesc
    dt::DataType
    function DataTypeFieldDesc(dt::DataType)
        dt.layout == C_NULL && throw(UndefRefError())
        new(dt)
    end
end

For all the DataTypes I could find, they only had dt.layout == C_NULL if !isconcretetype(dt), so maybe it would be preferable to check if they're !isconcretetype rather than checking if dt.layout == C_NULL, but I figured it'd be safer to just mimic the validation logic in DataTypeFieldDesc instead.

aviatesk and others added 2 commits November 23, 2025 16:09
The previous implementation using `is_undefref_field` was flawed.
We can now implement a more robust check with `DataTypeFieldDesc`.
@MasonProtter MasonProtter changed the title Finish inference: fix the ptrfree field check Finish PR: inference: fix the ptrfree field check Nov 23, 2025
Co-authored-by: James Wrigley <JamesWrigley@users.noreply.github.com>
Copy link
Member

@aviatesk aviatesk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@aviatesk aviatesk merged commit da57d86 into JuliaLang:master Nov 24, 2025
8 checks passed
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.

4 participants