-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Further application of recursion schemes for working with the Type AST * Rollback un-needed changes * Change over to using scala.BigDecimal to back the Decimal type * Ensure better ergonomics with the Decimal type
- Loading branch information
1 parent
d89088a
commit a345218
Showing
10 changed files
with
384 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
morphir/sdk/core/src-2.11/morphir/sdk/DecimalModuleCompat.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package morphir.sdk | ||
|
||
trait DecimalModuleCompat { | ||
import DecimalModuleCompat._ | ||
implicit def toBigDecimalOps(value: BigDecimal): BigDecimalOps = | ||
new BigDecimalOps(value) | ||
} | ||
|
||
object DecimalModuleCompat { | ||
class BigDecimalOps(private val self: BigDecimal) extends AnyVal { | ||
def compareTo(that: BigDecimal): Int = | ||
self.compare(that) | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
morphir/sdk/core/src-2.12/morphir/sdk/DecimalModuleCompat.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package morphir.sdk | ||
|
||
trait DecimalModuleCompat {} |
3 changes: 3 additions & 0 deletions
3
morphir/sdk/core/src-2.13/morphir/sdk/DecimalModuleCompat.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package morphir.sdk | ||
|
||
trait DecimalModuleCompat {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package morphir.sdk | ||
|
||
import zio.test.Assertion._ | ||
import zio.test.{ assert, DefaultRunnableSpec } | ||
|
||
object DecimalSpec extends DefaultRunnableSpec { | ||
def spec = suite("Decimal Spec")( | ||
test("It should be possible to assign an int value to the Decimal") { | ||
assert(Decimal(42))(equalTo(Decimal.fromInt(42))) | ||
} | ||
) | ||
} |
Oops, something went wrong.