Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression when calling proc in generic instancing #22188

Closed
Menduist opened this issue Jun 29, 2023 · 2 comments
Closed

Regression when calling proc in generic instancing #22188

Menduist opened this issue Jun 29, 2023 · 2 comments

Comments

@Menduist
Copy link
Contributor

Menduist commented Jun 29, 2023

Description

Sorry about the long repro, couldn't reduce further:
a.nim:

import b

proc write*[T: uint32](value: T) =
  var length = 5
  var buffer: seq[byte]
  PB.putUVarint(buffer.toOpenArray(0, 1), length, value)

write(uint32(5))

b.nim:

import c

type 
  PB* = object 
  LP* = object


proc putUVarint*[T: PB|LP](vtype: typedesc[T],
                           pbytes: var openArray[byte],
                           outlen: var int,
                           outval: uint32) =
  let bytes = toBytes(outval, Leb128)

c.nim:

type Leb128* = object

func maxLen*(T: type Leb128, I: type): int8 = 1
  
type Leb128Buf*[T: SomeUnsignedInt] = object
    data*: array[maxLen(Leb128, T), byte]

func toBytes*[I: SomeUnsignedInt](v: I, T: type Leb128): Leb128Buf[I] {.noinit.} = discard

Nim devel: c.nim(6, 18) Error: undeclared identifier: 'maxLen'
Nim 1.6.14: compiles

Nim Version

13b7e4e

Additional Information

This started approximately on the 14th of june, so maybe this PR caused it? #22029

@metagn
Copy link
Collaborator

metagn commented Jun 29, 2023

Try any commit after 6d21637, the hash given above is 3 days before it

@Menduist
Copy link
Contributor Author

Menduist commented Jun 29, 2023

Oh right my bad, didn't realized you already fixed it
Sorry, and thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants