Details

      Description

      According to the contract of Compiler.parseTree, no symbol should be entered in the returned tree. This ticket in the Scala IDE project proves the contract is broken.

        Issue Links

          Activity

          Hide
          Jason Zaugg added a comment -
          ase: <no phase>] Please file a ticket with the current stack trace at https://www.assembla.com/spaces/scala-ide/support/tickets
          	at scala.tools.nsc.interactive.Global.assertCorrectThread(Global.scala:517)
          	at scala.reflect.internal.Symbols$Symbol.rawInfo(Symbols.scala:1395)
          	at scala.reflect.internal.Symbols$Symbol.isCoDefinedWith(Symbols.scala:2041)
          	at scala.reflect.internal.Symbols$ClassSymbol$$anonfun$companionModule0$1.apply(Symbols.scala:3085)
          	at scala.reflect.internal.Symbols$ClassSymbol$$anonfun$companionModule0$1.apply(Symbols.scala:3085)
          	at scala.reflect.internal.Symbols$Symbol.filter(Symbols.scala:1788)
          	at scala.reflect.internal.Symbols$Symbol.suchThat(Symbols.scala:1792)
          	at scala.reflect.internal.Symbols$ClassSymbol.companionModule0(Symbols.scala:3085)
          	at scala.reflect.internal.Symbols$ClassSymbol.companionModule(Symbols.scala:3087)
          	at scala.reflect.internal.TreeGen.mkTuple(TreeGen.scala:289)
          	at scala.tools.nsc.ast.parser.TreeBuilder.makeTupleTerm(TreeBuilder.scala:42)
          	at scala.tools.nsc.ast.parser.TreeBuilder.stripParens(TreeBuilder.scala:47)
          	at scala.tools.nsc.ast.parser.Parsers$Parser.parseOther$1(Parsers.scala:1475)
          	at scala.tools.nsc.ast.parser.Parsers$Parser.expr0(Parsers.scala:1477)
          

          Seems like we need to force a few lazies in Definitions to make this work.

          // On presentation compiler startup
          definitions.TupleClass.seq.foreach(sym => fullyInitializeSymbol(sym))
          // same for any other symbols used by Parsers.
          

          This workaround could be done in the IDE in the meantime.

          Show
          Jason Zaugg added a comment - ase: <no phase>] Please file a ticket with the current stack trace at https://www.assembla.com/spaces/scala-ide/support/tickets at scala.tools.nsc.interactive.Global.assertCorrectThread(Global.scala:517) at scala.reflect.internal.Symbols$Symbol.rawInfo(Symbols.scala:1395) at scala.reflect.internal.Symbols$Symbol.isCoDefinedWith(Symbols.scala:2041) at scala.reflect.internal.Symbols$ClassSymbol$$anonfun$companionModule0$1.apply(Symbols.scala:3085) at scala.reflect.internal.Symbols$ClassSymbol$$anonfun$companionModule0$1.apply(Symbols.scala:3085) at scala.reflect.internal.Symbols$Symbol.filter(Symbols.scala:1788) at scala.reflect.internal.Symbols$Symbol.suchThat(Symbols.scala:1792) at scala.reflect.internal.Symbols$ClassSymbol.companionModule0(Symbols.scala:3085) at scala.reflect.internal.Symbols$ClassSymbol.companionModule(Symbols.scala:3087) at scala.reflect.internal.TreeGen.mkTuple(TreeGen.scala:289) at scala.tools.nsc.ast.parser.TreeBuilder.makeTupleTerm(TreeBuilder.scala:42) at scala.tools.nsc.ast.parser.TreeBuilder.stripParens(TreeBuilder.scala:47) at scala.tools.nsc.ast.parser.Parsers$Parser.parseOther$1(Parsers.scala:1475) at scala.tools.nsc.ast.parser.Parsers$Parser.expr0(Parsers.scala:1477) Seems like we need to force a few lazies in Definitions to make this work. // On presentation compiler startup definitions.TupleClass.seq.foreach(sym => fullyInitializeSymbol(sym)) // same for any other symbols used by Parsers. This workaround could be done in the IDE in the meantime.
          Hide
          Jason Zaugg added a comment -

          Denys, could you please audit what parts of `Definitions` are touched by `Parsers`, and see if you can force them in the presentation compiler initialization?

          Show
          Jason Zaugg added a comment - Denys, could you please audit what parts of `Definitions` are touched by `Parsers`, and see if you can force them in the presentation compiler initialization?
          Hide
          Denys Shabalin added a comment -

          Sure.

          Show
          Denys Shabalin added a comment - Sure.
          Hide
          Mirco Dotta added a comment -

          @Jason Thanks. I'll add TupleClass to this

          Show
          Mirco Dotta added a comment - @Jason Thanks. I'll add TupleClass to this
          Hide
          Jason Zaugg added a comment -

          You'll need to to that for the family of Tuple symbols, `TupleClass.seq` in master, or `(1 to 22).map(TupleClass(_))` if you need to be compatible with 2.10 and 2.11.

          And I would change that to `fullyInitializeSymbol` to be on the safe side as you have the tuple class, module, and module class symbols to worry about.

          Show
          Jason Zaugg added a comment - You'll need to to that for the family of Tuple symbols, `TupleClass.seq` in master, or `(1 to 22).map(TupleClass(_))` if you need to be compatible with 2.10 and 2.11. And I would change that to `fullyInitializeSymbol` to be on the safe side as you have the tuple class, module, and module class symbols to worry about.
          Hide
          Mirco Dotta added a comment -

          `TupleClass.seq` seems to exist on 2.10.4. Here is a link to the PR on Scala IDE, feel free to comment on it https://github.com/scala-ide/scala-ide/pull/595

          Show
          Mirco Dotta added a comment - `TupleClass.seq` seems to exist on 2.10.4. Here is a link to the PR on Scala IDE, feel free to comment on it https://github.com/scala-ide/scala-ide/pull/595

            People

            • Assignee:
              Denys Shabalin
              Reporter:
              Mirco Dotta
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development