@@ -309,16 +309,15 @@ function standardise(ex, store::NamedTuple, call::CallInfo; LHS=false)
309309 # Combined indices A[i,(j,k)]
310310 if any (istensor, ijk)
311311 flatsize = map (axwrap, flat)
312- A = :( reshape ($ A, ($ (flatsize... ),)) )
312+ A = :( Base . reshape ($ A, ($ (flatsize... ),)) )
313313 append! (store. need, flat)
314- # push!(store.mustassert, :( TensorCast.@assert_ !(A isa OffsetArray) "can't combine indices of an OffsetArray") ) # ??
315314 end
316315
317316 # Reversed A[-i,j] and shuffled A[i,~j]
318317 if ! isempty (reversed)
319318 A = maybepush (A, store, :prereverse )
320319 rind = map (1 : length (flat)) do d
321- flat[d] in reversed ? :($ reverse ($ axes ($ A,$ d))) : (:)
320+ flat[d] in reversed ? :($ reverse (Base . axes ($ A,$ d))) : (:)
322321 end
323322 rdims = Tuple (indexin (reversed, flat))
324323 if (:lazy_0 in call. flags) && ! LHS
@@ -339,7 +338,7 @@ function standardise(ex, store::NamedTuple, call::CallInfo; LHS=false)
339338 if ! isempty (shuffled)
340339 A = maybepush (A, store, :preshuffle )
341340 sind = map (1 : length (flat)) do d
342- flat[d] in shuffled ? :($ shuffle ($ axes ($ A,$ d))) : (:)
341+ flat[d] in shuffled ? :($ shuffle (Base . axes ($ A,$ d))) : (:)
343342 end
344343 if (:lazy_0 in call. flags) && ! LHS
345344 if length (flat) == 1
@@ -636,14 +635,14 @@ function recursemacro(ex::Expr, canon, store::NamedTuple, call::CallInfo)
636635 # The original purpose was to look for recursion, meaning @reduce within @cast etc:
637636 if @capture (ex, @reduce (subex__) )
638637 subcall = CallInfo (call. mod, call. src,
639- TensorCast. unparse (" innder @reduce" , subex... ), Set ([:reduce , :recurse ]))
638+ TensorCast. unparse (" inner @reduce" , subex... ), Set ([:reduce , :recurse ]))
640639 name, ind, scalar, steps = _macro (subex... ; call= subcall, dict= store. dict)
641640 append! (store. main, steps)
642641 ex = scalar ? :($ name) : :($ name[$ (ind... )])
643642
644643 elseif @capture (ex, @matmul (subex__) )
645644 subcall = CallInfo (call. mod, call. src,
646- TensorCast. unparse (" innder @matmul" , subex... ), Set ([:matmul , :recurse ]))
645+ TensorCast. unparse (" inner @matmul" , subex... ), Set ([:matmul , :recurse ]))
647646 name, ind, scalar, steps = _macro (subex... ; call= subcall, dict= store. dict)
648647 append! (store. main, steps)
649648 ex = scalar ? :($ name) : :($ name[$ (ind... )])
@@ -900,7 +899,7 @@ function indexparse(A, ijk::Vector, store=nothing, call=nothing; save=false)
900899 if iscolon (i)
901900 if i isa QuoteNode && A != :_
902901 str = " fixed size in $A [" * join (ijk, " , " ) * " ]" # DimensionMismatch("fixed size in M[i, \$(QuoteNode(5))]: size(M, 2) == 5") TODO print more nicely
903- push! (store. mustassert, :( size ($ A,$ d)== $ (i. value) || throw (ArgumentError ($ str))) )
902+ push! (store. mustassert, :( Base . size ($ A,$ d)== $ (i. value) || throw (ArgumentError ($ str))) )
904903 end
905904 continue
906905 end
@@ -909,7 +908,7 @@ function indexparse(A, ijk::Vector, store=nothing, call=nothing; save=false)
909908 push! (outaxes, Base. OneTo (1 ))
910909 if i == :_ && A != :_ && save
911910 str = " underscore in $A [" * join (ijk, " , " ) * " ]"
912- push! (store. mustassert, :( size ($ A,$ d)== 1 || throw (ArgumentError ($ str))) )
911+ push! (store. mustassert, :( Base . size ($ A,$ d)== 1 || throw (ArgumentError ($ str))) )
913912 end
914913 continue
915914 end
@@ -918,7 +917,7 @@ function indexparse(A, ijk::Vector, store=nothing, call=nothing; save=false)
918917 stripminustilde! (ii, reversed, shuffled)
919918 append! (flat, ii)
920919 push! (outaxes, axwrap (ii))
921- save && A != :_ && saveonesize (ii, :(axes ($ A, $ d)), store)
920+ save && A != :_ && saveonesize (ii, :(Base . axes ($ A, $ d)), store)
922921
923922 elseif @capture (i, B_[klm__])
924923 innerparse (B, klm, store, call) # called just for error on tensor/colon/constant
@@ -928,7 +927,7 @@ function indexparse(A, ijk::Vector, store=nothing, call=nothing; save=false)
928927 elseif i isa Symbol
929928 push! (flat, i)
930929 push! (outaxes, axwrap (i))
931- save && A != :_ && saveonesize (i, :(axes ($ A, $ d)), store)
930+ save && A != :_ && saveonesize (i, :(Base . axes ($ A, $ d)), store)
932931 else
933932 throw (MacroError (" don't understand index $i " , call))
934933 end
@@ -937,7 +936,7 @@ function indexparse(A, ijk::Vector, store=nothing, call=nothing; save=false)
937936 if save && length (ijk)> 0 && A != :_
938937 N = length (ijk)
939938 str = " expected a $N -tensor $A [" * join (ijk, " , " ) * " ]"
940- push! (store. assert, :( ndims ($ A)== $ N || throw (ArgumentError ($ str))) )
939+ push! (store. assert, :( Base . ndims ($ A)== $ N || throw (ArgumentError ($ str))) )
941940 end
942941
943942 if length (flat)== 2 && flat[1 ]== flat[2 ] # allow for diag, A[i,i]
@@ -994,7 +993,7 @@ function innerparse(firstA, ijk, store::NamedTuple, call::CallInfo; save=false)
994993 else
995994 push! (innerflat, i)
996995 end
997- save && saveonesize (i, :(axes ($ firstA, $ d)), store)
996+ save && saveonesize (i, :(Base . axes ($ firstA, $ d)), store)
998997 end
999998
1000999 checknorepeats (innerflat, call)
@@ -1355,16 +1354,16 @@ function matrixshape(ex, left::Vector, right::Vector, store::NamedTuple, call::C
13551354 # Deal with simple matrix, and with empty right of V in M*V
13561355 length (left) == 1 && length (right) <= 1 && return ex
13571356 # and empty right because it's M * vec(T)
1358- isempty (right) && return :( reshape ($ ex, :) )
1357+ isempty (right) && return :( Base . reshape ($ ex, :) )
13591358
13601359 # Deal with empty left of V in V'*M, or perhaps V=vec(T) first
13611360 if isempty (left)
13621361 if length (right) == 1
13631362 # return :( TensorCast.PermuteDims($ex) )
1364- return :( transpose ($ ex) )
1363+ return :( Base . transpose ($ ex) )
13651364 else
13661365 # return :( TensorCast.PermuteDims(reshape($ex, :)) )
1367- return :( transpose (reshape ($ ex, :)) )
1366+ return :( Base . transpose (Base . reshape ($ ex, :)) )
13681367 end
13691368 end
13701369
@@ -1374,7 +1373,7 @@ function matrixshape(ex, left::Vector, right::Vector, store::NamedTuple, call::C
13741373 append! (store. need, left)
13751374 append! (store. need, right)
13761375 # push!(call.flags, :reshaped)
1377- return :( reshape ($ ex, ($ left_sz,$ right_sz)) )
1376+ return :( Base . reshape ($ ex, ($ left_sz,$ right_sz)) )
13781377end
13791378
13801379function unmatrixshape (ex, left:: Vector , right:: Vector , store:: NamedTuple , call:: CallInfo )
@@ -1384,7 +1383,7 @@ function unmatrixshape(ex, left::Vector, right::Vector, store::NamedTuple, call:
13841383 # For V' * V, did we want a scalar or not? What we will get is unknown to the macro:
13851384 if length (left) == 0 && length (right) == 0
13861385 if :scalar in call. flags
1387- return :( first ($ ex) )
1386+ return :( Base . first ($ ex) )
13881387 # If you had arrays of arrays, then PermuteDims would have permutedims-ed, and * would make an array, so this is still OK.
13891388 else
13901389 return :( Base. fill ($ ex) ) # zero-dim array
@@ -1393,7 +1392,6 @@ function unmatrixshape(ex, left::Vector, right::Vector, store::NamedTuple, call:
13931392
13941393 # For V'*M, you may get a Transpose row-vector, for which this is .parent:
13951394 if length (left) == 0
1396- # ex = :( TensorCast.rview($ex, 1,:) )
13971395 ex = :( TensorCast. transmute ($ ex, (2 ,)) )
13981396 length (right) == 1 && return ex # literally V'*M done,
13991397 # but for V'*T we should reshape this .parent
@@ -1404,7 +1402,7 @@ function unmatrixshape(ex, left::Vector, right::Vector, store::NamedTuple, call:
14041402 append! (store. need, left)
14051403 append! (store. need, right)
14061404 # push!(call.flags, :reshaped)
1407- return :( reshape ($ ex, ($ (sizes... ),)) )
1405+ return :( Base . reshape ($ ex, ($ (sizes... ),)) )
14081406end
14091407
14101408function increasing_or_zero (tup:: Tuple , prev= 0 ) # strictly increasing, allows nothing or 0
@@ -1505,24 +1503,24 @@ function newoutput(ex, canon, parsed, store::NamedTuple, call::CallInfo)
15051503 perm = Tuple (map (i -> isconstant (i) ? nothing : (_d+= 1 ), parsed. inner))
15061504 # ex = :(TensorCast.orient.($Asafe, Ref($code)) ) # @. would need a dollar
15071505 # refperm = maybepush(:( Ref() ), store, :zzz)
1508- ex = :(TensorCast. transmute .($ Asafe, Ref ($ perm)) )
1506+ ex = :(TensorCast. transmute .($ Asafe, Base . Ref ($ perm)) )
15091507 end
15101508 end
15111509
15121510 # Must we collect? Do this now, as reshape(TransmutedDimsArray(...)) is awful.
15131511 if :collect in call. flags
15141512 if :strided in call. flags
1515- ex = :( collect ($ ex) )
1513+ ex = :( Base . collect ($ ex) )
15161514 elseif ! (:collected in call. flags)
1517- ex = :( identity .($ ex) )
1515+ ex = :( Base . identity .($ ex) )
15181516 end
15191517 end
15201518
15211519 # Do we need to reshape the container? Simple cases done with transmute(), avoiding sz_i
15221520 if any (i -> istensor (i) || isconstant (i), parsed. outer)
15231521 any (i -> isconstant (i) && ! (i == :_ || i == 1 ), parsed. outer) && throw (MacroError (" can't fix output index to $i , only to 1" , call))
15241522 if any (istensor, parsed. outer)
1525- ex = :( reshape ($ ex, ($ (parsed. outaxes... ),)) )
1523+ ex = :( Base . reshape ($ ex, ($ (parsed. outaxes... ),)) )
15261524 append! (store. need, parsed. flat)
15271525 else
15281526 _d = 0
@@ -1559,7 +1557,7 @@ function inplaceoutput(ex, canon, parsed, store::NamedTuple, call::CallInfo)
15591557 zed isa Symbol || @capture (zed, ZZ_. field_) || error (" wtf" )
15601558 newleft = parsed. left
15611559 str = " expected a 0-tensor $zed []"
1562- push! (store. mustassert, :( ndims ($ zed)== 0 || throw (ArgumentError ($ str))) )
1560+ push! (store. mustassert, :( Base . ndims ($ zed)== 0 || throw (ArgumentError ($ str))) )
15631561 else
15641562 newleft = standardise (parsed. left, store, call)
15651563 @capture (newleft, zed_[ijk__]) || throw (MacroError (" failed to parse LHS correctly, $(parsed. left) -> $newleft " ))
0 commit comments