fixes #25043: js tyUserTypeClass internal error (#25044)

- **fixes #25043: `internal error: genTypeInfo(tyUserTypeClassInst)`**
- **chore(test): for 25043**

(cherry picked from commit 7e2df41850)
This commit is contained in:
lit
2025-07-15 05:15:44 +08:00
committed by narimiran
parent 1a4a1ab747
commit f4f13fbcfc
2 changed files with 16 additions and 1 deletions

View File

@@ -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

15
tests/js/t25043.nim Normal file
View File

@@ -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")