Skip to content

Commit 3257ec9

Browse files
Merge pull request #20529 from JuliaLang/jb/improvedeps
improve two deprecations
2 parents 5ded761 + 02f020e commit 3257ec9

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

base/client.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,13 @@ function parse_input_line(s::String; filename::String="none")
204204
# throw(ParseError("extra input after end of expression"))
205205
# end
206206
# expr
207-
ccall(:jl_parse_input_line, Any, (Ptr{UInt8}, Csize_t, Ptr{UInt8}, Csize_t),
208-
s, sizeof(s), filename, sizeof(filename))
207+
ex = ccall(:jl_parse_input_line, Any, (Ptr{UInt8}, Csize_t, Ptr{UInt8}, Csize_t),
208+
s, sizeof(s), filename, sizeof(filename))
209+
if ex === :_
210+
# remove with 0.6 deprecation
211+
expand(ex) # to get possible warning about using _ as an rvalue
212+
end
213+
return ex
209214
end
210215
parse_input_line(s::AbstractString) = parse_input_line(String(s))
211216

base/deprecated.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,8 @@ for name in ("alnum", "alpha", "cntrl", "digit", "number", "graph",
12271227
@eval @deprecate ($f)(s::AbstractString) all($f, s)
12281228
end
12291229

1230+
# TODO: remove warning for using `_` in parse_input_line in base/client.jl
1231+
12301232
# END 0.6 deprecations
12311233

12321234
# BEGIN 1.0 deprecations

src/julia-syntax.scm

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,8 +756,15 @@
756756
(sig (car temp))
757757
(params (cdr temp)))
758758
(if (pair? params)
759-
(syntax-deprecation #f (string "inner constructor " name "(...)")
760-
(deparse `(where (call (curly ,name ,@params) ...) ,@params))))
759+
(let* ((lnos (filter (lambda (e) (and (pair? e) (eq? (car e) 'line)))
760+
body))
761+
(lno (if (null? lnos) '() (car lnos))))
762+
(syntax-deprecation #f
763+
(string "inner constructor " name "(...)"
764+
(cond ((length= lno 2) (string " around line " (cadr lno)))
765+
((length= lno 3) (string " around " (caddr lno) ":" (cadr lno)))
766+
(else "")))
767+
(deparse `(where (call (curly ,name ,@params) ...) ,@params)))))
761768
`(,keyword ,sig ,(ctor-body body params)))))))
762769

763770
;; rewrite calls to `new( ... )` to `new` expressions on the appropriate

0 commit comments

Comments
 (0)