From 3947c62caff83df52ff56723fec59331ba9f92fe Mon Sep 17 00:00:00 2001 From: Martin Holters Date: Mon, 27 Aug 2018 11:24:13 +0200 Subject: [PATCH] Remove at-compat for type aliases Was added in #326, now obsolete as no longer required on minimum supported Julia version 0.6. --- README.md | 4 ---- src/compatmacro.jl | 15 --------------- test/runtests.jl | 8 -------- 3 files changed, 27 deletions(-) diff --git a/README.md b/README.md index 679ab15f4..64f058d42 100644 --- a/README.md +++ b/README.md @@ -68,9 +68,6 @@ Currently, the `@compat` macro supports the following syntaxes: to declare abstract and primitive types. [#20418] This only works when `@compat` is applied directly on the declaration. -* `@compat A{T} = B{T}` or `@compat const A{T} = B{T}` to declare type alias with free - parameters. [#20500]. Use `const A = B{T}` or `const A = B` for type alias without free parameters (i.e. no type parameter on the left hand side). - * `@compat Base.IndexStyle(::Type{<:MyArray}) = IndexLinear()` and `@compat Base.IndexStyle(::Type{<:MyArray}) = IndexCartesian()` to define traits for abstract arrays, replacing the former `Base.linearindexing{T<:MyArray}(::Type{T}) = Base.LinearFast()` and `Base.linearindexing{T<:MyArray}(::Type{T}) = Base.LinearSlow()`, respectively. * `Compat.collect(A)` returns an `Array`, no matter what indices the array `A` has. [#21257] @@ -550,7 +547,6 @@ includes this fix. Find the minimum version from there. [#20407]: https://github.com/JuliaLang/julia/issues/20407 [#20414]: https://github.com/JuliaLang/julia/issues/20414 [#20418]: https://github.com/JuliaLang/julia/issues/20418 -[#20500]: https://github.com/JuliaLang/julia/issues/20500 [#20974]: https://github.com/JuliaLang/julia/issues/20974 [#21197]: https://github.com/JuliaLang/julia/issues/21197 [#21257]: https://github.com/JuliaLang/julia/issues/21257 diff --git a/src/compatmacro.jl b/src/compatmacro.jl index 28a57ba9b..373e11fcf 100644 --- a/src/compatmacro.jl +++ b/src/compatmacro.jl @@ -15,16 +15,6 @@ is_index_style(arg) = false istopsymbol(ex, mod, sym) = ex in (sym, Expr(:(.), mod, Expr(:quote, sym))) -if VERSION < v"0.6.0-dev.2782" - function new_style_typealias(ex::ANY) - isexpr(ex, :(=)) || return false - ex = ex::Expr - return length(ex.args) == 2 && isexpr(ex.args[1], :curly) - end -else - new_style_typealias(ex) = false -end - if !isdefined(Base, :UndefKeywordError) struct UndefKeywordError <: Exception kw @@ -62,11 +52,6 @@ function _compat(ex::Expr) elseif ex.head === :quote && isa(ex.args[1], Symbol) # Passthrough return ex - elseif new_style_typealias(ex) - ex.head = :typealias - elseif ex.head === :const && length(ex.args) == 1 && new_style_typealias(ex.args[1]) - ex = ex.args[1]::Expr - ex.head = :typealias end if VERSION < v"0.6.0-dev.2840" if ex.head == :(=) && isa(ex.args[1], Expr) && ex.args[1].head == :call diff --git a/test/runtests.jl b/test/runtests.jl index 7680c91fb..b4cb70453 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -476,14 +476,6 @@ end @test isbitstype(Primitive20418{Int}) @test sizeof(Primitive20418{Int}) == 2 -# PR #20500 -@compat A20500{T<:Integer} = Array{T,20500} -@compat const A20500_2{T<:Union{Int,Float32}} = Pair{T,T} -f20500() = A20500 -f20500_2() = A20500_2 -@inferred f20500() -@inferred f20500_2() - module CompatArray using Compat const struct_sym = VERSION < v"0.7.0-DEV.1263" ? :type : :struct