Fixed object field access of static objects in generics (#19283) [backport]

This commit is contained in:
Jason Beetham 2021-12-22 23:12:56 -07:00 • committed by GitHub
commit fa96e56ad0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -44,6 +44,14 @@ template main() =
proc parseInt(f: static[bool]): int {.used.} = discard
doAssert "123".parseInt == 123
block:
type
MyType = object
field: float32
AType[T: static MyType] = distinct range[0f32 .. T.field]
var a: AType[MyType(field: 5f32)]
proc n(S: static Slice[int]): range[S.a..S.b] = discard
assert typeof(n 1..2) is range[1..2]
static: main()