fix #20148 implicit compile time conversion int to ranged float cause… (#20698)

fix #20148 implicit compile time conversion int to ranged float causes compiler fatal error
This commit is contained in:
Bung 2022-10-30 00:04:05 +08:00 • committed by GitHub
commit a51ed90c5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -0,0 +1,8 @@
type Percent = range[0.0 .. 1.0]
# type Percent = float # using unlimited `float` works fine
proc initColor*(alpha: Percent): bool =
echo alpha
const moduleInstanceStyle = initColor(1)
# let moduleInstanceStyle = initColor(1) # using runtime conversion works fine