From f4f13fbcfc5107deed2c7fa709d76a011dfd70e3 Mon Sep 17 00:00:00 2001 From: lit Date: Tue, 15 Jul 2025 05:15:44 +0800 Subject: [PATCH] fixes #25043: js tyUserTypeClass internal error (#25044) - **fixes #25043: `internal error: genTypeInfo(tyUserTypeClassInst)`** - **chore(test): for 25043** (cherry picked from commit 7e2df41850f04fdc0213978d49e828227a3dcfca) --- compiler/jstypes.nim | 2 +- tests/js/t25043.nim | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/js/t25043.nim diff --git a/compiler/jstypes.nim b/compiler/jstypes.nim index d980f99893..121baeb1cb 100644 --- a/compiler/jstypes.nim +++ b/compiler/jstypes.nim @@ -122,7 +122,7 @@ proc genEnumInfo(p: PProc, typ: PType, name: Rope) = [name, genTypeInfo(p, typ.baseClass)]) proc genTypeInfo(p: PProc, typ: PType): Rope = - let t = typ.skipTypes({tyGenericInst, tyDistinct, tyAlias, tySink, tyOwned}) + let t = typ.skipTypes({tyGenericInst, tyDistinct, tyAlias, tySink, tyOwned} + tyUserTypeClasses) result = "NTI$1" % [rope(t.id)] if containsOrIncl(p.g.typeInfoGenerated, t.id): return case t.kind diff --git a/tests/js/t25043.nim b/tests/js/t25043.nim new file mode 100644 index 0000000000..71353f10c6 --- /dev/null +++ b/tests/js/t25043.nim @@ -0,0 +1,15 @@ +discard """ + action: "compile" +""" + +proc audit*(event: string, args: varargs[string]) = discard +# args is `varargs[Any]` in real world code + +type PathLike[T] = concept self + $self is T # a simplified definition + +proc utime[T](path: PathLike[T]) = + audit("os.utime", $path) + +when isMainModule: + utime("sad")