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

List comprehensions: variable is expected to have type [any()] but it has type none() #433

Closed
erszcz opened this issue Aug 11, 2022 · 0 comments · Fixed by #512
Closed
Labels

Comments

@erszcz
Copy link
Collaborator

erszcz commented Aug 11, 2022

I'm extracting this from #428 as as separate issue to track debugging effort.

ebin/gradualizer_lib.beam: The variable on line 170 at column 60 is expected to have type [any()] but it has type none()
ebin/typechecker.beam: The variable on line 737 at column 24 is expected to have type [any()] but it has type none()
ebin/typelib.beam: The variable on line 159 at column 71 is expected to have type [any()] but it has type none()
ebin/typelib.beam: The variable on line 189 at column 57 is expected to have type [any()] but it has type none()

A series of list comprehension related errors, stemming from the fact that vars in generators are assumed to be of type none().

git bisect shows something interesting:

$ git bisect bad
af24221ea3de423f12c2163490daf6dee3ee33f5 is the first bad commit
commit af24221ea3de423f12c2163490daf6dee3ee33f5
Author: Radek Szymczyszyn <[email protected]>
Date:   Thu Sep 30 00:14:20 2021 +0200

    Increase union_size_limit to 50

    When working on https://github.com/erszcz/tapl-erlang I ran into a type definition with >20 variants.
    It might make sense to make union_size_limit a runtime option, not a hardcoded value.

 src/typechecker.erl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

So it seems this only worked because of the any() approximation for big union types.

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