Creating a package object can result in the presentation compiler reporting the errors:
Although I initially thought this was a presentation compiler bug, after looking at the presentation compiler's log output I now believe the issue is an artifact of how we create package object in the wizard. As you can see in the below log output, a number of `askReload` are executed in the presentation compiler, but pay attention to the fact that the loaded source once has the name _package.scala*, and later on an additional `askReload` is performed for package.scala (note there is no leading _*), which I believe is the cause of the reported presentation compiler error, because two *distinct sources with the *same content are loaded in the presentation compiler.
I'm not sure why this started to happen only now, but my hunch is that this is a consequence of the quiescence PR, but that doesn't really matter, as it's purely exposing the fact that we need a different approach for implementing the package object wizard.
Multiple markers at this line
- self constructor arguments cannot reference unconstructed
`this`
- constructor definition not allowed here
Although I initially thought this was a presentation compiler bug, after looking at the presentation compiler's log output I now believe the issue is an artifact of how we create package object in the wizard. As you can see in the below log output, a number of `askReload` are executed in the presentation compiler, but pay attention to the fact that the loaded source once has the name _package.scala*, and later on an additional `askReload` is performed for package.scala (note there is no leading _*), which I believe is the cause of the reported presentation compiler error, because two *distinct sources with the *same content are loaded in the presentation compiler.
"wait for more work"(
),
"atnode"(
1,
1389341597241),
"asked"(
),
"wait for more work"(
),
"atnode"(
3,
1389341597289),
"workitem"(
"scala.tools.nsc.interactive.CompilerControl$ReloadItem"(
"scala.List"(
"scala.reflect.internal.util.BatchSourceFile"(
"scala.reflect.io.PlainFile"(
"/boo/src/boo/_package.scala"),
"tuple3"(
0,
0,
"package object boo {\n\n}\n"))))),
"atnode"(
4,
1389341597303),
"workitem"(
"scala.tools.nsc.interactive.CompilerControl$AskParsedEnteredItem"(
"scala.reflect.internal.util.BatchSourceFile"(
"scala.reflect.io.PlainFile"(
"/Users/mirco/Projects/boo/src/boo/package.scala"),
"tuple3"(
0,
0,
"\n")),
false)),
"wait for more work"(
),
"atnode"(
16,
1389341597328),
"asked"(
),
"wait for more work"(
),
"atnode"(
18,
1389341597340),
"workitem"(
"scala.tools.nsc.interactive.CompilerControl$AskParsedEnteredItem"(
"scala.reflect.internal.util.BatchSourceFile"(
"scala.reflect.io.PlainFile"(
"/Users/mirco/Projects/boo/src/boo/package.scala"),
"tuple3"(
1,
1,
"")),
true)),
"wait for more work"(
),
"atnode"(
19,
1389341597343),
"asked"(
),
"wait for more work"(
),
"atnode"(
21,
1389341597611),
"workitem"(
"scala.tools.nsc.interactive.CompilerControl$ReloadItem"(
"scala.List"(
"scala.reflect.internal.util.BatchSourceFile"(
"scala.reflect.io.PlainFile"(
"/Users/mirco/Projects/boo/src/boo/package.scala"),
"tuple3"(
1,
1,
""))))),
"wait for more work"(
),
"atnode"(
36,
1389341597632),
"workitem"(
"scala.tools.nsc.interactive.CompilerControl$AskLoadedTypedItem"(
"scala.reflect.internal.util.BatchSourceFile"(
"scala.reflect.io.PlainFile"(
"/Users/mirco/Projects/boo/src/boo/package.scala"),
"tuple3"(
1,
1,
"")))),
"wait for more work"(
),
"atnode"(
37,
1389341597635),
"workitem"(
"scala.tools.nsc.interactive.CompilerControl$AskLoadedTypedItem"(
"scala.reflect.internal.util.BatchSourceFile"(
"scala.reflect.io.PlainFile"(
"/Users/mirco/Projects/boo/src/boo/package.scala"),
"tuple3"(
1,
1,
"")))),
"wait for more work"(
),
"atnode"(
38,
1389341597637),
"workitem"(
"scala.tools.nsc.interactive.CompilerControl$AskLoadedTypedItem"(
"scala.reflect.internal.util.BatchSourceFile"(
"scala.reflect.io.PlainFile"(
"/Users/mirco/Projects/boo/src/boo/package.scala"),
"tuple3"(
1,
1,
"")))),
"wait for more work"(
),
"atnode"(
39,
1389341597853),
"workitem"(
"scala.tools.nsc.interactive.CompilerControl$ReloadItem"(
"scala.List"(
"scala.reflect.internal.util.BatchSourceFile"(
"scala.reflect.io.PlainFile"(
"/Users/mirco/Projects/boo/src/boo/package.scala"),
"tuple3"(
0,
0,
"package object boo {\n\n}"))))),
"atnode"(
40,
1389341597858),
"workitem"(
"scala.tools.nsc.interactive.CompilerControl$AskLoadedTypedItem"(
"scala.reflect.internal.util.BatchSourceFile"(
"scala.reflect.io.PlainFile"(
"/Users/mirco/Projects/boo/src/boo/package.scala"),
"tuple3"(
0,
23,
"")))),
"atnode"(
52,
1389341597863),
"asked"(
)
I'm not sure why this started to happen only now, but my hunch is that this is a consequence of the quiescence PR, but that doesn't really matter, as it's purely exposing the fact that we need a different approach for implementing the package object wizard.
Leave a comment
No file chosen
You have an empty file field. Please select or remove it.
Name | Size |
---|