Fix subranges of distinct types (#18816) [backport]

This commit is contained in:
Jason Beetham 2021-09-07 09:11:08 -06:00 • committed by GitHub
commit ee2eb5cae2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -167,6 +167,20 @@ template main() =
s.Foo.add('c')
doAssert s.string == "c" # was failing
test()
block: #18061
type
A = distinct (0..100)
B = A(0) .. A(10)
proc test(b: B) = discard
let
a = A(10)
b = B(a)
test(b)
proc test(a: A) = discard
discard cast[B](A(1))
var c: B
static: main()
main()