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

More structured TCErrorMessage #905

Closed
yav opened this issue Sep 23, 2020 · 3 comments
Closed

More structured TCErrorMessage #905

yav opened this issue Sep 23, 2020 · 3 comments
Assignees
Labels
tech-debt For issues that require some internal refactoring.

Comments

@yav
Copy link
Member

yav commented Sep 23, 2020

Currently TCErrorMessage just contains a Doc. It would be nice to use a data structure instead as this would make it easier to interact with external tools and give us more flexibility on how/what we show in errors.

@yav yav added the tech-debt For issues that require some internal refactoring. label Sep 23, 2020
@yav yav mentioned this issue Sep 23, 2020
@brianhuffman
Copy link
Contributor

Actually, it currently contains a String, not a Doc.

data TCErrorMessage = TCErrorMessage
{ tcErrorMessage :: !String
-- XXX: Add location?
} deriving (Show, Eq, Ord, Generic, NFData)

I should point out that having only a String inside TCErrorMessage is the reason why the Reason line of the error message below prints the Float16 type synonym in a fully-qualified manner. The function that makes the TCErrorMessage needs to put the type into a string, but it doesn't have the name context available to pretty-print the type correctly.

Cryptol> :m Float
Loading module Cryptol
Loading module Float
Float> 1000000 : Float16

[error] at <interactive>:1:1--1:8:
  Unsolvable constraints:
    • Literal 1000000 Float16
        arising from
        use of literal or demoted expression
        at <interactive>:1:1--1:8
    • Reason: 1000000 cannot be represented in Float::Float16

@brianhuffman brianhuffman changed the title More strucutred TCErrorMessage More structured TCErrorMessage Sep 23, 2020
@yav
Copy link
Member Author

yav commented Oct 6, 2020

This is related to #782

@yav yav added this to the 2.10.0 milestone Oct 6, 2020
@yav yav self-assigned this Nov 10, 2020
@yav yav mentioned this issue Nov 13, 2020
@atomb atomb removed this from the 2.10.0 milestone Nov 18, 2020
@yav
Copy link
Member Author

yav commented Mar 12, 2021

This should be done now, so I'll close it

@yav yav closed this as completed Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-debt For issues that require some internal refactoring.
Projects
None yet
Development

No branches or pull requests

3 participants