-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
speculativeWhether the change will be implemented is speculativeWhether the change will be implemented is speculativetypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch
Description
Consider the following example:
julia> specializing_typeof(::T) where {T} = T;
julia> specializing_typeof(::Type{T}) where {T} = Type{T};
julia> specializing_typeof((Type{T} where {T}).body)
ERROR: UndefVarError: `T` not defined in static parameter matching
Suggestion: run Test.detect_unbound_args to detect method arguments that do not fully constrain a type parameter.
Stacktrace:I don't understand why it matches the second signature and hits an error, when the first signature is actually a valid match for it. For example, if I didn't have the second method, I get
julia> specializing_typeof(::T) where {T} = T;
julia> specializing_typeof((Type{T} where {T}).body)
DataTypewhich seems right to me.
Is this behavior expected?
(On 1.11.5; I'm assuming it is also seen in other versions)
Metadata
Metadata
Assignees
Labels
speculativeWhether the change will be implemented is speculativeWhether the change will be implemented is speculativetypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch