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

Revert "make default values typed in proc AST same as param sym AST" #24191

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

metagn
Copy link
Collaborator

@metagn metagn commented Sep 27, 2024

Reverts #24184, reopens #12942, reopens #19118

#24184 seems to have caused a regression in https://github.com/c-blake/thes and https://github.com/c-blake/bu/blob/main/rp.nim#L84 reproducible with git clone https://github.com/c-blake/cligen; git clone https://github.com/c-blake/thes; cd thes; nim c -p=../cligen thes. Changing the const to let makes it compile.

A minimization that is probably the same issue is:

const a: seq[string] = @[]

proc foo(x = a) =
  echo typeof(x)
  echo x

import macros

macro resemFoo() =
  result = getImpl(bindSym"foo")

block:
  resemFoo() # Error: cannot infer the type of parameter 'x'

This should be a regression test in a future reimplementation of #24184.

@Araq Araq merged commit 821d080 into devel Sep 27, 2024
20 of 22 checks passed
@Araq Araq deleted the revert-24184-default-value-proc-ast branch September 27, 2024 13:34
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 821d080

Hint: mm: orc; opt: speed; options: -d:release
174565 lines; 8.291s; 654.531MiB peakmem

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

Successfully merging this pull request may close these issues.

2 participants