Skip to content

Handle ambiguous effects more reliably and emit diagnostics for these - #1379

Open
lionel- wants to merge 10 commits into
oak-nse/19-sem-index-recursionfrom
oak-nse/20-ambiguous-effects
Open

Handle ambiguous effects more reliably and emit diagnostics for these#1379
lionel- wants to merge 10 commits into
oak-nse/19-sem-index-recursionfrom
oak-nse/20-ambiguous-effects

Conversation

@lionel-

@lionel- lionel- commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Progress towards #1338

  • a library() in an if/else branch no longer leaks its attach effect into the sibling branch during scan.

  • A lazy body (function, reactive()) defined inside a branch still sees that branch's attach at its own definition point, even though the attach doesn't survive past the branch's join.

  • An attach or binding conditional in a branch/loop that might not run now logs an effect ambiguity diagnostic:

if (cond) {
  local <- identity
}
local({
  y <- 1
})

if (cond) library(shiny)
reactive({
  x <- 1
})
  • New EffectAmbiguity diagnostic (replacing LazyShadowAmbiguity/ConditionalShadowAmbiguity) flags three cases where an effect decision depends on a runtime condition: lazy-crossed shadowing, conditional local shadowing, and now conditional attaches too.

These diagnostics are currently only logged but will be surfaced in a subsequent PR.

Positron Release Notes

New Features

  • N/A

Bug Fixes

  • N/A

@lionel-
lionel- force-pushed the oak-nse/20-ambiguous-effects branch 3 times, most recently from 2efa13d to 630eec0 Compare July 31, 2026 12:28
@lionel-
lionel- force-pushed the oak-nse/20-ambiguous-effects branch from 630eec0 to c1fd8b4 Compare July 31, 2026 14:23
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.

1 participant