Skip to content

Inconsitency betwee types and symbols of Idents refering to lifted functions after LambdaLift #342

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

Closed
DarkDimius opened this issue Jan 30, 2015 · 0 comments

Comments

@DarkDimius
Copy link
Contributor

object Test {
  def test2: Int = {
    var ds: String = null
    def s = {
      ds = "abs"
      ds
    }
    s.length
  }

As expected, LambdaLift lifts out def s and ads additional argument to it, creating a method def s$1(ds$1: scala.runtime.ObjectRef): String.

At the end of transformation Ident('s') reference in body of test2 has a fixed symbol s$1, but the type remains TermRef(NoPrefix, s) with a fixed symbol s$1.

As dotty has Idents that are effectively Selects in scalac, backend needs to figure out which reciever to load based on an Ident('s'). This information was expected to come from type, but in this case type is wrong(should be TermRef(This(Test2), s)), and it cannot be recreated from symbol as symbol doesn't indicate an object instance for the method invocation.

@DarkDimius DarkDimius changed the title Inconsitency betwee types and symbols of Idents refering to lifted functions after flatten Inconsitency betwee types and symbols of Idents refering to lifted functions after LambdaLift Jan 30, 2015
DarkDimius added a commit to dotty-staging/dotty that referenced this issue Jan 30, 2015
That's a hack. That allows to continue to work on backend.
 Should be removed after scala#342 is fixed.
DarkDimius added a commit to dotty-staging/dotty that referenced this issue Apr 16, 2015
odersky added a commit to dotty-staging/dotty that referenced this issue Apr 23, 2015
    Idents of lifted symbols become class members, need to carry the right
    reference with the right prefix as type.
tgodzik added a commit to tgodzik/scala3 that referenced this issue Apr 29, 2025
Backport "Approximate annotated types in `wildApprox`" to 3.3 LTS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant