Skip to content

Fix 'Unbound module type' errors that occurred when trying to async import modules #7783

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 5 commits into from
Aug 22, 2025

Conversation

mediremi
Copy link
Member

@mediremi mediremi commented Aug 21, 2025

Closes #7173

This fixes two cases where async module import previously failed:

// Case 1: return type constraint
let f8 = async (): int => {
  module MQ = await Belt.MutableQueue
  1
}

// Case 2: import in switch case
let f9 = async value => {
  switch value {
  | Some(_) =>
    module HashMapInt = await Belt.HashMap.Int
    ()
  | None => ()
  }
}

The fix was to handle Pexp_constraint and Pexp_match in spelunk_vbs (spelunk Parsetree.value_bindings - finds module bindings).

@mediremi mediremi changed the title Async import unbound module Fix 'Unbound module type' errors that occurred when trying to async import modules Aug 21, 2025
Copy link

pkg-pr-new bot commented Aug 21, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7783

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7783

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7783

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7783

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7783

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7783

commit: d6a8395

@mediremi mediremi marked this pull request as ready for review August 22, 2025 09:21
@mediremi mediremi merged commit b60541e into rescript-lang:master Aug 22, 2025
27 checks passed
@mediremi mediremi deleted the async-import-unbound-module branch August 22, 2025 09:35
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.

Async import - unbound module type
2 participants