Skip to content

Commit 7eb53d6

Browse files
JeffBezansonKristofferC
authored andcommitted
remove most front-end deprecations
also disable "local declared twice" error This permits declaring a loop variable as local inside the loop, which was used during 0.7 to get the new scope behavior.
1 parent 39793be commit 7eb53d6

26 files changed

+171
-506
lines changed

base/boot.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142

143143
export
144144
# key types
145-
Any, DataType, Vararg, ANY, NTuple,
145+
Any, DataType, Vararg, NTuple,
146146
Tuple, Type, UnionAll, TypeVar, Union, Nothing, Cvoid,
147147
AbstractArray, DenseArray, NamedTuple,
148148
# special objects

base/deprecated.jl

-16
Original file line numberDiff line numberDiff line change
@@ -364,15 +364,6 @@ end
364364
# nfields(::Type) deprecation in builtins.c: update nfields tfunc in compiler/tfuncs.jl when it is removed.
365365
# also replace `_nfields` with `nfields` in summarysize.c when this is removed.
366366

367-
# ::ANY is deprecated in src/method.c
368-
# also remove all instances of `jl_ANY_flag` in src/
369-
370-
# issue #13079
371-
# in julia-parser.scm:
372-
# move prec-bitshift after prec-rational
373-
# remove parse-with-chains-warn and bitshift-warn
374-
# update precedence table in doc/src/manual/mathematical-operations.md
375-
376367
# PR #22182
377368
@deprecate is_apple Sys.isapple
378369
@deprecate is_bsd Sys.isbsd
@@ -397,9 +388,6 @@ end
397388

398389
@deprecate_binding UVError IOError false
399390

400-
# issue #11310
401-
# remove "parametric method syntax" deprecation in julia-syntax.scm
402-
403391
@deprecate momenttype(::Type{T}) where {T} typeof((zero(T)*zero(T) + zero(T)*zero(T))/2) false
404392

405393
# issue #6466
@@ -488,9 +476,6 @@ end
488476
# issue #5148, PR #23259
489477
# warning for `const` on locals should be changed to an error in julia-syntax.scm
490478

491-
# issue #22789
492-
# remove code for `importall` in src/
493-
494479
# issue #17886
495480
# deprecations for filter[!] with 2-arg functions are in abstractdict.jl
496481

@@ -1720,7 +1705,6 @@ function factorial(x::Number)
17201705
end
17211706

17221707
# issue #27093
1723-
# in src/jlfrontend.scm a call to `@deprecate` is generated for per-module `eval(m, x)`
17241708
@eval Core Main.Base.@deprecate(eval(e), Core.eval(Main, e))
17251709

17261710
@eval @deprecate $(Symbol("@schedule")) $(Symbol("@async"))

base/essentials.jl

-5
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,6 @@ oftype(x, y) = convert(typeof(x), y)
325325
unsigned(x::Int) = reinterpret(UInt, x)
326326
signed(x::UInt) = reinterpret(Int, x)
327327

328-
# conversions used by ccall
329-
ptr_arg_cconvert(::Type{Ptr{T}}, x) where {T} = cconvert(T, x)
330-
ptr_arg_unsafe_convert(::Type{Ptr{T}}, x) where {T} = unsafe_convert(T, x)
331-
ptr_arg_unsafe_convert(::Type{Ptr{Cvoid}}, x) = x
332-
333328
"""
334329
cconvert(T,x)
335330

doc/src/manual/mathematical-operations.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,11 @@ Julia applies the following order and associativity of operations, from highest
356356
|:-------------- |:------------------------------------------------------------------------------------------------- |:-------------------------- |
357357
| Syntax | `.` followed by `::` | Left |
358358
| Exponentiation | `^` | Right |
359-
| Unary | `+ - √` | Right[^1] |
360-
| Fractions | `//` | Left |
361-
| Multiplication | `* / % & \ ÷` | Left[^2] |
359+
| Unary | `+ - √` | Right[^1] |
362360
| Bitshifts | `<< >> >>>` | Left |
363-
| Addition | `+ - \| ⊻` | Left[^2] |
361+
| Fractions | `//` | Left |
362+
| Multiplication | `* / % & \ ÷` | Left[^2] |
363+
| Addition | `+ - \| ⊻` | Left[^2] |
364364
| Syntax | `: ..` | Left |
365365
| Syntax | `\|>` | Left |
366366
| Syntax | `<\|` | Right |

src/ast.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ jl_sym_t *call_sym; jl_sym_t *invoke_sym;
3030
jl_sym_t *empty_sym; jl_sym_t *top_sym;
3131
jl_sym_t *module_sym; jl_sym_t *slot_sym;
3232
jl_sym_t *export_sym; jl_sym_t *import_sym;
33-
jl_sym_t *importall_sym; jl_sym_t *toplevel_sym;
34-
jl_sym_t *quote_sym; jl_sym_t *amp_sym;
33+
jl_sym_t *toplevel_sym; jl_sym_t *quote_sym;
3534
jl_sym_t *line_sym; jl_sym_t *jl_incomplete_sym;
3635
jl_sym_t *goto_sym; jl_sym_t *goto_ifnot_sym;
3736
jl_sym_t *return_sym; jl_sym_t *unreachable_sym;
@@ -334,7 +333,6 @@ void jl_init_frontend(void)
334333
export_sym = jl_symbol("export");
335334
import_sym = jl_symbol("import");
336335
using_sym = jl_symbol("using");
337-
importall_sym = jl_symbol("importall");
338336
assign_sym = jl_symbol("=");
339337
method_sym = jl_symbol("method");
340338
exc_sym = jl_symbol("the_exception");
@@ -344,7 +342,6 @@ void jl_init_frontend(void)
344342
const_sym = jl_symbol("const");
345343
global_sym = jl_symbol("global");
346344
thunk_sym = jl_symbol("thunk");
347-
amp_sym = jl_symbol("&");
348345
abstracttype_sym = jl_symbol("abstract_type");
349346
primtype_sym = jl_symbol("primitive_type");
350347
structtype_sym = jl_symbol("struct_type");

src/ast.scm

+2-4
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
(string #\( (deparse (caddr e)) " " (cadr e) " " (deparse (cadddr e)) #\) ))
8282
(else
8383
(deparse-prefix-call (cadr e) (cddr e) #\( #\)))))
84-
(($ &) (if (pair? (cadr e))
84+
(($ &) (if (and (pair? (cadr e)) (not (eq? (caadr e) 'outerref)))
8585
(string (car e) "(" (deparse (cadr e)) ")")
8686
(string (car e) (deparse (cadr e)))))
8787
((|::|) (if (length= e 2)
@@ -200,7 +200,7 @@
200200
(string.join (map deparse (cdr (cadddr e))) "\n") "\n"
201201
"end"))
202202
;; misc syntax forms
203-
((import importall using)
203+
((import using)
204204
(define (deparse-path e)
205205
(cond ((and (pair? e) (eq? (car e) '|.|))
206206
(let loop ((lst (cdr e))
@@ -408,8 +408,6 @@
408408
(pair? (caddr x))
409409
(length> (caddr x) 1)
410410
(eq? (cadr (caddr x)) 'Vararg)))))
411-
(define (trans? x) (and (pair? x) (eq? (car x) '|.'|)))
412-
(define (ctrans? x) (and (pair? x) (eq? (car x) '|'|)))
413411
(define (linenum? x) (and (pair? x) (eq? (car x) 'line)))
414412

415413
(define (make-assignment l r) `(= ,l ,r))

src/builtins.c

-9
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,6 @@ static uintptr_t jl_object_id_(jl_value_t *tv, jl_value_t *v)
294294
}
295295
if (dt == jl_typename_type)
296296
return ((jl_typename_t*)v)->hash;
297-
#ifdef _P64
298-
if (v == jl_ANY_flag)
299-
return 0x31c472f68ee30bddULL;
300-
#else
301-
if (v == jl_ANY_flag)
302-
return 0x8ee30bdd;
303-
#endif
304297
if (dt == jl_string_type) {
305298
#ifdef _P64
306299
return memhash_seed(jl_string_data(v), jl_string_len(v), 0xedc3b677);
@@ -1328,8 +1321,6 @@ void jl_init_primitives(void)
13281321

13291322
add_builtin("AbstractString", (jl_value_t*)jl_abstractstring_type);
13301323
add_builtin("String", (jl_value_t*)jl_string_type);
1331-
1332-
add_builtin("ANY", jl_ANY_flag);
13331324
}
13341325

13351326
#ifdef __cplusplus

src/ccall.cpp

+1-8
Original file line numberDiff line numberDiff line change
@@ -1560,14 +1560,7 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
15601560
// Julia (expression) value of current parameter
15611561
jl_value_t *argi = ccallarg(i);
15621562

1563-
// pass the address of the argument rather than the argument itself
1564-
if (jl_is_expr(argi) && ((jl_expr_t*)argi)->head == amp_sym) {
1565-
addressOf.push_back(true);
1566-
argi = jl_exprarg(argi, 0);
1567-
}
1568-
else {
1569-
addressOf.push_back(false);
1570-
}
1563+
addressOf.push_back(false);
15711564

15721565
argv[i] = emit_expr(ctx, argi);
15731566
}

src/dump.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3180,7 +3180,7 @@ void jl_init_serializer(void)
31803180
jl_pointer_type, jl_vararg_type, jl_abstractarray_type, jl_void_type,
31813181
jl_densearray_type, jl_function_type, jl_typename_type,
31823182
jl_builtin_type, jl_task_type, jl_uniontype_type, jl_typetype_type,
3183-
jl_ANY_flag, jl_array_any_type, jl_intrinsic_type,
3183+
jl_array_any_type, jl_intrinsic_type,
31843184
jl_abstractslot_type, jl_methtable_type, jl_typemap_level_type,
31853185
jl_voidpointer_type, jl_newvarnode_type, jl_abstractstring_type,
31863186
jl_array_symbol_type, jl_anytuple_type, jl_tparam0(jl_anytuple_type),

src/gc.c

-1
Original file line numberDiff line numberDiff line change
@@ -2267,7 +2267,6 @@ static void mark_roots(jl_gc_mark_cache_t *gc_cache, gc_mark_sp_t *sp)
22672267
if (jl_cfunction_list != NULL)
22682268
gc_mark_queue_obj(gc_cache, sp, jl_cfunction_list);
22692269
gc_mark_queue_obj(gc_cache, sp, jl_anytuple_type_type);
2270-
gc_mark_queue_obj(gc_cache, sp, jl_ANY_flag);
22712270
for (size_t i = 0; i < N_CALL_CACHE; i++)
22722271
if (call_cache[i])
22732272
gc_mark_queue_obj(gc_cache, sp, call_cache[i]);

src/jlfrontend.scm

+13-15
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@
109109

110110
(define (toplevel-only-expr? e)
111111
(and (pair? e)
112-
(or (memq (car e) '(toplevel line module import importall using export
112+
(or (memq (car e) '(toplevel line module import using export
113113
error incomplete))
114114
(and (eq? (car e) 'global) (every symbol? (cdr e))
115115
(every (lambda (x) (not (memq x '(true false)))) (cdr e))))))
116116

117117
(define (expand-toplevel-expr e)
118118
(cond ((or (atom? e) (toplevel-only-expr? e))
119119
(if (underscore-symbol? e)
120-
(syntax-deprecation "underscores as an rvalue" "" #f))
120+
(error "all-underscore identifier used as rvalue"))
121121
e)
122122
(else
123123
(let ((last *in-expand*))
@@ -140,15 +140,6 @@
140140
(block
141141
,loc
142142
(call (core eval) ,name ,x)))
143-
(if (&& (call (top isdefined) (core Main) (quote Base))
144-
(call (top isdefined) (|.| (core Main) (quote Base)) (quote @deprecate)))
145-
(call eval
146-
(quote
147-
(macrocall (|.| (|.| (core Main) (quote Base)) (quote @deprecate))
148-
(line 0 none)
149-
(call eval m x)
150-
(call (|.| Core (quote eval)) m x) ; should be (core eval), but format as Core.eval(m, x) for deprecation warning
151-
false))))
152143
(= (call include ,x)
153144
(block
154145
,loc
@@ -267,14 +258,21 @@
267258
((length= lno 2) `(,(cadr lno) none))
268259
(else (cdr lno))))
269260

261+
(define (format-loc lno)
262+
(let* ((lf (extract-line-file lno)) (line (car lf)) (file (cadr lf)))
263+
(format-file-line file line #f)))
264+
265+
(define (format-file-line file line exactloc)
266+
(if (or (= line 0) (eq? file 'none))
267+
""
268+
(string (if exactloc " at " " around ") file ":" line)))
269+
270270
(define (format-syntax-deprecation what instead file line exactloc)
271271
(string "Deprecated syntax `" what "`"
272-
(if (or (= line 0) (eq? file 'none))
273-
""
274-
(string (if exactloc " at " " around ") file ":" line))
272+
(format-file-line file line exactloc)
275273
"."
276274
(if (equal? instead "") ""
277-
(string #\newline "Use `" instead "` instead."))))
275+
(string #\newline "Use `" instead "` instead."))))
278276

279277
; Corresponds to --depwarn 0="no", 1="yes", 2="error"
280278
(define *depwarn-opt* 1)

src/jltypes.c

-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ JL_DLLEXPORT jl_value_t *jl_true;
7575
JL_DLLEXPORT jl_value_t *jl_false;
7676

7777
jl_unionall_t *jl_typetype_type;
78-
jl_value_t *jl_ANY_flag;
7978

8079
jl_unionall_t *jl_array_type;
8180
jl_typename_t *jl_array_typename;
@@ -2168,8 +2167,6 @@ void jl_init_types(void)
21682167
(jl_unionall_t*)jl_new_struct(jl_unionall_type, typetype_tvar,
21692168
jl_apply_type1((jl_value_t*)jl_type_type, (jl_value_t*)typetype_tvar));
21702169

2171-
jl_ANY_flag = (jl_value_t*)tvar("ANY");
2172-
21732170
jl_abstractstring_type = jl_new_abstracttype((jl_value_t*)jl_symbol("AbstractString"), core, jl_any_type, jl_emptysvec);
21742171
jl_string_type = jl_new_datatype(jl_symbol("String"), core, jl_abstractstring_type, jl_emptysvec,
21752172
jl_emptysvec, jl_emptysvec, 0, 1, 0);

0 commit comments

Comments
 (0)