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

Type mismatch in src/nimib/docs.nim #222

Closed
dlesnoff opened this issue Nov 9, 2023 · 2 comments
Closed

Type mismatch in src/nimib/docs.nim #222

dlesnoff opened this issue Nov 9, 2023 · 2 comments

Comments

@dlesnoff
Copy link
Contributor

dlesnoff commented Nov 9, 2023

Hello,
I get a type mismatch issue in src/nimib/docs.nim with Nim 2.0.
I get the following error:

~/Documents/dev/nimib/src/nimib/docs.nim(13, 33) Error: type mismatch
Expression: render(doc)
  [1] doc: NbDoc

Expected one of (first mismatch at [position]):
[1] method render(token: EscapedTag; ctx: Context): string
[1] method render(token: Parent; ctx: Context): string
[1] method render(token: Partial; ctx: Context): string
[1] method render(token: Section; ctx: Context): string
[1] method render(token: Text; ctx: Context): string
[1] method render(token: Token; ctx: Context): string
[1] method render(token: UnescapedTag; ctx: Context): string
[1] proc render(nb: var NbDoc): string
[1] proc render(nb: var NbDoc; blk: var NbBlock): string
[1] proc render(s: string; ctx: Context = newContext()): string
[1] proc render(tokens: seq[Token]; ctx: Context): string

The line in question is in the function:

proc write*(doc: var NbDoc) =
  echo "[nimib] current directory: ", getCurrentDir()
  let dir = doc.filename.splitFile().dir
  if not dir.dirExists:
    echo "[nimib] creating directory: ", dir
    createDir(dir)
  echo "[nimib] saving file: ", doc.filename
  writeFile(doc.filename, render(doc))

I am surprised it didn't match with this entry: [1] proc render(nb: var NbDoc): string. doc is mutable since it is a var argument.
EDIT: doc is not mutable -> doc is mutable.

@pietroppeter
Copy link
Owner

this is indeed weird. does it still reproduce? I am not able at the moment to reproduce locally (have not updated to 2.0 yet...) and CI normally checks 2.0 (this was reported after last CI run but there was not a release in the time this was reported). Incidentally we should add the possibility to rerun the test CI manually, will add an issue about that

@dlesnoff
Copy link
Contributor Author

The error disappears with Nim 2.0.2. Next time, I'll be more specific in the compilation process, because I could not reproduce the exact error message.

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