Skip to content

fix: allow resolving context-dot for async functions - #6085

Open
christoph-dfinity wants to merge 2 commits into
masterfrom
christoph/async-context-dot
Open

christoph-dfinity wants to merge 2 commits into
masterfrom
christoph/async-context-dot

Conversation

@christoph-dfinity

@christoph-dfinity christoph-dfinity commented May 5, 2026

Copy link
Copy Markdown
Contributor

By hardcoding the scope to None before, we made it so async functions would never be resolved for context-dot.

Threading the scope through fixes that.

Reported by @timohanke

@Kamirus I didn't see an obvious way to get a hold of a scope for the context dot suggestions in the LSP, so for now completions for async functions won't appear.

@caffeine-ci-bot caffeine-ci-bot Bot added the stale label Jul 6, 2026
@caffeine-ci-bot

Copy link
Copy Markdown
Contributor

This draft pull request has had no activity for 60 days and has been marked as stale. It will not be closed automatically. Please close it if you can.

@christoph-dfinity
christoph-dfinity force-pushed the christoph/async-context-dot branch from 22a36ce to 4c100c7 Compare August 18, 2026 14:04
@christoph-dfinity
christoph-dfinity marked this pull request as ready for review August 18, 2026 14:04
@christoph-dfinity
christoph-dfinity requested a review from a team as a code owner August 18, 2026 14:04
@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Cursor AI review

👍 APPROVE — looks safe to merge

Category Assessment Details
Summary Threads scope_of_env into context-dot matching so async-returning self methods can resolve inside async scopes; adds a fail test and changelog entry.
Code Quality Reuses existing scope_of_env / Bi_match.bi_match_subs path already used by infer_call_instantiation; no speculative helpers.
Consistency Matches the call-site pattern at typing.ml:3737; LSP suggestions still pass None as noted in the PR.
Correctness Traced bi_match_subs Scope handling (bi_match.ml:569–576), parser ensure_scope_bind for local async funcs, scope_of_env, and contextual_dot/infer_callee — prior None made Scope instantiation impossible; non-async contexts still get None and reject.
Tests New test/fail/contextual-dot-async.mo with matching .ok/.ret.ok pairs: async use accepted (no diagnostic), sync use still M0072.
Changelog User-visible entry under ## Unreleased with (#6085), above frozen ## 1.14.1.

Verdict

Decision: APPROVE
Risk: Low
Reason: Contained frontend bug fix that supplies the async scope bi_match_subs already requires for Scope-bound functions; rejection outside async scope is unchanged and covered by the new fail test.


Generated for commit 90f9c95

@christoph-dfinity
christoph-dfinity force-pushed the christoph/async-context-dot branch from 0137ac7 to 90f9c95 Compare August 18, 2026 14:15
@github-actions

Copy link
Copy Markdown
Contributor

Comparing from 58c3239 to 90f9c95:
The produced WebAssembly code seems to be completely unchanged.
In terms of gas, no changes are observed in 5 tests.
In terms of size, no changes are observed in 5 tests.

@alexandru-uta alexandru-uta left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks, looks good

@caffeine-ci-bot caffeine-ci-bot Bot removed the stale label Aug 24, 2026
@christoph-dfinity
christoph-dfinity added this pull request to the merge queue Aug 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 24, 2026
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.

2 participants