mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-06 07:38:24 +00:00
fixes #25262 ```nim if constraint != nil and constraint.kind == tyTypeDesc: n[i].typ = e.typ else: n[i].typ = e.typ.skipTypes({tyTypeDesc}) ``` at least when `constraint` is a typedesc, it should not skip `tyTypeDesc` ```nim if arg.kind != tyTypeDesc: arg = makeTypeDesc(m.c, arg) ``` Wrappers literals into typedesc, which can cause problems. Though, it doesn't seem to be necessary
36 lines
986 B
Nim
36 lines
986 B
Nim
discard """
|
|
cmd: "nim check $options --hints:off $file"
|
|
action: "reject"
|
|
nimout:'''
|
|
tpointerprocs.nim(22, 11) Error: 'foo' doesn't have a concrete type, due to unspecified generic parameters.
|
|
tpointerprocs.nim(34, 14) Error: type mismatch: got <typedesc[int]>
|
|
but expected one of:
|
|
proc foo(x: int | float; y: int or string): float
|
|
first type mismatch at position: 2 in generic parameters
|
|
missing generic parameter: y:type
|
|
|
|
expression: foo[int]
|
|
tpointerprocs.nim(34, 14) Error: cannot instantiate: 'foo[int]'
|
|
tpointerprocs.nim(34, 14) Error: expression 'foo[int]' has no type (or is ambiguous)
|
|
tpointerprocs.nim(35, 11) Error: expression 'bar' has no type (or is ambiguous)
|
|
'''
|
|
"""
|
|
|
|
block:
|
|
proc foo(x: int | float): float = result = 1.0
|
|
let
|
|
bar = foo
|
|
baz = bar
|
|
|
|
block:
|
|
proc foo(x: int | float): float = result = 1.0
|
|
let
|
|
bar = foo[int]
|
|
baz = bar
|
|
|
|
block:
|
|
proc foo(x: int | float, y: int or string): float = result = 1.0
|
|
let
|
|
bar = foo[int]
|
|
baz = bar
|