-
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
Documentation should not resolve type aliases #347
Comments
Basically, this problem is unsolvable. As your own example shows, both Foo and String are aliases of what appears early in the compilation process as StringJ Char. So, on what basis does the Doc tool decide whether to use 'Foo' or 'String'? (Remember that the Doc tool works on class files, not source code.) However, one can do something with a bit of heuristic. Which is already done both in the compiler (for error mesages) and in the Doc tool. For details see frege.compiler.common.UnAlias If you feel like so, you can realize your ideas here. But the following basic premise is not to be changed: when type checking starts, no type expression seen by type checker and following passes must mention any type alias anymore. |
If I understand correctly, aliases can be rendered to HTML if But I also guess it is extremely difficult (unsolvable in the current inplementation ?) because I think all But first, since I haven't studied UnAlias yet, I think I'll try to look at it. It seems to sometimes give incorrect results however (you already called it "heuristic"). |
I think I found a way to improve the situation. It looks that frege/frege/compiler/common/UnAlias.fr Line 89 in d384bdf
The local function |
It should also contain the imported ones. This is why IO and String work in most cases. |
They didn't work for me. In my environment, |
No it shouldn't matter. This code is quite stable, and the target JVM version must not change the semantics. |
Can you be more specific? I look at www. frege-lang.org/doc/frege/prelude/PreludeIO.fr and it looks ok for me. Does yours differ? |
I myself couldn't reproduce the issue:
does indeed generate |
Type signatures in generated HTML docs have resolved (i.e. original) names instead of type aliases.
For example, for a function
f :: Int -> Foo
wheretype Foo = String
, the generated document saysf :: Int -> String
.The below is an exhaustive list I'm aware of so far:
Note that type aliases in documentation code (that begins with
---
) won't be resolved.The text was updated successfully, but these errors were encountered: