Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve two deprecations #20529

Merged
merged 2 commits into from
Feb 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,13 @@ function parse_input_line(s::String; filename::String="none")
# throw(ParseError("extra input after end of expression"))
# end
# expr
ccall(:jl_parse_input_line, Any, (Ptr{UInt8}, Csize_t, Ptr{UInt8}, Csize_t),
s, sizeof(s), filename, sizeof(filename))
ex = ccall(:jl_parse_input_line, Any, (Ptr{UInt8}, Csize_t, Ptr{UInt8}, Csize_t),
s, sizeof(s), filename, sizeof(filename))
if ex === :_
# remove with 0.6 deprecation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best practice at the moment is to drop a comment in base/deprecated.jl about this TODO.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

expand(ex) # to get possible warning about using _ as an rvalue
end
return ex
end
parse_input_line(s::AbstractString) = parse_input_line(String(s))

Expand Down
2 changes: 2 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,8 @@ for name in ("alnum", "alpha", "cntrl", "digit", "number", "graph",
@eval @deprecate ($f)(s::AbstractString) all($f, s)
end

# TODO: remove warning for using `_` in parse_input_line in base/client.jl

# END 0.6 deprecations

# BEGIN 1.0 deprecations
Expand Down
11 changes: 9 additions & 2 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,15 @@
(sig (car temp))
(params (cdr temp)))
(if (pair? params)
(syntax-deprecation #f (string "inner constructor " name "(...)")
(deparse `(where (call (curly ,name ,@params) ...) ,@params))))
(let* ((lnos (filter (lambda (e) (and (pair? e) (eq? (car e) 'line)))
body))
(lno (if (null? lnos) '() (car lnos))))
(syntax-deprecation #f
(string "inner constructor " name "(...)"
(cond ((length= lno 2) (string " around line " (cadr lno)))
((length= lno 3) (string " around " (caddr lno) ":" (cadr lno)))
(else "")))
(deparse `(where (call (curly ,name ,@params) ...) ,@params)))))
`(,keyword ,sig ,(ctor-body body params)))))))

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