Skip to content

regression from 2.2.10 to devel with lent and type aliasing #25796

@tersec

Description

@tersec

Nim Version

Pre-regression:

Nim Compiler Version 2.2.10 [Linux: amd64]
Compiled at 2026-05-06
Copyright (c) 2006-2026 by Andreas Rumpf

git hash: bfeb3146d1638b39f69007a4ae5a23e23ae4e5ef
active boot switches: -d:release

Post-regression:

Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2026-05-06
Copyright (c) 2006-2026 by Andreas Rumpf

git hash: f0077a12b20a6cbf3358eaeb09e528ec65e9eca9
active boot switches: -d:release

Description

type A = object
  c: int
type H = proc(): lent A {.nimcall.}
const u = A(c: 0)
proc e(T: typedesc): lent A = u
proc y(T: typedesc): H =
  proc(): lent A {.nimcall.} = T.e
discard y(int)

Current Output

/tmp/v.nim(8, 10) template/generic instantiation of `y` from here
/tmp/v.nim(7, 7) Error: type mismatch: got 'proc (): lent A{.nimcall, noSideEffect, gcsafe.}' for 'proc (): lent A {.nimcall.} = result = e(T)' but expected 'H = proc (): lent A{.nimcall.}'

Expected Output


Known Workarounds

No response

Additional Information

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions