Files
Nim/tests/generics/tgenericbodyreturn2.nim
metagn d102571d78 don't allow instantiations resolving to generic body types (#24273)
fixes #24091, refs #24092

Any instantiations resolving to a generic body type now gives an error.
Due to #24092, this does not error in cases like matching against `type
M` in generics because generic body type symbols are just not
instantiated. But this prevents parameters with type `type M` from being
used, although there doesn't seem to be any code which does this. Just
in case such code exists, we still allow `typedesc` types resolving to
generic body types.

(cherry picked from commit 2f904535d0)
2025-01-14 07:33:27 +01:00

12 lines
190 B
Nim

discard """
errormsg: "cannot instantiate: 'T'"
file: "system.nim"
"""
# issue #24091
type M[V] = object
type Foo = object # notice not generic
x: typeof(default(M))
echo Foo() # ()