@@ -42,6 +42,7 @@ module Unicode
4242 using Unicode
4343 import Unicode: isassigned, normalize # not exported from Unicode module due to conflicts
4444end
45+ import Base: notnothing
4546
4647
4748include (" compatmacro.jl" )
6768 end
6869end
6970
70-
71-
72- @static if ! isdefined (Base, :Some )
73- import Base: promote_rule, convert
74- struct Some{T}
75- value:: T
76- end
77- promote_rule (:: Type{Some{T}} , :: Type{Some{S}} ) where {T,S<: T } = Some{T}
78- promote_rule (:: Type{Some{T}} , :: Type{Nothing} ) where {T} = Union{Some{T}, Nothing}
79- convert (:: Type{Some{T}} , x:: Some ) where {T} = Some {T} (convert (T, x. value))
80- convert (:: Type{Union{Some{T}, Nothing}} , x:: Some ) where {T} = convert (Some{T}, x)
81-
82- convert (:: Type{Union{T, Nothing}} , x:: Any ) where {T} = convert (T, x)
83- convert (:: Type{Nothing} , x:: Any ) = throw (MethodError (convert, (Nothing, x)))
84- convert (:: Type{Nothing} , x:: Nothing ) = nothing
85-
86- # Note: this is the definition of coalasce prior to 0.7.0-DEV.5278; kept to avoid
87- # breakage in packages already using it
88- coalesce (x:: Any ) = x
89- coalesce (x:: Some ) = x. value
90- coalesce (x:: Nothing ) = nothing
91- # coalesce(x::Missing) = missing
92- coalesce (x:: Any , y... ) = x
93- coalesce (x:: Some , y... ) = x. value
94- coalesce (x:: Nothing , y... ) = coalesce (y... )
95- # coalesce(x::Union{Nothing, Missing}, y...) = coalesce(y...)
96-
97- notnothing (x:: Any ) = x
98- notnothing (:: Nothing ) = throw (ArgumentError (" nothing passed to notnothing" ))
99- export Some, coalesce
100- else
101- import Base: notnothing
102- end
103-
10471# 0.7.0-DEV.3309
10572@static if VERSION < v " 0.7.0-DEV.3309"
10673 const IteratorSize = Base. iteratorsize
0 commit comments