Skip to content

Commit 7e2df41

Browse files
authored
fixes #25043: js tyUserTypeClass internal error (#25044)
- **fixes #25043: `internal error: genTypeInfo(tyUserTypeClassInst)`** - **chore(test): for 25043**
1 parent 9c1e3bf commit 7e2df41

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

compiler/jstypes.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ proc genEnumInfo(p: PProc, typ: PType, name: Rope) =
122122
[name, genTypeInfo(p, typ.baseClass)])
123123

124124
proc genTypeInfo(p: PProc, typ: PType): Rope =
125-
let t = typ.skipTypes({tyGenericInst, tyDistinct, tyAlias, tySink, tyOwned})
125+
let t = typ.skipTypes({tyGenericInst, tyDistinct, tyAlias, tySink, tyOwned} + tyUserTypeClasses)
126126
result = "NTI$1" % [rope(t.id)]
127127
if containsOrIncl(p.g.typeInfoGenerated, t.id): return
128128
case t.kind

tests/js/t25043.nim

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
discard """
2+
action: "compile"
3+
"""
4+
5+
proc audit*(event: string, args: varargs[string]) = discard
6+
# args is `varargs[Any]` in real world code
7+
8+
type PathLike[T] = concept self
9+
$self is T # a simplified definition
10+
11+
proc utime[T](path: PathLike[T]) =
12+
audit("os.utime", $path)
13+
14+
when isMainModule:
15+
utime("sad")

0 commit comments

Comments
 (0)