Skip to content
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

assertion failed: varsInScope should contain b1 #1251

Closed
vkuncak opened this issue Mar 19, 2022 · 0 comments · Fixed by #1252
Closed

assertion failed: varsInScope should contain b1 #1251

vkuncak opened this issue Mar 19, 2022 · 0 comments · Fixed by #1252
Assignees

Comments

@vkuncak
Copy link
Collaborator

vkuncak commented Mar 19, 2022

This code

import stainless.annotation.pure
case class Box(var length: Int)
object Foo {
  def makeBox(): Box = Box(0)
  def mutate(b: Box): Unit = { b.length = 123; }

  // Crash in ImperativeCodeElimination and omits effect on b1/b2
  def h(b1: Box, b2: Box): Unit = {
    val x = b1.length
    val c = if (true) b1 else b2
    val d = c // Interacts with Let handling `computeExprEffects`
    // We try to assign to val c (and nothing else!)
    mutate(d)
    assert(b1.length == x)
  }
}

causes the above mentioned

assertion failed: varsInScope should contain b1

Taken from #819 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants