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

"Illegal aliasing of aliased local variable" when there is no aliasing involved #1270

Closed
mario-bucev opened this issue May 25, 2022 · 0 comments · Fixed by #1277
Closed

"Illegal aliasing of aliased local variable" when there is no aliasing involved #1270

mario-bucev opened this issue May 25, 2022 · 0 comments · Fixed by #1277

Comments

@mario-bucev
Copy link
Collaborator

AntiAliasing complains that b is aliased when calling inner:

object InnerFnsAliasing {
  case class Box(var value: Int)

  def outer(b: Box): Unit = {
    def inner(v: Int): Unit = {
      require(b.value == v)
    }
    inner(b.value) // Illegal passing of aliased local variable: b
  }
}

Here, we are passing a value of an immutable type to inner, as such, b is not aliased.

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.

1 participant