Constant folding should not drop distinct types

Fixes #9079
This commit is contained in:
LemonBoy
2018-09-27 17:08:01 +02:00
parent 72e15ff739
commit e9b5a4e25d
2 changed files with 20 additions and 4 deletions

19
tests/distinct/t9079.nim Normal file
View 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