Vimes.jl icon indicating copy to clipboard operation
Vimes.jl copied to clipboard

`using` statements should not be valid for `swaplines`

Open oxinabox opened this issue 6 years ago • 2 comments

using statements are basically order free. (unless you have code between them)

I got this diff:

diff --git a/./src/Foo.jl b/var/folders/1r/4cjj1xk90qbb6njj7dn_cmt40000gn/T/vimes-16332293967793207509/src/Foo.jl
index 458aba8..1915a99 100644
--- a/./src/Foo.jl
+++ b/var/folders/1r/4cjj1xk90qbb6njj7dn_cmt40000gn/T/vimes-16332293967793207509/src/Foo.jl
@@ -1,7 +1,7 @@
 module Foo
 
-using Distributions
 using LinearAlgebra: dot, norm
+using Distributions
 using NamedDims
 
 include("evaluate.jl")

oxinabox avatar Jul 12 '19 11:07 oxinabox

That makes sense. Should be fairly easy to add a check for this.

MikeInnes avatar Jul 12 '19 12:07 MikeInnes

Similarly for swapping method definitions. Should there be some way of putting a partial order on statements in a basic block and then only considering swaps that violate the partial order?

StefanKarpinski avatar Jul 12 '19 15:07 StefanKarpinski