void () { PsiFile psiFile = myFixture.configureByText("foo.kts", "fun foo() {}"); KtFile ktFile = (KtFile) psiFile; assertNull("file is parsed from AST", ktFile.getStub()); List<KtDeclaration> astDeclarations = ktFile.getDeclarations(); assertEquals(1, astDeclarations.size()); assertTrue(astDeclarations.get(0) instanceof KtScript); dropPsiAndTestWithControlledAccessToAst(true, ktFile, getTestRootDisposable(), () -> { List<KtDeclaration> stubDeclarations = ktFile.getDeclarations(); assertEquals(1, stubDeclarations.size()); assertTrue(stubDeclarations.get(0) instanceof KtScript); return null; }); }