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

fixes #21377; fixes @[] and {} type inference as returns in generics #21475

Merged
merged 5 commits into from
Mar 6, 2023

Conversation

ringabout
Copy link
Member

@ringabout ringabout commented Mar 5, 2023

fixes #21377

The first cause is that semProcBody in instantiateBody didn't pass expectedType so it didn't work for empty sets. The second cause is that generic procs create nkStmtListExprs for values assigned to results. The type inference for assign is not enough. It can infer the type of the whole nkStmtListExpr, not the type of its lastSon. Finally I choose to infer the type directly for the mArrToSeq magic.

@ringabout ringabout marked this pull request as draft March 5, 2023 13:36
@ringabout ringabout changed the title fixes #21377; fixes @[] type inference in generics fixes #21377; fixes @[] and {} type inference in generics Mar 6, 2023
@ringabout ringabout changed the title fixes #21377; fixes @[] and {} type inference in generics fixes #21377; fixes @[] and {} type inference as returns in generics Mar 6, 2023
@ringabout ringabout marked this pull request as ready for review March 6, 2023 07:32
@Araq Araq merged commit 64a0355 into devel Mar 6, 2023
@Araq Araq deleted the pr_fix_flow branch March 6, 2023 14:30
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2023

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

Hint: mm: orc; opt: speed; options: -d:release
166239 lines; 11.623s; 612.488MiB peakmem

capocasa pushed a commit to capocasa/Nim that referenced this pull request Mar 31, 2023
…in generics (nim-lang#21475)

* fixes `@[]` type inference in generics

* add issue links

* fixes macros and iterators

* refactor

* add one more test
narimiran pushed a commit that referenced this pull request May 11, 2023
…ics (#21475)

* fixes `@[]` type inference in generics

* add issue links

* fixes macros and iterators

* refactor

* add one more test

(cherry picked from commit 64a0355)
bung87 pushed a commit to bung87/Nim that referenced this pull request Jul 29, 2023
…in generics (nim-lang#21475)

* fixes `@[]` type inference in generics

* add issue links

* fixes macros and iterators

* refactor

* add one more test
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.

ICE returning @[] as seq[int]
2 participants