Skip to content

Commit 9eb80c1

Browse files
committed
Avoid extending Type from Base on Julia 1.12
For some reason, the internal Flatbuf module defines a function called `Type`. On Julia 1.12, defining a new function by defining methods is insufficient to distinguish it from defining new constructor methods for a visible type of the same name. It's now necessary to forward-declare the function to ensure it takes precedence over the other visible binding. Without doing so, `Base.Type` is extended in Flatbuf instead.
1 parent 059f31d commit 9eb80c1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/metadata/Schema.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,11 @@ Base.propertynames(x::LargeListView) = ()
486486
largeListViewStart(b::FlatBuffers.Builder) = FlatBuffers.startobject!(b, 0)
487487
largeListViewEnd(b::FlatBuffers.Builder) = FlatBuffers.endobject!(b)
488488

489+
# Ensure this binding is distinct from `Base.Type` by forward-declaring it. Otherwise, in
490+
# Julia 1.12, defining a function called `Type` by simply defining methods ends up actually
491+
# defining methods for `Base.Type`.
492+
function Type end
493+
489494
function Type(b::UInt8)
490495
b == 1 && return Null
491496
b == 2 && return Int

0 commit comments

Comments
 (0)