Skip to content

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

2 participants