Fixed object field access of static objects in generics (#19283) [backport]
This commit is contained in:
parent
81d32cf7e5
commit
fa96e56ad0
2 changed files with 9 additions and 1 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue