diff options
author | Clyybber <darkmine956@gmail.com> | 2020-06-23 14:17:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-23 14:17:12 +0200 |
commit | 4cb41f53f06995709d8f00587fbcaa34eb555b7b (patch) | |
tree | 4085dca199ceb28a790dbaa9e7ecf406acc9eb35 | |
parent | 28510a9da9bf2a6b02590ba27b64e951a208b23d (diff) | |
download | Nim-4cb41f53f06995709d8f00587fbcaa34eb555b7b.tar.gz |
Add testcase for #14440 (#14771)
-rw-r--r-- | tests/borrow/tborrow.nim | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/borrow/tborrow.nim b/tests/borrow/tborrow.nim index ee0d0194d..9c403021e 100644 --- a/tests/borrow/tborrow.nim +++ b/tests/borrow/tborrow.nim @@ -1,5 +1,6 @@ discard """ - output: "4887 true" + output: '''4887 true +0.5''' """ # test the new borrow feature that works with generics: @@ -19,3 +20,16 @@ proc `$`(x: DI): string {.borrow.} proc `$`(x: DF): string {.borrow.} echo 4544.DI ++ 343.DI, " ", (4.5.DF ++ 0.5.DF).float == 5.0 + +# issue #14440 + +type Radians = distinct float64 + +func `-=`(a: var Radians, b: Radians) {.borrow.} + +var a = Radians(1.5) +let b = Radians(1.0) + +a -= b + +echo a.float64 |