Don't create default importing scopes for REPL snippets
Default scopes should be created only once, for the first snippet. All following snippets should not create new default importing scopes. #KT-35651 fixed
This commit is contained in:
committed by
Ilya Chernikov
parent
c3cbfe34c4
commit
743abea690
+1
-1
@@ -280,7 +280,7 @@ open class ReplCodeAnalyzerBase(
|
||||
// create scope that wraps previous line lexical scope and adds imports from this line
|
||||
val lexicalScopeAfterLastLine = lineInfo.parentLine?.lineDescriptor?.scopeForInitializerResolution ?: return null
|
||||
val lastLineImports = lexicalScopeAfterLastLine.parentsWithSelf.first { it is ImportingScope } as ImportingScope
|
||||
val scopesForThisLine = fileScopeFactory.createScopesForFile(linePsi, lastLineImports)
|
||||
val scopesForThisLine = fileScopeFactory.createScopesForFile(linePsi, lastLineImports, false)
|
||||
val combinedLexicalScopes = if (hasImports)
|
||||
lexicalScopeAfterLastLine.replaceImportingScopes(scopesForThisLine.importingScope)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user