Skip to content

checker: fix missing info about generic fn var usage without concrete types - #22743

Merged
spytheman merged 5 commits into
vlang:masterfrom
felipensp:fix_generic_unresolved_generic_fn_var
Nov 4, 2024
Merged

spytheman merged 5 commits into
vlang:masterfrom
felipensp:fix_generic_unresolved_generic_fn_var

Conversation

@felipensp

@felipensp felipensp commented Nov 2, 2024 •

Copy link
Copy Markdown
Member

@Delta456

Delta456 commented Nov 2, 2024

Copy link
Copy Markdown
Member

Does this also fix #22735 ?

@felipensp

Copy link
Copy Markdown
Member Author

Does this also fix #22735 ?

The mapa := {"la": func} usage yes. Because func must have its concrete type explict.

@felipensp

Copy link
Copy Markdown
Member Author

Does this also fix #22735 ?

I introduced:

bug.v:7:15: error: `func` is a generic fn, you should pass its concrete types, e.g. func[int]
    5 | 
    6 | fn main() {
    7 |     _  := {"la": func}
      |                  ~~~~
    8 | }

@Delta456

Delta456 commented Nov 2, 2024

Copy link
Copy Markdown
Member

Also add a test for that then.

@felipensp

Copy link
Copy Markdown
Member Author

Also add a test for that then.

Yes. Just pushing right now.

@felipensp

Copy link
Copy Markdown
Member Author

Also add a test for that then.

But I referenced #22733, the #22735 is more about passing concrete type to indexed fn.

@Delta456

Delta456 commented Nov 2, 2024

Copy link
Copy Markdown
Member

I believe this check solves the issue

@Delta456
Delta456 marked this pull request as ready for review November 2, 2024 16:27
@Delta456
Delta456 marked this pull request as draft November 2, 2024 21:39
Comment thread vlib/v/checker/tests/generic_fn_var_unresolved_err.out Outdated
@felipensp
felipensp marked this pull request as ready for review November 3, 2024 19:29
Comment thread vlib/v/checker/fn.v Outdated
Co-authored-by: Jose Mendoza  <56417208+StunxFS@users.noreply.github.com>

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

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.

checker error: generic function visited more than 10000 times c gen: 'main__func' undeclared

4 participants