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

Scaffolding for persisting resolution of logic names #2448

Merged
merged 25 commits into from
Nov 26, 2024

Conversation

facundominguez
Copy link
Collaborator

@facundominguez facundominguez commented Nov 25, 2024

Another step for #2169

This PR has three kinds of commits.

  • Commits that generalize data structures and functions, so they are parametric on the type of names.
  • Commits that implement traversals that allow to change the type of these names.
  • Commits that implement scope checking.

Scope checks would fail when a name is not in scope. This is something that LH did already by delegating to liquid-fixpoint. In an example like

{-@ f :: x:Int
      -> { v:Int | h v = x }
@-}
f :: Int -> Int
f x = x

liquid-fixpoint would report an error like

Test.hs:5:10: error:
    Illegal type specification for `Test.f`
    Test.f :: x:GHC.Types.Int -> {v : GHC.Types.Int | h v == x}
    Sort Error in Refinement: {v : int | h v == x}
    Unbound symbol h --- perhaps you meant: x, v ?
    Just
  |
5 | {-@ f :: x:Int
  |          ^^^^^...

With this PR a more precise error is produced

Test.hs:5:20: error: Unknown logic name `h`
    Cannot resolve name
  |
5 |       -> { v:Int | h v = x }
  |                    ^

The results of name resolution are not yet persisted, but much of the machinery needed for it is provided now in the LHNameResolution module.

@facundominguez facundominguez merged commit 4af8d3f into develop Nov 26, 2024
4 checks passed
@facundominguez facundominguez deleted the fd/parameterize-expr2 branch November 26, 2024 11:00
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.

1 participant