Noted.

https://github.com/tonyhffong/Lint.jl/issues/127


On Saturday, March 12, 2016 at 3:58:58 PM UTC-5, Milan Bouchet-Valat wrote:
>
> Le samedi 12 mars 2016 à 12:30 -0800, Douglas Bates a écrit : 
> > I have been adding more tests to the MixedModels package and 
> > encountered a peculiar situation where, AFAICS, a test should produce 
> > one type of failure and it doesn't.  It fails at a later point but I 
> > can't see how it gets there. 
> > 
> > To reproduce, check out a copy of the MixedModels master branch. 
> > 
> > Pkg.add("MixedModels") 
> > Pkg.checkout("MixedModels") 
> > MixedModels.inject!(speye(4), sparse(ones(4, 4))) 
> > 
> > The unexported function inject!(A, B) zeros A, then copies the 
> > contents B into A.   For sparse matrices, the nonzero positions of B 
> > must be a subset of those in A.  What I expect to happen in this case 
> > is that the code will enter the block in lines 52 - 54 of https://git 
> > hub.com/dmbates/MixedModels.jl/blob/master/src/inject.jl.  In fact, 
> > if you uncomment line 51 in that file the output from the @show macro 
> > shows that indeed  
> > 
> > kk > length(dnzrv) 
> > 
> > the second time through the "for k in snzr" loop.  But when I run 
> > that example, the error thrown is a BoundsError at line 55.   What I 
> > don't understand is how it gets to line 55 the second time through 
> > the loop. 
> > 
> > I have been looking at this for a long time trying to see if I am 
> > doing something stupid but I can't.  Does the BoundsError get thrown 
> > for others?  My versioninfo is 
> I was puzzled for a few minutes too, but the explanation is actually 
> quite simple: you need to call throw() on the error, i.e. 
> throw(ArgumentError("cannot inject sparse s into sparse d")) 
>
> This is indeed an easy to make and hard to spot mistake. Maybe a code 
> checking tool like Lint.jl would/could have detected that the 
> ArgumentError wasn't used at all. 
>
>
> Regards 
>
> > julia> versioninfo() 
> > Julia Version 0.4.2 
> > Commit bb73f34 (2015-12-06 21:47 UTC) 
> > Platform Info: 
> >   System: Linux (x86_64-linux-gnu) 
> >   CPU: Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz 
> >   WORD_SIZE: 64 
> >   BLAS: libopenblas (NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY Prescott) 
> >   LAPACK: liblapack.so.3 
> >   LIBM: libopenlibm 
> >   LLVM: libLLVM-3.3 
> > 
> > I haven't upgraded to 0.4.3 because the Ubuntu package is not yet 
> > available but I can test on 0.4.3 if that would help. 
>

Reply via email to