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

Better error message for reflection faliures due to missing reflection of constructors + refactor of core to logic #2473

Merged
merged 6 commits into from
Jan 15, 2025

Conversation

AlecsFerra
Copy link
Contributor

@AlecsFerra AlecsFerra commented Jan 15, 2025

The error message was very unhelpful before (See #2457)

From

   Illegal type specification for `Fin.unFin`
    Fin.unFin :: forall n .
                 lq_tmp$db##0:(Fin.Fin n) -> {VV : GHC.Types.Int | VV == lqdc##$select##Fin.MkFin##1 lq_tmp$db##0
                                                                   && VV >= 0
                                                                   && VV < n}
    Sort Error in Refinement: {VV : int | VV == lqdc##$select##Fin.MkFin##1 lq_tmp$db##0
                                          && VV >= 0
                                          && VV < n}
    Unbound symbol lqdc##$select##Fin.MkFin##1 --- perhaps you meant: Fin.MkFin ?
    Just
   |
26 | unFin (MkFin i) = i
   | ^^^

To:

test/Testone2.hs:19:13: error:
    Uh oh.
    CallStack (from HasCallStack):
  panic, called at src/Language/Haskell/Liquid/Bare/Axiom.hs:355:26 in liquidhaskell-boot-0.9.10.1-inplace:Language.Haskell.Liquid.Bare.Axiom
    test/Testone2.hs:19:13 Cannot lift Haskell function `p2i` to logic
                           Cannot lift to logic the constructor `Fixme.P` consider enabling either --exactdc or --reflection
   |
19 | {-@ reflect p2i @-}
   |             ^

I think to make it even better we should either handle the panic gracefully (best solution) or at least remove all the call stack information since is rather unhelpful to the user

Copy link
Collaborator

@facundominguez facundominguez left a comment

Choose a reason for hiding this comment

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

LGTM!

@facundominguez facundominguez merged commit 06f55b4 into ucsd-progsys:develop Jan 15, 2025
4 checks passed
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.

2 participants