@@ -580,3 +580,35 @@ g40612(a, b) = a[]|a[] === b[]|b[]
580580@test g40612 (Union{Bool,Missing}[missing ], Union{Bool,Missing}[missing ])
581581@test g40612 (Union{Bool,Missing}[true ], Union{Bool,Missing}[true ])
582582@test g40612 (Union{Bool,Missing}[false ], Union{Bool,Missing}[false ])
583+
584+ # issue #41096
585+ struct Modulate41096{M<: Union{Function, Val{true}, Val{false}} , id}
586+ modulate:: M
587+ Modulate41096 (id:: Symbol , modulate:: Function ) = new {typeof(modulate), id} (modulate)
588+ Modulate41096 (id:: Symbol , modulate:: Bool = true ) = new {Val{modulate}, id} (modulate|> Val)
589+ end
590+ @inline ismodulatable41096 (modulate:: Modulate41096 ) = ismodulatable41096 (typeof (modulate))
591+ @inline ismodulatable41096 (:: Type{<:Modulate41096{Val{B}}} ) where B = B
592+ @inline ismodulatable41096 (:: Type{<:Modulate41096{<:Function}} ) = true
593+
594+ mutable struct Term41096{I, M<: Modulate41096 }
595+ modulate:: M
596+ Term41096 {I} (modulate:: Modulate41096 ) where I = new {I, typeof(modulate)} (modulate)
597+ end
598+ @inline ismodulatable41096 (term:: Term41096 ) = ismodulatable41096 (typeof (term))
599+ @inline ismodulatable41096 (:: Type{<:Term41096{I, M} where I} ) where M = ismodulatable41096 (M)
600+
601+ function newexpand41096 (gen, name:: Symbol )
602+ flag = ismodulatable41096 (getfield (gen, name))
603+ if flag
604+ return true
605+ else
606+ return false
607+ end
608+ end
609+
610+ t41096 = Term41096 {:t} (Modulate41096 (:t , false ))
611+ μ41096 = Term41096 {:μ} (Modulate41096 (:μ , false ))
612+ U41096 = Term41096 {:U} (Modulate41096 (:U , false ))
613+
614+ @test ! newexpand41096 ((t= t41096, μ= μ41096, U= U41096), :U )
0 commit comments