8000 Remember more type annotations in decompiled output by dolio · Pull Request #2850 · unisonweb/unison · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Remember more type annotations in decompiled output #2850

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

Merged
merged 3 commits into from
Feb 1, 2022

Conversation

dolio
Copy link
Contributor
@dolio dolio commented Feb 1, 2022

This keeps some type annotations around in the remembered code for decompiled output, so that it can show up in docs, for instance. Should fix #2795 I believe.

I didn't include a test case for #2795 because you can't actually use a triple backtick doc in a transcript.

dolio added 2 commits January 31, 2022 19:02
Annotations still need to be stripped off for evaluation, but we can
keep them around in some of the code stored for decompilation. It
requires some delicate changes to the lambda lifting process, though.
It's convenient to be able to use ugly tracing sometimes without
managing two module imports.
@dolio dolio requested a review from rlmark February 1, 2022 00:19
@rlmark
Copy link
Contributor
rlmark commented Feb 1, 2022

@dolio, I noticed this works regular code execution, but when I added the @typecheck annotation to the doc, subsequent doc evaluated codeblocks all fail. This snippet should repro it in the absence of a transcript (due to backticks).

docTest = {{

  ```
  myFunction: Nat -> Nat
  myFunction n = n + 1

  myFunction 6
  ```

  @typecheck```

  myFunction2: Nat -> Nat
  myFunction2 n = n + 2

  ```

  ```
  test :  a -> (a -> Boolean) -> {Abort} a
  test a pred =
    if pred a then a else abort

  toOptional! '(test 5 (_ -> false ))
  ```

}}

.> display docTest

  cannot decompile an application to a local recursive binding

The UI makes this a bit easier to see where the error is happening:
Screen Shot 2022-01-31 at 6 32 49 PM

@pchiusano
Copy link
Member

@dolio for regression test you can put the test doc in a separate fix2795/doc.u file, then do .> load unison-src/transcripts/fix2795/doc.u in the transcript.

@dolio
Copy link
Contributor Author
dolio commented Feb 1, 2022

@rlmark It seems like that's just a complaint about the test function in the third block. It appears to fail on trunk to me. I'm not sure why it thinks it's recursive, but I don't think it's because of the type annotations.

Edit: also, I can just delete the @typecheck block and it still fails. Unless I'm doing something wrong.

@rlmark
Copy link
Contributor
rlmark commented Feb 1, 2022

@dolio yeah, it appears to fail on trunk as well. I can file a different ticket for the "cannot decompile an application to a local recursive binding" Doc rendering issue. The type signatures are amazing, thank you!

Copy link
Contributor
@rlmark rlmark left a comment

Choose a reason for hiding this comment

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

🎉 The issue I ran into appears on trunk as well. Ran this against the doc codebase and this is super helpful!

@pchiusano
Copy link
Member

Great! Merging this.

@pchiusano pchiusano merged commit 1df5a4d into trunk Feb 1, 2022
@pchiusano pchiusano deleted the work/decompile-tweaks branch February 1, 2022 18:37
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.

Prioritized Doc Rendering Improvements
3 participants
0