using DynamicPolynomials
@polyvar x
a = x^2
b = x
# This runs without error
randn(2, 2) * [a, b]
# This throws StackOverflowError
randn(2, 2) * [p for p in (a, b)]
# The importance difference seems to be these types
@assert typeof([a, b]) == Vector{Monomial{DynamicPolynomials.Commutative{DynamicPolynomials.CreationOrder}, Graded{LexOrder}}}
@assert typeof([p for p in (a, b)]) == Vector{AbstractMonomialLike}