Skip to content

Commit

Permalink
Added PhysicalUnit typealias to avoid confusion and import ambiguity
Browse files Browse the repository at this point in the history
with kotlin.Unit.
  • Loading branch information
Zack Juhasz committed Sep 11, 2017
1 parent 3c1ddac commit ce7f221
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion complete-units/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
group 'org.tenkiv.physikal'
version '1.0.1.1'
version '1.0.2.1'

buildscript {
ext.kotlin_version = '1.1.4-3'
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
group 'org.tenkiv.physikal'
version '1.0.1.1'
version '1.0.2.1'

apply plugin: 'kotlin'

Expand Down
4 changes: 3 additions & 1 deletion core/src/main/kotlin/org/tenkiv/physikal/core/Type.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ import javax.measure.Unit

// typealiases
typealias ClosedQuantityRange<Q> = ClosedRange<ComparableQuantity<Q>>
// Unit type alias to avoid confusion and import ambiguity with kotlin.Unit
typealias PhysicalUnit<Q> = Unit<Q>

// Unit extensions
inline fun <reified Q : Quantity<Q>> Unit<*>.asType(): Unit<Q> = asType(Q::class.java)
inline fun <reified Q : Quantity<Q>> PhysicalUnit<*>.asType(): PhysicalUnit<Q> = asType(Q::class.java)

// Quantity extensions
/**
Expand Down
2 changes: 1 addition & 1 deletion si-units/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
group 'org.tenkiv.physikal'
version '1.0.1.1'
version '1.0.2.1'

buildscript {
ext.kotlin_version = '1.1.4-3'
Expand Down

0 comments on commit ce7f221

Please sign in to comment.