summaryrefslogtreecommitdiff
path: root/test/files/presentation/ide-t1001388/Test.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/presentation/ide-t1001388/Test.scala')
-rw-r--r--test/files/presentation/ide-t1001388/Test.scala28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/files/presentation/ide-t1001388/Test.scala b/test/files/presentation/ide-t1001388/Test.scala
new file mode 100644
index 0000000000..f6079cf0b2
--- /dev/null
+++ b/test/files/presentation/ide-t1001388/Test.scala
@@ -0,0 +1,28 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+import scala.reflect.internal.util.SourceFile
+import scala.tools.nsc.interactive.Response
+
+object Test extends InteractiveTest {
+ override def execute(): Unit = {
+ val sourceA = loadSourceAndWaitUntilTypechecked("A.scala")
+ checkPresent(sourceA)
+ }
+
+ private def loadSourceAndWaitUntilTypechecked(sourceName: String): SourceFile = {
+ val sourceFile = sourceFiles.find(_.file.name == sourceName).head
+ askLoadedTyped(sourceFile).get
+ /* The response to `askLoadedType` may return before `interactive.Global.waitLoadedType`
+ * fully executes. Because this test expects `waitLoadedType` is fully executed before
+ * calling `checkPresent`, with the below no-op presentation compiler request we make
+ * sure this requirement is fulfilled.
+ */
+ compiler.askForResponse(() => ()).get
+ sourceFile
+ }
+
+ private def checkPresent(source: SourceFile): Unit = compiler.getUnitOf(source) match {
+ case Some(unit) => reporter.println("Compilation Unit for " + source.file.name + " still loaded after askLoadedTyped")
+
+ case None => reporter.println("Test OK")
+ }
+}