From 767a901267c782765e010d106fae277b27e04981 Mon Sep 17 00:00:00 2001 From: narimiran Date: Fri, 7 Jun 2024 16:30:32 +0200 Subject: [PATCH] Revert "Fix #22826: Don't skip generic instances in type comparison (#22828)" This reverts commit 5e20e935ddb58bc10bcdddd92555c16743e35ce5. --- compiler/types.nim | 8 ++++---- tests/generics/t22826.nim | 8 -------- 2 files changed, 4 insertions(+), 12 deletions(-) delete mode 100644 tests/generics/t22826.nim diff --git a/compiler/types.nim b/compiler/types.nim index 2f2e9c8c43fee..8e0d73d0fa452 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -1211,12 +1211,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, {tyAlias}) + var a = skipTypes(x, {tyGenericInst, tyAlias}) while a.kind == tyUserTypeClass and tfResolved in a.flags: - a = skipTypes(a[^1], {tyAlias}) - var b = skipTypes(y, {tyAlias}) + a = skipTypes(a[^1], {tyGenericInst, tyAlias}) + var b = skipTypes(y, {tyGenericInst, tyAlias}) while b.kind == tyUserTypeClass and tfResolved in b.flags: - b = skipTypes(b[^1], {tyAlias}) + b = skipTypes(b[^1], {tyGenericInst, tyAlias}) assert(a != nil) assert(b != nil) if a.kind != b.kind: diff --git a/tests/generics/t22826.nim b/tests/generics/t22826.nim deleted file mode 100644 index 914d4243a2de3..0000000000000 --- a/tests/generics/t22826.nim +++ /dev/null @@ -1,8 +0,0 @@ -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