From 3e4f4e2dacfa0ad7f4d5159bc3de8142e91e7de5 Mon Sep 17 00:00:00 2001 From: rofinn Date: Wed, 29 Apr 2020 10:51:51 -0500 Subject: [PATCH] Loosen File and Stream filename type constraints. Maintains the same public API (e.g., type constraints on methods remains the same), but allows FilePaths.jl to extend the public methods to work with `AbstractPath`s. This seemed preferable to depending directly on FilePathsBase or loosening the type constraints on all methods. --- src/types.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types.jl b/src/types.jl index 92ffabca..af5d5a61 100644 --- a/src/types.jl +++ b/src/types.jl @@ -26,7 +26,7 @@ DataFormat `fmt`. For example, `File{fmtpng}(filename)` would indicate a PNG file. """ struct File{F<:DataFormat} <: Formatted{F} - filename::String + filename end File(fmt::Type{DataFormat{sym}}, filename) where {sym} = File{fmt}(filename) @@ -53,7 +53,7 @@ be used to improve error messages, etc. """ struct Stream{F <: DataFormat, IOtype <: IO} <: Formatted{F} io::IOtype - filename::Union{String, Nothing} + filename end Stream(::Type{F}, io::IO) where {F<:DataFormat} = Stream{F,typeof(io)}(io, nothing)