# Using Deprecations.jl (and more generally on updating syntax)

**URL:** https://discourse.julialang.org/t/using-deprecations-jl-and-more-generally-on-updating-syntax/6490
**Category:** General Usage
**Tags:** syntax, femtocleaner
**Created:** [October 17, 2017, 2:30am UTC](https://discourse.julialang.org/t/using-deprecations-jl-and-more-generally-on-updating-syntax/6490 "2017-10-17T02:30:55Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![colintbowers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/colintbowers/32/8033_2.png) [@colintbowers](https://discourse.julialang.org/u/colintbowers)
#### Post date: [October 17, 2017, 2:30am UTC](https://discourse.julialang.org/t/using-deprecations-jl-and-more-generally-on-updating-syntax/6490/1 "2017-10-17T02:30:55Z")

</div>

Hi all,

I’m in the process of upgrading some v0.5 code to v0.7. For various reasons this code is on a local machine rather than a GitHub repository, so [FemtoCleaner](https://github.com/JuliaComputing/FemtoCleaner.jl) is not an option (that I’m aware of - maybe there is a way to use it locally?).

Instead, I’ve cloned [Deprecations.jl](https://github.com/JuliaComputing/Deprecations.jl) and was hoping to use the `edit_text` and `edit_file` functions in this package. However, I can’t get the package to load on either v0.6 or v0.7. Note, for both versions, I checked out both `AbstractTrees` and `CSTParser` so they’re on master. The issue appears to be in `Deprecations` itself. Specifically, when `using Deprecations`, I get the following error:

> ERROR: LoadError: LoadError: LoadError: TypeError: in Type{…} expression, expected UnionAll, got Type{CSTParser.OPERATOR}  
> Stacktrace:  
> [1] include\_relative(::Module, ::String) at ./loading.jl:464  
> [2] include at ./sysimg.jl:14 [inlined]  
> [3] include(::String) at /home/colin/.julia/v0.7/Deprecations/src/Deprecations.jl:1  
> [4] include\_relative(::Module, ::String) at ./loading.jl:464  
> [5] include at ./sysimg.jl:14 [inlined]  
> [6] include(::String) at /home/colin/.julia/v0.7/Deprecations/src/Deprecations.jl:1  
> [7] include\_relative(::Module, ::String) at ./loading.jl:464  
> [8] \_require(::Symbol) at ./loading.jl:401  
> [9] require(::Symbol) at ./loading.jl:318  
> while loading /home/colin/.julia/v0.7/Deprecations/src/database/versioncompare.jl, in expression starting on line 54  
> while loading /home/colin/.julia/v0.7/Deprecations/src/database.jl, in expression starting on line 9  
> while loading /home/colin/.julia/v0.7/Deprecations/src/Deprecations.jl, in expression starting on line 71

The line that is causing the problem follows:

```
opcode(x::EXPR{CSTParser.OPERATOR{6,op,false}}) where {op} = op

```

I’m not too familiar with `UnionAll` or how it works (am currently reading up), but I thought I would simultaneously check if the community has any ideas about how to either fix this issue, or else another way to update my code that doesn’t involve FemtoCleaner and Github.

Thanks in advance.

Colin

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [October 17, 2017, 4:52am UTC](https://discourse.julialang.org/t/using-deprecations-jl-and-more-generally-on-updating-syntax/6490/2 "2017-10-17T04:52:17Z")

</div>

I am quite sure Deprecations.jl does not work with CSTParser master. I intend to upgrade it in the coming days though.

---

<div class="post-metadata">

### Author: ![colintbowers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/colintbowers/32/8033_2.png) [@colintbowers](https://discourse.julialang.org/u/colintbowers)
#### Post date: [October 17, 2017, 4:58am UTC](https://discourse.julialang.org/t/using-deprecations-jl-and-more-generally-on-updating-syntax/6490/3 "2017-10-17T04:58:48Z")

</div>

Thanks for responding. I just checked, and I get the same error message regardless of whether `CSTParser` is on stable or master. But I’ll keep an eye out for the upgrade and come back and try `Deprecations` again once it goes through.

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [October 17, 2017, 10:53am UTC](https://discourse.julialang.org/t/using-deprecations-jl-and-more-generally-on-updating-syntax/6490/4 "2017-10-17T10:53:41Z")

</div>

You might have to downgrade CSTParser to the previous version.

---

<div class="post-metadata">

### Author: ![colintbowers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/colintbowers/32/8033_2.png) [@colintbowers](https://discourse.julialang.org/u/colintbowers)
#### Post date: [October 17, 2017, 11:21am UTC](https://discourse.julialang.org/t/using-deprecations-jl-and-more-generally-on-updating-syntax/6490/5 "2017-10-17T11:21:03Z")

</div>

I’ll try that and if I can get it to work I’ll post the details here.  
Cheers -colin

---

<div class="post-metadata">

### Author: ![colintbowers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/colintbowers/32/8033_2.png) [@colintbowers](https://discourse.julialang.org/u/colintbowers)
#### Post date: [October 17, 2017, 11:50pm UTC](https://discourse.julialang.org/t/using-deprecations-jl-and-more-generally-on-updating-syntax/6490/6 "2017-10-17T23:50:38Z")

</div>

Yep, that did it! For other users, on v0.6 I used `Pkg.pin("CSTParser", v"0.2.1")`, and `using Deprecations` now works fine.

Two quick questions:

1. I found that the `edit_file` function in `Deprecations` doesn’t work if you input just the file-name (as a `String`). I think this is because the second argument to `edit_file` is supposed to have a default value, but currently does not. I haven’t lodged this as an issue because I’m not sure if it is actually supposed to be this way. I got around this by going to line 171 in Deprecations.jl, and pasting the default value for the second argument (`deps`) from the `edit_markdown` function immediately below, and everything seems to work fine now. If you think this is an appropriate fix, let me know and I’d be happy to open a PR on `Deprecations`.

2. I noticed that the parser does not currently fix up parametric type syntax in method signatures if the method signature includes a parametric return type declaration. That is, the parser is able to update `f{T}(x::T) = x` to `f(x::T) where {T} = x` without a problem, but it is not able to update `f{T}(x::T)::T = x` to `(f(x::T) where {T})::T = x` (which I understand is the appropriate new syntax). Is this a known issue? Is there somewhere I should mention this? (or perhaps it is something I can add myself?)

Cheers, and thanks for all the help.

Colin
