fixes #24848; presumably-invalid discard R[[R[int]]]() with type R[C] = ref object / b: C generates Error: internal erro

This commit is contained in:
ringabout
2026-08-05 20:50:31 +08:00
parent 2d81149294
commit 52b9b1c5ca
2 changed files with 14 additions and 0 deletions

View File

@@ -296,6 +296,11 @@ proc replaceTypeVarsN(cl: var TReplTypeVars, n: PNode; start=0; expectedType: PT
replaceTypeVarsS(cl, n.sym, replaceTypeVarsT(cl, n.sym.typ))
if result.sym.kind == skField and
(cl.owner == nil or result.sym.owner == cl.owner):
if not cl.allowMetaTypes and result.typ != nil and result.typ.isMetaType:
localError(cl.c.config, result.info,
"'" & result.typ.typeToString & "' is not a concrete type")
result.typ = errorType(cl.c)
result.sym.typ = result.typ
if result.sym.ast != nil:
# instantiate default value of object/tuple field
var n = result.sym.ast

View File

@@ -0,0 +1,9 @@
discard """
errormsg: "'array[0..0, typedesc[R[system.int]]]' is not a concrete type"
line: 7
"""
type R[C] = ref object
b: C
discard R[[R[int]]]()