-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Internal errors caused by broken Varargs #51228
Comments
A similar case: f(x=whatever...) = 1
f(x::T, y::Vararg{1}) where {T} = 2
f()
|
It does not seem necessary to allow this, though it does lead to this printing issue to disallow it: julia> Tuple{1, 1, 1, 1} NTuple{4, 1} Fix #51228
It does not seem necessary to allow this, though it does lead to this printing issue to disallow it: julia> Tuple{1, 1, 1, 1} NTuple{4, 1} Fix #51228
Naively adding a bail-out path that returns Bottom if the param isn't a Type (which I'm not sure is legal) gets me a little further, but it then fails during inlining:
I guess the compiler is just not great at handling these ill-formed types? Should/can we prevent construction of them? |
I added that change, and it seems to pass tests: https://github.com/JuliaLang/julia/compare/jn/51228. It is probably a reasonable fix, though it means we need to fix printing of NTuple |
It does not seem necessary to allow this, though it does lead to this printing issue to disallow it: julia> Tuple{1, 1, 1, 1} NTuple{4, 1} Fix #51228
It does not seem necessary to allow this, though it does lead to this printing issue to disallow it: julia> Tuple{1, 1, 1, 1} NTuple{4, 1} Fix #51228
We had the ordering of tests incorrect, so Vararg was not correctly checked for validity during method definition. Fixes #51228
It does not seem necessary to allow this, though it does lead to this printing issue to disallow it: julia> Tuple{1, 1, 1, 1} NTuple{4, 1} Fix #51228
Various simplifications and improvements from investigating #51228. Improves the logic for showing of NTuple to handle constant lengths. Improves the logic for showing NTuple of bound length (e.g. NTuple itself). Also makes a choice to avoid showing non-types as NTuple, but instead try to write them out, to make it more visually obvious when the parameters have been swapped.
We had the ordering of tests incorrect, so Vararg was not correctly checked for validity during method definition. Fixes #51228
Looks like a slight variation still errors: f(x=whatever) = 1
f(::Vararg{T,T}) where T = 2
f()
|
Avoids causing issues in matching_cache_argtypes/tuple_tfunc with invalid contents appearing in the Tuple parameters after intersections (such as Int, tuple of Symbol, etc). Also sharpen valid_as_lattice / instanceof_tfunc to be able to filter out and reject types that cannot appear as tags at runtime, except where they are used for non-tag queries (like fieldtype_tfunc and subtype_tfunc). Fixes #51228 (part 2)
We had the ordering of tests incorrect, so Vararg was not correctly checked for validity during method definition. Fixes #51228
Various simplifications and improvements from investigating #51228. Improves the logic for showing of NTuple to handle constant lengths. Improves the logic for showing NTuple of bound length (e.g. NTuple itself). Also makes a choice to avoid showing non-types as NTuple, but instead try to write them out, to make it more visually obvious when the parameters have been swapped.
…eter construction (#51244) Various simplifications and improvements from investigating #51228. Improves the logic for showing of NTuple to handle constant lengths. Improves the logic for showing NTuple of bound length (e.g. NTuple itself). Also makes a choice to avoid showing non-types as NTuple, but instead try to write them out, to make it more visually obvious when the parameters have been swapped. --------- Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Avoids causing issues in matching_cache_argtypes/tuple_tfunc with invalid contents appearing in the Tuple parameters after intersections (such as Int, tuple of Symbol, etc). Also sharpen valid_as_lattice / instanceof_tfunc to be able to filter out and reject types that cannot appear as tags at runtime, except where they are used for non-tag queries (like fieldtype_tfunc and subtype_tfunc). Fixes #51228 (part 2)
Avoids causing issues in matching_cache_argtypes/tuple_tfunc with invalid contents appearing in the Tuple parameters after intersections (such as Int, tuple of Symbol, etc). Also sharpen valid_as_lattice / instanceof_tfunc to be able to filter out and reject types that cannot appear as tags at runtime, except where they are used for non-tag queries (like fieldtype_tfunc and subtype_tfunc). Fixes #51228 (part 2)
I'm not sure we care, given that this
Vararg
is very wrong, but I guess it maybe shouldn't throw an internal error:The text was updated successfully, but these errors were encountered: