Fix race in IDE: inject proper storage manager for type parameters
With NO_LOCKS strategy we can easily end up in a situation when constraint system for a generic call is built incorrectly, producing flaky errors (or don't produce errors at all) Now proper storage manager is injected for all cases except: - IR - Codegen - Serialization plugin - Fake local objects Most likely, NO_LOCKS strategy for these cases is fine as at that point the compiler works in one thread #KT-34786 Fixed
This commit is contained in:
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||
import org.jetbrains.kotlin.ir.util.TypeTranslator
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||
import org.jetbrains.kotlin.types.*
|
||||
|
||||
class IrBuiltIns(
|
||||
@@ -91,7 +92,7 @@ class IrBuiltIns(
|
||||
SourceElement.NO_SOURCE
|
||||
).apply {
|
||||
typeParameterDescriptor = TypeParameterDescriptorImpl.createWithDefaultBound(
|
||||
this, Annotations.EMPTY, true, Variance.INVARIANT, Name.identifier("T0"), 0
|
||||
this, Annotations.EMPTY, true, Variance.INVARIANT, Name.identifier("T0"), 0, LockBasedStorageManager.NO_LOCKS
|
||||
)
|
||||
|
||||
valueParameterDescriptor = ValueParameterDescriptorImpl(
|
||||
@@ -153,7 +154,8 @@ class IrBuiltIns(
|
||||
SourceElement.NO_SOURCE
|
||||
).apply {
|
||||
typeParameterDescriptor = TypeParameterDescriptorImpl.createForFurtherModification(
|
||||
this, Annotations.EMPTY, false, Variance.INVARIANT, Name.identifier("T0"), 0, SourceElement.NO_SOURCE
|
||||
this, Annotations.EMPTY, false, Variance.INVARIANT, Name.identifier("T0"),
|
||||
0, SourceElement.NO_SOURCE, LockBasedStorageManager.NO_LOCKS
|
||||
).apply {
|
||||
addUpperBound(any)
|
||||
setInitialized()
|
||||
|
||||
@@ -288,6 +288,7 @@ open class WrappedTypeParameterDescriptor(
|
||||
|
||||
override fun getDefaultType() = _defaultType
|
||||
|
||||
override fun getStorageManager() = LockBasedStorageManager.NO_LOCKS
|
||||
|
||||
override fun getContainingDeclaration() = (owner.parent as IrDeclaration).descriptor
|
||||
|
||||
|
||||
Reference in New Issue
Block a user