Skip to content

Commit f0b00b6

Browse files
committed
fix a few more deprecation-related items
1 parent 2990f0e commit f0b00b6

File tree

24 files changed

+59
-116
lines changed

24 files changed

+59
-116
lines changed

base/abstractarray.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,6 +2012,9 @@ julia> map(+, [1, 2, 3], [10, 20, 30])
20122012
"""
20132013
map(f, A) = collect(Generator(f,A))
20142014

2015+
map(f, ::AbstractDict) = error("map is not defined on dictionaries")
2016+
map(f, ::AbstractSet) = error("map is not defined on sets")
2017+
20152018
## 2 argument
20162019
function map!(f::F, dest::AbstractArray, A::AbstractArray, B::AbstractArray) where F
20172020
for (i, j, k) in zip(eachindex(dest), eachindex(A), eachindex(B))

base/broadcast.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ Base.RefValue{String}("hello")
602602
```
603603
"""
604604
broadcastable(x::Union{Symbol,AbstractString,Function,UndefInitializer,Nothing,RoundingMode,Missing,Val}) = Ref(x)
605-
broadcastable(x::Ptr) = Ref{Ptr}(x) # Cannot use Ref(::Ptr) until ambiguous deprecation goes through
605+
broadcastable(x::Ptr) = Ref(x)
606606
broadcastable(::Type{T}) where {T} = Ref{Type{T}}(T)
607607
broadcastable(x::Union{AbstractArray,Number,Ref,Tuple,Broadcasted}) = x
608608
# Default to collecting iterables — which will error for non-iterables

base/client.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ end
387387
baremodule MainInclude
388388
include(fname::AbstractString) = Main.Base.include(Main, fname)
389389
eval(x) = Core.eval(Main, x)
390-
Main.Base.@deprecate eval(m, x) Core.eval(m, x)
391390
end
392391

393392
"""

base/compiler/abstractinterpretation.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
const CoreNumType = Union{Int32, Int64, Float32, Float64}
88

9-
const DEPRECATED_SYM = Symbol("deprecated.jl")
10-
119
const _REF_NAME = Ref.body.name
1210

1311
#########
@@ -199,10 +197,6 @@ function abstract_call_method_with_const_args(@nospecialize(f), argtypes::Vector
199197
end
200198

201199
function abstract_call_method(method::Method, @nospecialize(sig), sparams::SimpleVector, sv::InferenceState)
202-
# TODO: remove with 0.7 deprecations
203-
if method.file === DEPRECATED_SYM && method.sig == (Tuple{Type{T},Any} where T)
204-
return Any, false, nothing
205-
end
206200
if method.name === :depwarn && isdefined(Main, :Base) && method.module === Main.Base
207201
return Any, false, nothing
208202
end

base/loading.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,6 @@ function evalfile(path::AbstractString, args::Vector{String}=String[])
10701070
Expr(:toplevel,
10711071
:(const ARGS = $args),
10721072
:(eval(x) = $(Expr(:core, :eval))(__anon__, x)),
1073-
:(@deprecate eval(m, x) Core.eval(m, x)),
10741073
:(include(x) = $(Expr(:top, :include))(__anon__, x)),
10751074
:(include($path))))
10761075
end

base/task.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ function task_local_storage(body::Function, key, val)
178178
end
179179

180180
# NOTE: you can only wait for scheduled tasks
181-
# TODO: rename to wait for 1.0
182-
function _wait(t::Task)
181+
function wait(t::Task)
183182
if !istaskdone(t)
184183
if t.donenotify === nothing
185184
t.donenotify = Condition()
@@ -193,16 +192,14 @@ function _wait(t::Task)
193192
end
194193
end
195194

196-
_wait(not_a_task) = wait(not_a_task)
197-
198195
"""
199196
fetch(t::Task)
200197
201198
Wait for a Task to finish, then return its result value. If the task fails with an
202199
exception, the exception is propagated (re-thrown in the task that called fetch).
203200
"""
204201
function fetch(t::Task)
205-
_wait(t)
202+
wait(t)
206203
task_result(t)
207204
end
208205

@@ -213,7 +210,7 @@ function sync_end(refs)
213210
c_ex = CompositeException()
214211
for r in refs
215212
try
216-
_wait(r)
213+
wait(r)
217214
catch ex
218215
if !isa(r, Task) || (isa(r, Task) && !istaskfailed(r))
219216
rethrow(ex)

src/ast.scm

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -378,25 +378,20 @@
378378
(symbol (string.sub str 1 (length str)))))
379379

380380
; convert '.xx to 'xx, and (|.| _ '.xx) to (|.| _ 'xx), and otherwise return #f
381-
(define (maybe-undotop e)
381+
;; raise an error for using .op as a function name
382+
(define (check-dotop e)
382383
(if (symbol? e)
383384
(let ((str (string e)))
384385
(if (and (eqv? (string.char str 0) #\.)
385386
(not (eq? e '|.|))
386387
(not (eqv? (string.char str 1) #\.)))
387-
(symbol (string.sub str 1 (length str)))
388-
#f))
388+
(error (string "invalid function name \"" e "\""))))
389389
(if (pair? e)
390390
(if (eq? (car e) '|.|)
391-
(let ((op (maybe-undotop (caddr e))))
392-
(if op
393-
(list '|.| (cadr e) op)
394-
#f))
391+
(check-dotop (caddr e))
395392
(if (quoted? e)
396-
(let ((op (maybe-undotop (cadr e))))
397-
(if op (list (car e) op) #f))
398-
#f))
399-
#f)))
393+
(check-dotop (cadr e))))))
394+
e)
400395

401396
(define (vararg? x) (and (pair? x) (eq? (car x) '...)))
402397
(define (varargexpr? x) (and

src/julia-parser.scm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,6 +1927,12 @@
19271927
(else
19281928
(list (=-to-kw e)))))
19291929

1930+
(define invalid-identifier? (Set (list* '.... '? '|.'| syntactic-operators)))
1931+
1932+
(define-macro (check-identifier ex)
1933+
`(if (invalid-identifier? ,ex)
1934+
(error (string "invalid identifier name \"" ,ex "\""))))
1935+
19301936
(define (parse-paren s (checked #t)) (car (parse-paren- s checked)))
19311937

19321938
;; return (expr . arglist) where arglist is #t iff this isn't just a parenthesized expr
@@ -2220,12 +2226,6 @@
22202226
;; process escape sequences using lisp read
22212227
(read (open-input-string (string #\" s #\"))))))
22222228

2223-
(define invalid-identifier? (Set (list* '.... '? '|.'| syntactic-operators)))
2224-
2225-
(define-macro (check-identifier ex)
2226-
`(if (invalid-identifier? ,ex)
2227-
(error (string "invalid identifier name \"" ,ex "\""))))
2228-
22292229
;; parse numbers, identifiers, parenthesized expressions, lists, vectors, etc.
22302230
(define (parse-atom s (checked #t))
22312231
(let ((t (require-token s)))

src/julia-syntax.scm

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -240,24 +240,6 @@
240240
(pair? (caddr e)) (memq (car (caddr e)) '(quote inert))
241241
(symbol? (cadr (caddr e))))))
242242

243-
;; e.g. Base.(:+) is deprecated in favor of Base.:+
244-
(define (deprecate-dotparen e)
245-
(if (and (length= e 3) (eq? (car e) '|.|)
246-
(or (atom? (cadr e)) (sym-ref? (cadr e)))
247-
(length= (caddr e) 2) (eq? (caaddr e) 'tuple)
248-
(pair? (cadr (caddr e))) (memq (caadr (caddr e)) '(quote inert)))
249-
(let* ((s_ (cdadr (caddr e)))
250-
(s (if (symbol? s_) s_
251-
(if (and (length= s_ 1) (symbol? (car s_))) (car s_) #f))))
252-
(if s
253-
(let ((newe (list (car e) (cadr e) (cadr (caddr e))))
254-
(S (deparse `(quote ,s)))) ; #16295
255-
(syntax-deprecation (string (deparse (cadr e)) ".(" S ")")
256-
(string (deparse (cadr e)) "." S) #f)
257-
newe)
258-
e))
259-
e))
260-
261243
;; convert final (... x) to (curly Vararg x)
262244
(define (dots->vararg a)
263245
(if (null? a) a
@@ -1019,20 +1001,13 @@
10191001
((eq? (car name) 'call)
10201002
(let* ((head (cadr name))
10211003
(argl (cddr name))
1022-
(name (deprecate-dotparen head))
1023-
(op (let ((op_ (maybe-undotop name))) ; handle .op -> broadcast deprecation
1024-
(if op_
1025-
(syntax-deprecation (string "function " (deparse name) "(...)")
1026-
(string "function Base.broadcast(::typeof(" (deparse op_) "), ...)") #f))
1027-
op_))
1028-
(name (if op '(|.| Base (inert broadcast)) name))
1004+
(name (check-dotop head))
10291005
(annotations (map (lambda (a) `(meta ,(cadr a) ,(arg-name (caddr a))))
10301006
(filter nospecialize-meta? argl)))
10311007
(body (insert-after-meta (caddr e) annotations))
10321008
(argl (map (lambda (a)
10331009
(if (nospecialize-meta? a) (caddr a) a))
10341010
argl))
1035-
(argl (if op (cons `(|::| (call (core Typeof) ,op)) argl) argl))
10361011
(raw-typevars (or where '()))
10371012
(sparams (map analyze-typevar raw-typevars))
10381013
(adj-decl (lambda (n) (if (and (decl? n) (length= n 2))
@@ -1893,15 +1868,11 @@
18931868
((|.|)
18941869
;; a.b =
18951870
(let* ((a (cadr lhs))
1896-
(b_ (caddr lhs))
1897-
(b (if (and (length= b_ 2) (eq? (car b_) 'tuple))
1898-
(begin
1899-
(syntax-deprecation
1900-
(string (deparse a) ".(" (deparse (cadr b_)) ") = ...")
1901-
(string "setfield!(" (deparse a) ", " (deparse (cadr b_)) ", ...)") #f)
1902-
(cadr b_))
1903-
b_))
1871+
(b (caddr lhs))
19041872
(rhs (caddr e)))
1873+
(if (and (length= b 2) (eq? (car b) 'tuple))
1874+
(error (string "invalid syntax \""
1875+
(string (deparse a) ".(" (deparse (cadr b)) ") = ...") "\"")))
19051876
(let ((aa (if (symbol-like? a) a (make-ssavalue)))
19061877
(bb (if (or (atom? b) (symbol-like? b) (and (pair? b) (quoted? b)))
19071878
b (make-ssavalue)))

stdlib/Distributed/src/cluster.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ function addprocs_locked(manager::ClusterManager; kwargs...)
419419
end
420420
end
421421

422-
Base._wait(t_launch) # catches any thrown errors from the launch task
422+
Base.wait(t_launch) # catches any thrown errors from the launch task
423423

424424
# Since all worker-to-worker setups may not have completed by the time this
425425
# function returns to the caller, send the complete list to all workers.

0 commit comments

Comments
 (0)