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

Issue485 #903

Merged
merged 3 commits into from
Sep 23, 2020
Merged

Issue485 #903

merged 3 commits into from
Sep 23, 2020

Conversation

brianhuffman
Copy link
Contributor

Make pretty printer unfold type synonyms when not in scope.

Fixes #485.

Copy link
Member

@yav yav left a comment

Choose a reason for hiding this comment

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

I think the change makes sende.

On a side note, some of the tests, I think, illustrate the bug I was mentioning yesterday: shouldn't FloatTests::Small be in scope?

@brianhuffman
Copy link
Contributor Author

About FloatTests::Small getting unfolded: Yes, I agree that this should be in scope. It should actually be printed as just Small, as it actually appears earlier in the same error message:

  Unsolvable constraints:
    • Literal 7 Small
        arising from
        use of literal or demoted expression
        at <interactive>:1:1--1:2
    • Reason: 7 cannot be represented in FloatTests::Small

I think the actual problem is that the type expression in the "Reason" line is pretty-printed without the appropriate name context. Here's the relevant code, from function solveFLiteralInst:

_ -> Unsolvable $ TCErrorMessage
$ show n ++ "/" ++ show d ++ " cannot be " ++
"represented in " ++ show (pp ty)

The problem is using show (pp ty) to insert a pretty-printed type into the string argument to TCErrorMessage. We should instead add another constructor alongside TCErrorMessage that can hold a Doc or a Type, or else just change TCErrorMessage to use Doc instead of String. We should open a separate ticket for this.

@yav
Copy link
Member

yav commented Sep 23, 2020

Good point. TCErrorMessage really should be way more structured than just a Doc. I made #905 to track this.

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.

Expand private type synonyms
2 participants