mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
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)
12 lines
190 B
Nim
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() # ()
|