Skip to content

Commit e765453

Browse files
authored
Merge pull request #25 from JuliaAlgebra/revert-#14
Revert #14 for Julia 0.6
2 parents 96368fe + 1c245d4 commit e765453

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

src/mono.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ function Monomial{C}(α) where C
2828
α == 1 || error("Cannot convert to a Monomial{$C} as it is not one")
2929
Monomial{C}(PolyVar{C}[], Int[])
3030
end
31-
# defaults to commutative so that `Monomial(1)` is consistent with TypedPolynomials
32-
Monomial(α) = Monomial{true}(α)
31+
32+
@static if VERSION v"0.7-"
33+
# defaults to commutative so that `Monomial(1)` is consistent with TypedPolynomials
34+
Monomial::Number) = Monomial{true}(α)
35+
end
3336

3437
Base.copy(m::M) where {M<:Monomial} = M(m.vars, copy(m.z))
3538

test/mono.jl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@
2525
@test zeroterm(Monomial{false}) == 0
2626
@test zero(Monomial{false}) == 0
2727
@test one(Monomial{true}) == 1
28-
@test_throws ErrorException Monomial(2)
29-
@test (@inferred Monomial(1)) isa Monomial{true}
30-
@test Monomial(1) == 1
31-
@test_throws ErrorException Monomial{true}(2)
32-
@test (@inferred Monomial{true}(1)) isa Monomial{true}
33-
@test Monomial{true}(1) == 1
34-
@test_throws ErrorException Monomial{false}(2)
35-
@test (@inferred Monomial{false}(1)) isa Monomial{false}
36-
@test Monomial{false}(1) == 1
28+
if VERSION v"0.7-"
29+
@test_throws ErrorException Monomial(2)
30+
@test (@inferred Monomial(1)) isa Monomial{true}
31+
@test Monomial(1) == 1
32+
@test_throws ErrorException Monomial{true}(2)
33+
@test (@inferred Monomial{true}(1)) isa Monomial{true}
34+
@test Monomial{true}(1) == 1
35+
@test_throws ErrorException Monomial{false}(2)
36+
@test (@inferred Monomial{false}(1)) isa Monomial{false}
37+
@test Monomial{false}(1) == 1
38+
end
3739
@polyvar x
3840
@test_throws ArgumentError Monomial{true}([x], [1,0])
3941
@test zeroterm(x^2) isa Term{true, Int}

0 commit comments

Comments
 (0)