Scala Programming Language
  1. Scala Programming Language
  2. SI-5361

Infinite loop exhausts memory w/ erroneous code

    Details

      Description

      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 => }
      }
      

        Activity

        Hide
        Jason Zaugg added a comment -

        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
                        }
                }
              }
            }
        
        Show
        Jason Zaugg added a comment - 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 } } } }
        Show
        Jason Zaugg added a comment - https://github.com/scala/scala/pull/1706

          People

          • Assignee:
            Jason Zaugg
            Reporter:
            Paul Phillips
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development