mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-31 04:29:02 +00:00
19
tests/distinct/t9079.nim
Normal file
19
tests/distinct/t9079.nim
Normal file
@@ -0,0 +1,19 @@
|
||||
discard """
|
||||
output: '''
|
||||
25.0
|
||||
210.0
|
||||
'''
|
||||
"""
|
||||
|
||||
type
|
||||
Dollars = distinct float
|
||||
|
||||
proc `$`(d: Dollars): string {.borrow.}
|
||||
proc `*` *(a, b: Dollars): Dollars {.borrow.}
|
||||
proc `+` *(a, b: Dollars): Dollars {.borrow.}
|
||||
|
||||
var a = Dollars(20)
|
||||
a = Dollars(25.0)
|
||||
echo a
|
||||
a = 10.Dollars * (20.Dollars + 1.Dollars)
|
||||
echo a
|
||||
Reference in New Issue
Block a user