Skip to content

Commit

Permalink
remove most front-end deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jul 31, 2018
1 parent 0fb00c9 commit b60dce5
Show file tree
Hide file tree
Showing 29 changed files with 162 additions and 495 deletions.
2 changes: 1 addition & 1 deletion base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@

export
# key types
Any, DataType, Vararg, ANY, NTuple,
Any, DataType, Vararg, NTuple,
Tuple, Type, UnionAll, TypeVar, Union, Nothing, Cvoid,
AbstractArray, DenseArray, NamedTuple,
# special objects
Expand Down
8 changes: 4 additions & 4 deletions base/char.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ function UInt32(c::Char)
invalid_char(c)::Union{}
u &= 0xffffffff >> l1
u >>= t0
(u & 0x0000007f >> 0) | (u & 0x00007f00 >> 2) |
(u & 0x007f0000 >> 4) | (u & 0x7f000000 >> 6)
((u & 0x0000007f) >> 0) | ((u & 0x00007f00) >> 2) |
((u & 0x007f0000) >> 4) | ((u & 0x7f000000) >> 6)
end

function decode_overlong(c::Char)
Expand All @@ -129,8 +129,8 @@ function decode_overlong(c::Char)
t0 = trailing_zeros(u) & 56
u &= 0xffffffff >> l1
u >>= t0
(u & 0x0000007f >> 0) | (u & 0x00007f00 >> 2) |
(u & 0x007f0000 >> 4) | (u & 0x7f000000 >> 6)
((u & 0x0000007f) >> 0) | ((u & 0x00007f00) >> 2) |
((u & 0x007f0000) >> 4) | ((u & 0x7f000000) >> 6)
end

"""
Expand Down
16 changes: 0 additions & 16 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -364,15 +364,6 @@ end
# nfields(::Type) deprecation in builtins.c: update nfields tfunc in compiler/tfuncs.jl when it is removed.
# also replace `_nfields` with `nfields` in summarysize.c when this is removed.

# ::ANY is deprecated in src/method.c
# also remove all instances of `jl_ANY_flag` in src/

# issue #13079
# in julia-parser.scm:
# move prec-bitshift after prec-rational
# remove parse-with-chains-warn and bitshift-warn
# update precedence table in doc/src/manual/mathematical-operations.md

# PR #22182
@deprecate is_apple Sys.isapple
@deprecate is_bsd Sys.isbsd
Expand All @@ -397,9 +388,6 @@ end

@deprecate_binding UVError IOError false

# issue #11310
# remove "parametric method syntax" deprecation in julia-syntax.scm

@deprecate momenttype(::Type{T}) where {T} typeof((zero(T)*zero(T) + zero(T)*zero(T))/2) false

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

# issue #22789
# remove code for `importall` in src/

# issue #17886
# deprecations for filter[!] with 2-arg functions are in abstractdict.jl

Expand Down Expand Up @@ -1720,7 +1705,6 @@ function factorial(x::Number)
end

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

@eval @deprecate $(Symbol("@schedule")) $(Symbol("@async"))
Expand Down
5 changes: 0 additions & 5 deletions base/essentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,6 @@ oftype(x, y) = convert(typeof(x), y)
unsigned(x::Int) = reinterpret(UInt, x)
signed(x::UInt) = reinterpret(Int, x)

# conversions used by ccall
ptr_arg_cconvert(::Type{Ptr{T}}, x) where {T} = cconvert(T, x)
ptr_arg_unsafe_convert(::Type{Ptr{T}}, x) where {T} = unsafe_convert(T, x)
ptr_arg_unsafe_convert(::Type{Ptr{Cvoid}}, x) = x

"""
cconvert(T,x)
Expand Down
6 changes: 3 additions & 3 deletions base/hashing2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function decompose(x::Float16)::NTuple{3,Int}
isinf(x) && return ifelse(x < 0, -1, 1), 0, 0
n = reinterpret(UInt16, x)
s = (n & 0x03ff) % Int16
e = (n & 0x7c00 >> 10) % Int
e = ((n & 0x7c00) >> 10) % Int
s |= Int16(e != 0) << 10
d = ifelse(signbit(x), -1, 1)
s, e - 25 + (e == 0), d
Expand All @@ -112,7 +112,7 @@ function decompose(x::Float32)::NTuple{3,Int}
isinf(x) && return ifelse(x < 0, -1, 1), 0, 0
n = reinterpret(UInt32, x)
s = (n & 0x007fffff) % Int32
e = (n & 0x7f800000 >> 23) % Int
e = ((n & 0x7f800000) >> 23) % Int
s |= Int32(e != 0) << 23
d = ifelse(signbit(x), -1, 1)
s, e - 150 + (e == 0), d
Expand All @@ -123,7 +123,7 @@ function decompose(x::Float64)::Tuple{Int64, Int, Int}
isinf(x) && return ifelse(x < 0, -1, 1), 0, 0
n = reinterpret(UInt64, x)
s = (n & 0x000fffffffffffff) % Int64
e = (n & 0x7ff0000000000000 >> 52) % Int
e = ((n & 0x7ff0000000000000) >> 52) % Int
s |= Int64(e != 0) << 52
d = ifelse(signbit(x), -1, 1)
s, e - 1075 + (e == 0), d
Expand Down
8 changes: 4 additions & 4 deletions doc/src/manual/mathematical-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,11 @@ Julia applies the following order and associativity of operations, from highest
|:-------------- |:------------------------------------------------------------------------------------------------- |:-------------------------- |
| Syntax | `.` followed by `::` | Left |
| Exponentiation | `^` | Right |
| Unary | `+ - √` | Right[^1] |
| Fractions | `//` | Left |
| Multiplication | `* / % & \ ÷` | Left[^2] |
| Unary | `+ - √` | Right[^1] |
| Bitshifts | `<< >> >>>` | Left |
| Addition | `+ - \| ⊻` | Left[^2] |
| Fractions | `//` | Left |
| Multiplication | `* / % & \ ÷` | Left[^2] |
| Addition | `+ - \| ⊻` | Left[^2] |
| Syntax | `: ..` | Left |
| Syntax | `\|>` | Left |
| Syntax | `<\|` | Right |
Expand Down
5 changes: 1 addition & 4 deletions src/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ jl_sym_t *call_sym; jl_sym_t *invoke_sym;
jl_sym_t *empty_sym; jl_sym_t *top_sym;
jl_sym_t *module_sym; jl_sym_t *slot_sym;
jl_sym_t *export_sym; jl_sym_t *import_sym;
jl_sym_t *importall_sym; jl_sym_t *toplevel_sym;
jl_sym_t *quote_sym; jl_sym_t *amp_sym;
jl_sym_t *toplevel_sym; jl_sym_t *quote_sym;
jl_sym_t *line_sym; jl_sym_t *jl_incomplete_sym;
jl_sym_t *goto_sym; jl_sym_t *goto_ifnot_sym;
jl_sym_t *return_sym; jl_sym_t *unreachable_sym;
Expand Down Expand Up @@ -334,7 +333,6 @@ void jl_init_frontend(void)
export_sym = jl_symbol("export");
import_sym = jl_symbol("import");
using_sym = jl_symbol("using");
importall_sym = jl_symbol("importall");
assign_sym = jl_symbol("=");
method_sym = jl_symbol("method");
exc_sym = jl_symbol("the_exception");
Expand All @@ -344,7 +342,6 @@ void jl_init_frontend(void)
const_sym = jl_symbol("const");
global_sym = jl_symbol("global");
thunk_sym = jl_symbol("thunk");
amp_sym = jl_symbol("&");
abstracttype_sym = jl_symbol("abstract_type");
primtype_sym = jl_symbol("primitive_type");
structtype_sym = jl_symbol("struct_type");
Expand Down
4 changes: 2 additions & 2 deletions src/ast.scm
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
(string #\( (deparse (caddr e)) " " (cadr e) " " (deparse (cadddr e)) #\) ))
(else
(deparse-prefix-call (cadr e) (cddr e) #\( #\)))))
(($ &) (if (pair? (cadr e))
(($ &) (if (and (pair? (cadr e)) (not (eq? (caadr e) 'outerref)))
(string (car e) "(" (deparse (cadr e)) ")")
(string (car e) (deparse (cadr e)))))
((|::|) (if (length= e 2)
Expand Down Expand Up @@ -200,7 +200,7 @@
(string.join (map deparse (cdr (cadddr e))) "\n") "\n"
"end"))
;; misc syntax forms
((import importall using)
((import using)
(define (deparse-path e)
(cond ((and (pair? e) (eq? (car e) '|.|))
(let loop ((lst (cdr e))
Expand Down
9 changes: 0 additions & 9 deletions src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,6 @@ static uintptr_t jl_object_id_(jl_value_t *tv, jl_value_t *v)
}
if (dt == jl_typename_type)
return ((jl_typename_t*)v)->hash;
#ifdef _P64
if (v == jl_ANY_flag)
return 0x31c472f68ee30bddULL;
#else
if (v == jl_ANY_flag)
return 0x8ee30bdd;
#endif
if (dt == jl_string_type) {
#ifdef _P64
return memhash_seed(jl_string_data(v), jl_string_len(v), 0xedc3b677);
Expand Down Expand Up @@ -1328,8 +1321,6 @@ void jl_init_primitives(void)

add_builtin("AbstractString", (jl_value_t*)jl_abstractstring_type);
add_builtin("String", (jl_value_t*)jl_string_type);

add_builtin("ANY", jl_ANY_flag);
}

#ifdef __cplusplus
Expand Down
9 changes: 1 addition & 8 deletions src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1560,14 +1560,7 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
// Julia (expression) value of current parameter
jl_value_t *argi = ccallarg(i);

// pass the address of the argument rather than the argument itself
if (jl_is_expr(argi) && ((jl_expr_t*)argi)->head == amp_sym) {
addressOf.push_back(true);
argi = jl_exprarg(argi, 0);
}
else {
addressOf.push_back(false);
}
addressOf.push_back(false);

argv[i] = emit_expr(ctx, argi);
}
Expand Down
2 changes: 1 addition & 1 deletion src/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -3180,7 +3180,7 @@ void jl_init_serializer(void)
jl_pointer_type, jl_vararg_type, jl_abstractarray_type, jl_void_type,
jl_densearray_type, jl_function_type, jl_typename_type,
jl_builtin_type, jl_task_type, jl_uniontype_type, jl_typetype_type,
jl_ANY_flag, jl_array_any_type, jl_intrinsic_type,
jl_array_any_type, jl_intrinsic_type,
jl_abstractslot_type, jl_methtable_type, jl_typemap_level_type,
jl_voidpointer_type, jl_newvarnode_type, jl_abstractstring_type,
jl_array_symbol_type, jl_anytuple_type, jl_tparam0(jl_anytuple_type),
Expand Down
1 change: 0 additions & 1 deletion src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,6 @@ static void mark_roots(jl_gc_mark_cache_t *gc_cache, gc_mark_sp_t *sp)
if (jl_cfunction_list != NULL)
gc_mark_queue_obj(gc_cache, sp, jl_cfunction_list);
gc_mark_queue_obj(gc_cache, sp, jl_anytuple_type_type);
gc_mark_queue_obj(gc_cache, sp, jl_ANY_flag);
for (size_t i = 0; i < N_CALL_CACHE; i++)
if (call_cache[i])
gc_mark_queue_obj(gc_cache, sp, call_cache[i]);
Expand Down
26 changes: 12 additions & 14 deletions src/jlfrontend.scm
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

(define (toplevel-only-expr? e)
(and (pair? e)
(or (memq (car e) '(toplevel line module import importall using export
(or (memq (car e) '(toplevel line module import using export
error incomplete))
(and (eq? (car e) 'global) (every symbol? (cdr e))
(every (lambda (x) (not (memq x '(true false)))) (cdr e))))))
Expand Down Expand Up @@ -140,15 +140,6 @@
(block
,loc
(call (core eval) ,name ,x)))
(if (&& (call (top isdefined) (core Main) (quote Base))
(call (top isdefined) (|.| (core Main) (quote Base)) (quote @deprecate)))
(call eval
(quote
(macrocall (|.| (|.| (core Main) (quote Base)) (quote @deprecate))
(line 0 none)
(call eval m x)
(call (|.| Core (quote eval)) m x) ; should be (core eval), but format as Core.eval(m, x) for deprecation warning
false))))
(= (call include ,x)
(block
,loc
Expand Down Expand Up @@ -267,14 +258,21 @@
((length= lno 2) `(,(cadr lno) none))
(else (cdr lno))))

(define (format-loc lno)
(let* ((lf (extract-line-file lno)) (line (car lf)) (file (cadr lf)))
(format-file-line file line #f)))

(define (format-file-line file line exactloc)
(if (or (= line 0) (eq? file 'none))
""
(string (if exactloc " at " " around ") file ":" line)))

(define (format-syntax-deprecation what instead file line exactloc)
(string "Deprecated syntax `" what "`"
(if (or (= line 0) (eq? file 'none))
""
(string (if exactloc " at " " around ") file ":" line))
(format-file-line file line exactloc)
"."
(if (equal? instead "") ""
(string #\newline "Use `" instead "` instead."))))
(string #\newline "Use `" instead "` instead."))))

; Corresponds to --depwarn 0="no", 1="yes", 2="error"
(define *depwarn-opt* 1)
Expand Down
3 changes: 0 additions & 3 deletions src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ JL_DLLEXPORT jl_value_t *jl_true;
JL_DLLEXPORT jl_value_t *jl_false;

jl_unionall_t *jl_typetype_type;
jl_value_t *jl_ANY_flag;

jl_unionall_t *jl_array_type;
jl_typename_t *jl_array_typename;
Expand Down Expand Up @@ -2168,8 +2167,6 @@ void jl_init_types(void)
(jl_unionall_t*)jl_new_struct(jl_unionall_type, typetype_tvar,
jl_apply_type1((jl_value_t*)jl_type_type, (jl_value_t*)typetype_tvar));

jl_ANY_flag = (jl_value_t*)tvar("ANY");

jl_abstractstring_type = jl_new_abstracttype((jl_value_t*)jl_symbol("AbstractString"), core, jl_any_type, jl_emptysvec);
jl_string_type = jl_new_datatype(jl_symbol("String"), core, jl_abstractstring_type, jl_emptysvec,
jl_emptysvec, jl_emptysvec, 0, 1, 0);
Expand Down
Loading

0 comments on commit b60dce5

Please sign in to comment.