mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-27 17:11:40 +00:00
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:
@@ -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
|
||||
|
||||
9
tests/generics/t24848.nim
Normal file
9
tests/generics/t24848.nim
Normal 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]]]()
|
||||
Reference in New Issue
Block a user