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

Infinite loop exhausts memory w/ erroneous code #5361

Closed
scabug opened this issue Jan 7, 2012 · 3 comments
Closed

Infinite loop exhausts memory w/ erroneous code #5361

scabug opened this issue Jan 7, 2012 · 3 comments

Comments

@scabug
Copy link

scabug commented Jan 7, 2012

The following (invalid) code goes quiet during typer and won't be heard from again until it has exhausted available memory.

class A {
  val x : { val self = this } = new { self => }
}
@scabug
Copy link
Author

scabug commented Jan 7, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5361?orig=1
Reporter: @paulp
Affected Versions: 2.9.2, 2.10.0-RC5

@scabug
Copy link
Author

scabug commented Dec 4, 2012

@retronym said:
Relevant:

    def typedRefinement(templ: Template) {
      val stats = templ.body
      namer.enterSyms(stats)
      // need to delay rest of typedRefinement to avoid cyclic reference errors
      unit.toCheck += { () =>
        val stats1 = typedStats(stats, NoSymbol)
        // this code kicks in only after typer, so `stats` will never be filled in time
        // as a result, most of compound type trees with non-empty stats will fail to reify
        // todo. investigate whether something can be done about this
        val att = templ.attachments.get[CompoundTypeTreeOriginalAttachment].getOrElse(CompoundTypeTreeOriginalAttachment(Nil, Nil))
        templ.removeAttachment[CompoundTypeTreeOriginalAttachment]
        templ updateAttachment att.copy(stats = stats1)
        for (stat <- stats1 if stat.isDef) {
          val member = stat.symbol
          if (!(context.owner.ancestors forall
                (bc => member.matchingSymbol(bc, context.owner.thisType) == NoSymbol))) {
                  member setFlag OVERRIDE
                }
        }
      }
    }

@scabug
Copy link
Author

scabug commented Dec 4, 2012

@retronym said:
scala/scala#1706

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

2 participants