From fce69d0149b03e87d943eea79cbe247e8fe33c2b Mon Sep 17 00:00:00 2001 From: SirOlaf <.> Date: Mon, 16 Oct 2023 00:05:25 +0200 Subject: [PATCH 1/2] Attempt not skipping tyGenercInst in sameTypeAux --- compiler/types.nim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/types.nim b/compiler/types.nim index f5e965df98ff7..cdb3067c307f1 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -1202,12 +1202,12 @@ proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool = if containsOrIncl(c, a, b): return true if x == y: return true - var a = skipTypes(x, {tyGenericInst, tyAlias}) + var a = skipTypes(x, {tyAlias}) while a.kind == tyUserTypeClass and tfResolved in a.flags: - a = skipTypes(a[^1], {tyGenericInst, tyAlias}) - var b = skipTypes(y, {tyGenericInst, tyAlias}) + a = skipTypes(a[^1], {tyAlias}) + var b = skipTypes(y, {tyAlias}) while b.kind == tyUserTypeClass and tfResolved in b.flags: - b = skipTypes(b[^1], {tyGenericInst, tyAlias}) + b = skipTypes(b[^1], {tyAlias}) assert(a != nil) assert(b != nil) if a.kind != b.kind: From 82d21fffa3d50281f9b9efe9fb62418e12a2f029 Mon Sep 17 00:00:00 2001 From: SirOlaf <.> Date: Mon, 16 Oct 2023 02:11:19 +0200 Subject: [PATCH 2/2] Add test --- tests/generics/t22826.nim | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/generics/t22826.nim diff --git a/tests/generics/t22826.nim b/tests/generics/t22826.nim new file mode 100644 index 0000000000000..914d4243a2de3 --- /dev/null +++ b/tests/generics/t22826.nim @@ -0,0 +1,8 @@ +import std/tables + +var a: Table[string, float] + +type Value*[T] = object + table: Table[string, Value[T]] + +discard toTable({"a": Value[float]()}) \ No newline at end of file