Skip to content

Inconsistent constraints on type variables are ignored without type application #24179

Closed
@julbinb

Description

@julbinb

Here is a julia 0.6.0 example:

julia> T where String<:T<:Signed
Signed

Lower bound is simply ignored, although String is not a subtype of Signed.

Also, this type is not equal to Union{}:

julia> (Ref{T} where String<:T<:Signed) <: Union{}
false

Despite the fact there are no valid instantiations of T. Of course, when we try to instantiate the type, we got an error message:

julia> (Ref{T} where String<:T<:Signed){Int}
ERROR: TypeError: Type: in T, expected String<:T<:Signed, got Type{Int64}

julia> (Ref{T} where String<:T<:Signed){String}
ERROR: TypeError: Type: in T, expected String<:T<:Signed, got Type{String}

julia> (Ref{T} where String<:T<:Signed){Signed}
ERROR: TypeError: Type: in T, expected String<:T<:Signed, got Type{Signed}

Version info:

Julia Version 0.6.0
Commit 903644385b (2017-06-19 13:05 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, haswell)

Metadata

Metadata

Assignees

No one assigned

    Labels

    types and dispatchTypes, subtyping and method dispatch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions