Skip to content

Commit

Permalink
Julia 1.0 (#58)
Browse files Browse the repository at this point in the history
* Julia 1.0

Fixes #57

Update appveyor script
  • Loading branch information
mauro3 authored Aug 8, 2018
1 parent b38ca92 commit 0480ae2
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 285 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ os:
- linux
- osx
julia:
- 0.7
- nightly
# matrix:
# allow_failures:
Expand All @@ -12,4 +13,4 @@ notifications:
# uncomment the following lines to override the default test script
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia --check-bounds=yes -e 'Pkg.clone(pwd()); Pkg.build("SimpleTraits"); Pkg.test("SimpleTraits"; coverage=false)'
- julia --check-bounds=yes -e 'using Pkg; Pkg.clone(pwd()); Pkg.build("SimpleTraits"); Pkg.test("SimpleTraits"; coverage=false)'
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
julia 0.7-
julia 0.7
MacroTools 0.3.2
31 changes: 17 additions & 14 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
environment:
matrix:
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
- julia_version: 0.7
- julia_version: 1.0
# - julia_version: latest

platform:
- x86 # 32-bit
- x64 # 64-bit

## uncomment the following lines to allow failures on nightly julia
## (tests will run but not make your overall status red)
#matrix:
# allow_failures:
# - julia_version: latest

branches:
only:
Expand All @@ -15,19 +26,11 @@ notifications:
on_build_status_changed: false

install:
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
# Download most recent Julia Windows binary
- ps: (new-object net.webclient).DownloadFile(
$env:JULIA_URL,
"C:\projects\julia-binary.exe")
# Run installer silently, output to C:\projects\julia
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"SimpleTraits\"); Pkg.build(\"SimpleTraits\")"
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"

test_script:
- C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"SimpleTraits\")"
- C:\julia\bin\julia --check-bounds=yes -e "using Pkg; Pkg.test(\"SimpleTraits\"; coverage=false)"
8 changes: 2 additions & 6 deletions src/SimpleTraits.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
__precompile__()

module SimpleTraits
using MacroTools
const curmod = nameof(@__MODULE__)
Expand Down Expand Up @@ -474,10 +472,8 @@ end

# generates: X1, X2,... or x1, x2.... (just symbols not actual TypeVar)
struct GenerateTypeVars{CASE} end
Base.start(::GenerateTypeVars) = 1
Base.next(::GenerateTypeVars{:upcase}, state) = (Symbol("X$state"), state+1) # X1,..
Base.next(::GenerateTypeVars{:lcase}, state) = (Symbol("x$state"), state+1) # x1,...
Base.done(::GenerateTypeVars, state) = false
Base.iterate(::GenerateTypeVars{:upcase}, state=1) = (Symbol("X$state"), state+1) # X1,..
Base.iterate(::GenerateTypeVars{:lcase}, state=1) = (Symbol("x$state"), state+1) # x1,...

####
# Annotating the source location
Expand Down
10 changes: 7 additions & 3 deletions src/base-traits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export IsLeafType, IsConcrete, IsBits, IsImmutable, IsContiguous, IsIndexLinear,

"Trait of all isbits-types"
@traitdef IsBits{X}
@traitimpl IsBits{X} <- isbits(X)
Base.@pure _isbits(X) = X.isbitstype
@traitimpl IsBits{X} <- _isbits(X)

"Trait of all immutable types"
@traitdef IsImmutable{X}
Expand Down Expand Up @@ -62,8 +63,11 @@ Base.@deprecate_binding IsFastLinearIndex IsIndexLinear
"Trait of all iterator types"
@traitdef IsIterator{X}
@generated function SimpleTraits.trait(::Type{IsIterator{X}}) where {X}
error("Not supported in Julia 0.7, due to fallbacks. Should work again in 1.0")
# hasmethod(iterate, Tuple{X}) ? :(IsIterator{X}) : :(Not{IsIterator{X}})
if VERSION<v"1-"
error("Not supported in Julia 0.7, due to fallbacks. Should work again in 1.0")
else
hasmethod(iterate, Tuple{X}) ? :(IsIterator{X}) : :(Not{IsIterator{X}})
end
end

end # module
3 changes: 1 addition & 2 deletions test/base-traits-inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ basetrs = [:IsConcrete=>:Int,
:IsIterator=>:(Dict{Int,Int})]

for (bt, tp) in basetrs
bt==:IsIterator && continue # errors currently
bt==:IsIndexLinear && continue # this is a false negative, not sure why
bt==:IsIterator && VERSION<v"1-" && continue # errors on 0.7 due to start/step/done
@test @eval @check_fast_traitdispatch $bt $tp true
end
6 changes: 5 additions & 1 deletion test/base-traits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ c = view(a, 1:2:5)
struct T9867 end
@test istrait(IsCallable{T9867})

@test_throws ErrorException istrait(IsIterator{Base.UnitRange})
if VERSION<v"1-"
@test_throws ErrorException istrait(IsIterator{Base.UnitRange})
else
@test istrait(IsIterator{Base.UnitRange})
end
246 changes: 0 additions & 246 deletions test/runtests-oldfn-syntax.jl

This file was deleted.

11 changes: 0 additions & 11 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,3 @@ end
include("base-traits.jl")
include("base-traits-inference.jl")
include("backtraces.jl")

#####
# Old function syntax
####
# throws lots of deprecation warnings!
# TODO remove with Julia 0.7
module OldFnSyntax
println("\n")
println("The following warnings are ok as they test deprecated code:\n")
include("runtests-oldfn-syntax.jl")
end

0 comments on commit 0480ae2

Please sign in to comment.