-
Notifications
You must be signed in to change notification settings - Fork 145
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
javac cannot find symbol with forall-types #270
Comments
@mabre, congratulations, you're the first one to report such an error for the alpha version. Let me see what I can do here. |
Here we go. First, the workaround: https://github.com/Frege/frege/blob/bounds/tests/comp/Issue270.fr There are actually 2 errors you have found (see below). The workaround for the first one is to not use type variables in let bound functions that have the same name as the ones used in the enclosing function.
to
Here is an explanation: Problem 1When the names of type variables of let bound functions is the same
and the Java compiler rightfully complains that the outer This can only happen in the rare cases where type annotated let bindings cannot be Solution: alpha conversion of annotations for let bound functions. (This should also Problem 2For some reason the "lexeme" function is generated as a method, but the code generator thinks under certain circumstances it is just a lambda-expression. It does it right when This must be Other remarksThe many type errors you get when you take away the type annotations for whiteSpace or lexeme are justified, since he Frege compiler does not generalize let bindings. However, as it stands, there is no monomorphic type for those functions, and hence there must be annotations. I'll try to fix both problems and check back when I have done so. In the meantime you can hopefully live with the workarounds. |
Wow, thank you very much for the prompt answer and the thorough description. |
The following code compiles with
frege3.23.888-g4e22ab6
(and ghc with XRankNTypes and small syntax changes), but doesn’t compile with3.24.61
.When removing the type annotations for
lexeme
andwhiteSpace
(which still compiles with ghc and matched the original parsec code), I get type errors instead:When adding type annotations for
integer
andnatural
(CharParser st Integer
), the errors are these:(The messages where
type is
=expected
are not very helpful.)The text was updated successfully, but these errors were encountered: