diff options
Diffstat (limited to 'tests/borrow')
-rw-r--r-- | tests/borrow/tborrow.nim | 35 | ||||
-rw-r--r-- | tests/borrow/tinvalidborrow.nim | 16 |
2 files changed, 0 insertions, 51 deletions
diff --git a/tests/borrow/tborrow.nim b/tests/borrow/tborrow.nim deleted file mode 100644 index 9c403021e..000000000 --- a/tests/borrow/tborrow.nim +++ /dev/null @@ -1,35 +0,0 @@ -discard """ - output: '''4887 true -0.5''' -""" - -# test the new borrow feature that works with generics: - -proc `++`*[T: int | float](a, b: T): T = - result = a + b - -type - DI = distinct int - DF = distinct float - DS = distinct string - -proc `++`(x, y: DI): DI {.borrow.} -proc `++`(x, y: DF): DF {.borrow.} - -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 diff --git a/tests/borrow/tinvalidborrow.nim b/tests/borrow/tinvalidborrow.nim deleted file mode 100644 index 89aa4e2e8..000000000 --- a/tests/borrow/tinvalidborrow.nim +++ /dev/null @@ -1,16 +0,0 @@ -discard """ - errormsg: "no symbol to borrow from found" - line: 11 -""" - -# bug #516 - -type - TAtom = culong - -proc `==`*(a, b: TAtom): bool {.borrow.} - -var - d, e: TAtom - -echo( $(d == e) ) |