summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorJason Beetham <beefers331@gmail.com>2021-12-22 23:12:56 -0700
committerGitHub <noreply@github.com>2021-12-23 07:12:56 +0100
commitfa96e56ad06f0562b5d608cc896a9b17c9512958 (patch)
tree4cec100b9a5252e2f8a3b9a47969598e66bed922 /tests
parent81d32cf7e53b244776c4196098be154c1223d726 (diff)
downloadNim-fa96e56ad06f0562b5d608cc896a9b17c9512958.tar.gz
Fixed object field access of static objects in generics (#19283) [backport]
Diffstat (limited to 'tests')
-rw-r--r--tests/system/tstatic.nim8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/system/tstatic.nim b/tests/system/tstatic.nim
index 1f1b9dbe3..6e2893e2b 100644
--- a/tests/system/tstatic.nim
+++ b/tests/system/tstatic.nim
@@ -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()