Skip to content

Commit

Permalink
Mark TypeUtils from #304 for future deprecation, remove it from README
Browse files Browse the repository at this point in the history
While at it, simplify the syntax of its test due to relaxed 
compatibility requirements.
  • Loading branch information
martinholters committed Oct 8, 2019
1 parent e546efa commit 896856e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 24 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ Currently, the `@compat` macro supports the following syntaxes:

* `Compat.readuntil` with `keep` keyword argument ([#25646])

* The `isabstract`, `parameter_upper_bound`, `typename` reflection methods were added in Julia 0.6. This package re-exports these from the `Compat.TypeUtils` submodule. On earlier versions of julia, that module contains the same functions, but operating on the pre-0.6 type system representation.

* `Compat.invokelatest` supports keywords ([#22646]).

* `Cmd` elements can be accessed as if the `Cmd` were an array of strings for 0.6 and below ([#21197]).
Expand Down
5 changes: 2 additions & 3 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ module Compat

# to be deprecated
import Sockets

include("compatmacro.jl")

module TypeUtils
using Base: parameter_upper_bound, typename
using Compat: isabstracttype
const isabstract = isabstracttype
export isabstract, parameter_upper_bound, typename
end # module TypeUtils

include("compatmacro.jl")

# https://github.com/JuliaLang/julia/pull/25646
@static if VERSION < v"0.7.0-DEV.3510"
# not exported
Expand Down
13 changes: 13 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ module TestSockets
@test ip"127.0.0.1".host == UInt32(2130706433)
end

# julia#20006
abstract type AbstractFoo20006 end
struct ConcreteFoo20006{T<:Int} <: AbstractFoo20006 end
struct ConcreteFoo20006N{T<:Int,N} <: AbstractFoo20006 end
@compat ConcreteFoo200061{T<:Int} = ConcreteFoo20006N{T,1}
@test Compat.TypeUtils.isabstract(AbstractFoo20006)
@test !Compat.TypeUtils.isabstract(ConcreteFoo20006)
@test !Compat.TypeUtils.isabstract(ConcreteFoo20006N)
@test !Compat.TypeUtils.isabstract(ConcreteFoo200061)
@test !Compat.TypeUtils.isabstract(StridedArray)
@test Compat.TypeUtils.parameter_upper_bound(ConcreteFoo20006, 1) == Int
@test isa(Compat.TypeUtils.typename(Array), Core.TypeName)

# tests of removed functionality (i.e. justs tests Base)

# 25959
Expand Down
19 changes: 0 additions & 19 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,6 @@ for x in (3.1, -17, 3//4, big(111.1), Inf)
@test minmax(x) == (x, x)
end

# julia#20006
abstract type AbstractFoo20006 end
eval(Expr(
struct_sym, false,
Expr(:(<:), :(ConcreteFoo20006{T<:Int}), :AbstractFoo20006),
quote end))
eval(Expr(
struct_sym, false,
Expr(:(<:), :(ConcreteFoo20006N{T<:Int,N}), :AbstractFoo20006),
quote end))
@compat ConcreteFoo200061{T<:Int} = ConcreteFoo20006N{T,1}
@test Compat.TypeUtils.isabstract(AbstractFoo20006)
@test !Compat.TypeUtils.isabstract(ConcreteFoo20006)
@test !Compat.TypeUtils.isabstract(ConcreteFoo20006N)
@test !Compat.TypeUtils.isabstract(ConcreteFoo200061)
@test !Compat.TypeUtils.isabstract(StridedArray)
@test Compat.TypeUtils.parameter_upper_bound(ConcreteFoo20006, 1) == Int
@test isa(Compat.TypeUtils.typename(Array), Core.TypeName)

# PR 20203
@test Compat.readline(IOBuffer("Hello, World!\n")) == "Hello, World!"
@test Compat.readline(IOBuffer("x\n"), keep=false) == "x"
Expand Down

0 comments on commit 896856e

Please sign in to comment.