Skip to content

Incorrect type for await result when using PPX #7261

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

Closed
cknitt opened this issue Jan 30, 2025 · 0 comments · Fixed by #7262
Closed

Incorrect type for await result when using PPX #7261

cknitt opened this issue Jan 30, 2025 · 0 comments · Fixed by #7262
Assignees

Comments

@cknitt
Copy link
Member

cknitt commented Jan 30, 2025

On current master, await is broken when using a PPX.

The following code compiles fine without PPX:

let test = async () => false

let f = async () =>
  if await test() {
    Console.log("OK")
  }

but fails with PPX (rescript-schema-ppx) with the following error:

  We've found a bug for you!
  /Users/christoph/projects/cca/repro/src/Test.res:4:6-17

  2 │
  3 │ let f = async () =>
  4 │   if await test() {
  5 │     Console.log("OK")
  6 │   }

  This has type: promise<bool>
  But if conditions must always be of type: bool

  To fix this, change the highlighted code so it evaluates to a bool.

The issue is not present yet in

eaf8e7b Fix issue with pattern matching empty list which interferes with boolean optimisations.

but is present in

c2ad39e AST: Remove Pexp_new
cristianoc added a commit that referenced this issue Jan 30, 2025
Fix issue where attributes on an application were not preserved by the AST conversion for ppx.

Fixes #7261
cristianoc added a commit that referenced this issue Jan 30, 2025
Fix issue where attributes on an application were not preserved by the AST conversion for ppx.

Fixes #7261
cristianoc added a commit that referenced this issue Jan 30, 2025
Fix issue where attributes on an application were not preserved by the AST conversion for ppx.

Fixes #7261
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 a pull request may close this issue.

2 participants