File tree 2 files changed +14
-9
lines changed
2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,11 @@ function Monomial{C}(α) where C
28
28
α == 1 || error (" Cannot convert $α to a Monomial{$C } as it is not one" )
29
29
Monomial {C} (PolyVar{C}[], Int[])
30
30
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
33
36
34
37
Base. copy (m:: M ) where {M<: Monomial } = M (m. vars, copy (m. z))
35
38
Original file line number Diff line number Diff line change 27
27
@test one (Monomial{true }) == 1
28
28
@test_throws ErrorException Monomial (2 )
29
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
30
+ if VERSION ≥ v " 0.7-"
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
37
39
@polyvar x
38
40
@test_throws ArgumentError Monomial {true} ([x], [1 ,0 ])
39
41
@test zeroterm (x^ 2 ) isa Term{true , Int}
You can’t perform that action at this time.
0 commit comments