-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fails to build on 1.6: type piracy? #24
Comments
I guess it could be written as |
In case someone asks: julia> using SnoopCompileCore
julia> abstract type AbstractNode{T} end
julia> invs = @snoopr Base.getindex(node::Type{<:AbstractNode}, xs::Any...) = node(xs...);
julia> using SnoopCompile
julia> length(uinvalidated(invs))
358 All the invalidated methods are callers of |
Hmm, tests pass just fine with diff --git a/src/Hyperscript.jl b/src/Hyperscript.jl
index 10ca312..8608159 100644
--- a/src/Hyperscript.jl
+++ b/src/Hyperscript.jl
@@ -114,7 +114,8 @@ function Base.typed_hvcat(node::AbstractNode, rows::Tuple{Vararg{Int64}}, xs::An
end
Base.typed_hcat(node::AbstractNode, xs::Any...) = node(xs...)
Base.typed_vcat(node::AbstractNode, xs::Any...) = node(xs...)
-Base.getindex(node::Union{AbstractNode, Type{<:AbstractNode}}, xs::Any...) = node(xs...)
+Base.getindex(node::AbstractNode, xs::Any...) = node(xs...)
+# Base.getindex(node::Union{AbstractNode, Type{<:AbstractNode}}, xs::Any...) = node(xs...)
function Base.:(==)(x::Node, y::Node)
context(x) == context(y) && tag(x) == tag(y) && |
This change should fix issue #24. The original idea was to make using Hyperscript more concise, so one leave out commas between arguments when constructing nodes.
@yurivish does anything speak against tagging a new version with your fix? |
Meanwhile I think this can be closed. Thanks @yurivish, sorry I didn't notice the fix when it came in. |
@SimonDanisch Not at all, feel free to tag a new version! |
Hyperscript doesn't build on nightly. The reason is https://github.com/yurivish/Hyperscript.jl/blob/7731aecafd06e9366020ebee0d6674527fe3d7d6/src/Hyperscript.jl#L117
Here's why: 1.6 has a new TOML parser that includes this line. The issue is that
Union{} <: Hyperscript.AbstractNode
, becauseUnion{}
is a subtype of every other type, and hence instead of creating an array with eltypeUnion{}
it tries (during package loading!) to callUnion{}(xs...)
, which obviously fails. CC @KristofferC.I am pretty sure this method counts as type-piracy (even if you own
YourType
, you do not ownVector{YourType}
), so I guess the question is, can it be eliminated?The text was updated successfully, but these errors were encountered: