diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60ce8d3ce..8ce27b5bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,9 +32,9 @@ jobs: matrix: julia-version: - "min" - - "lts" + #- "lts" - "1" - - "pre" + #- "pre" os: - ubuntu-latest - macos-latest diff --git a/Project.toml b/Project.toml index 50e3cba77..c02c28857 100644 --- a/Project.toml +++ b/Project.toml @@ -7,6 +7,7 @@ ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +NestedNumbers = "1f6363f3-4ba7-41a3-bcac-d685ef427933" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" [weakdeps] @@ -36,6 +37,7 @@ LaTeXStrings = "1.2.0" Latexify = "0.16.8" LinearAlgebra = "<0.0.1, 1" NaNMath = "1" +NestedNumbers = "0.1" Printf = "<0.0.1, 1" REPL = "<0.0.1, 1" Random = "<0.0.1, 1" @@ -58,3 +60,6 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] test = ["Aqua", "ConstructionBase", "ForwardDiff", "InverseFunctions", "Latexify", "LaTeXStrings", "LinearAlgebra", "NaNMath", "Test", "Random", "REPL", "Printf"] + +[sources] +NestedNumbers = {url = "https://github.com/JuliaMath/NestedNumbers.jl"} diff --git a/docs/Project.toml b/docs/Project.toml index e70dbbffb..899bb0406 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -11,6 +11,7 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" tectonic_jll = "d7dd28d6-a5e6-559c-9131-7eb760cdacc5" [sources] +NestedNumbers = {url = "https://github.com/JuliaMath/NestedNumbers.jl"} Unitful = {path = ".."} [compat] @@ -18,3 +19,6 @@ Documenter = "1" Latexify = "0.16.10" Plots = "1" Fontconfig = "0.4" + +[extras] +NestedNumbers = "1f6363f3-4ba7-41a3-bcac-d685ef427933" diff --git a/src/Unitful.jl b/src/Unitful.jl index 9769c4296..9a31760ff 100644 --- a/src/Unitful.jl +++ b/src/Unitful.jl @@ -27,6 +27,8 @@ import LinearAlgebra: Diagonal, Bidiagonal, Tridiagonal, SymTridiagonal import LinearAlgebra: istril, istriu, norm import Random +import NestedNumbers + export logunit, unit, absoluteunit, dimension, uconvert, ustrip, upreferred export @dimension, @derived_dimension, @refunit, @unit, @affineunit, @u_str export Quantity, DimensionlessQuantity, NoUnits, NoDims diff --git a/src/types.jl b/src/types.jl index dcb651fca..b96d8086c 100644 --- a/src/types.jl +++ b/src/types.jl @@ -138,7 +138,7 @@ FixedUnits(::Units{N,D,A}) where {N,D,A} = FixedUnits{N,D,A}() """ - abstract type AbstractQuantity{T,D,U} <: Number end + abstract type AbstractQuantity{T,D,U} <: NestedNumbers.QuantityNumber{T} end Represents a generic quantity type, whose dimensions and units are specified in the type signature. The dimensions and units are allowed to be the empty set, in which case a dimensionless, unitless number results. @@ -148,7 +148,7 @@ The type parameter `T` represents the numeric backing type. The type parameters Of course, the dimensions follow from the units, but the type parameters are kept separate to permit convenient dispatch on dimensions. """ -abstract type AbstractQuantity{T,D,U} <: Number end +abstract type AbstractQuantity{T,D,U} <: NestedNumbers.QuantityNumber{T} end """ struct Quantity{T,D,U} <: AbstractQuantity{T,D,U}