/
KtFe10TypeProvider.kt
502 lines (416 loc) · 23.3 KB
/
KtFe10TypeProvider.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.api.descriptors.components
import org.jetbrains.kotlin.analysis.api.components.KtBuiltinTypes
import org.jetbrains.kotlin.analysis.api.components.KtTypeProvider
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisContext
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisFacade.AnalysisMode
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.components.base.Fe10KtAnalysisSessionComponent
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.base.KtFe10Symbol
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.*
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.classId
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.getSymbolDescriptor
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.isInterfaceLike
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtType
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.psiBased.base.getResolutionScope
import org.jetbrains.kotlin.analysis.api.descriptors.types.base.KtFe10Type
import org.jetbrains.kotlin.analysis.api.descriptors.utils.PublicApproximatorConfiguration
import org.jetbrains.kotlin.analysis.api.lifetime.KtLifetimeToken
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
import org.jetbrains.kotlin.analysis.api.symbols.KtCallableSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtNamedClassOrObjectSymbol
import org.jetbrains.kotlin.analysis.api.symbols.nameOrAnonymous
import org.jetbrains.kotlin.analysis.api.types.KtType
import org.jetbrains.kotlin.analysis.api.types.KtTypeNullability
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.name.StandardClassIds
import org.jetbrains.kotlin.psi.KtCallElement
import org.jetbrains.kotlin.psi.KtDoubleColonExpression
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtTypeReference
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.calls.inference.CapturedType
import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall
import org.jetbrains.kotlin.resolve.scopes.utils.getImplicitReceiversHierarchy
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.checker.NewCapturedType
import org.jetbrains.kotlin.types.checker.NewTypeVariableConstructor
import org.jetbrains.kotlin.types.checker.intersectWrappedTypes
import org.jetbrains.kotlin.types.error.ErrorType
import org.jetbrains.kotlin.types.error.ErrorTypeKind
import org.jetbrains.kotlin.types.error.ErrorUtils
import org.jetbrains.kotlin.types.typeUtil.builtIns
import org.jetbrains.kotlin.types.typeUtil.isNothing
import org.jetbrains.kotlin.util.containingNonLocalDeclaration
internal class KtFe10TypeProvider(
override val analysisSession: KtFe10AnalysisSession
) : KtTypeProvider(), Fe10KtAnalysisSessionComponent {
@Suppress("SpellCheckingInspection")
private val typeApproximator by lazy {
TypeApproximator(
analysisContext.builtIns,
analysisContext.resolveSession.languageVersionSettings
)
}
override val token: KtLifetimeToken
get() = analysisSession.token
override val builtinTypes: KtBuiltinTypes by lazy(LazyThreadSafetyMode.PUBLICATION) { KtFe10BuiltinTypes(analysisContext) }
override fun approximateToSuperPublicDenotableType(type: KtType, approximateLocalTypes: Boolean): KtType? {
require(type is KtFe10Type)
return typeApproximator.approximateToSuperType(type.fe10Type, PublicApproximatorConfiguration(approximateLocalTypes))
?.toKtType(analysisContext)
}
override fun approximateToSubPublicDenotableType(type: KtType, approximateLocalTypes: Boolean): KtType? {
require(type is KtFe10Type)
return typeApproximator.approximateToSubType(type.fe10Type, PublicApproximatorConfiguration(approximateLocalTypes))
?.toKtType(analysisContext)
}
override fun getEnhancedType(type: KtType): KtType? {
require(type is KtFe10Type)
val enhancement = (type.fe10Type as? TypeWithEnhancement)?.enhancement
return enhancement?.toKtType(analysisContext)
}
override fun buildSelfClassType(symbol: KtNamedClassOrObjectSymbol): KtType {
val kotlinType = (getSymbolDescriptor(symbol) as? ClassDescriptor)?.defaultType
?: ErrorUtils.createErrorType(ErrorTypeKind.UNRESOLVED_CLASS_TYPE, symbol.nameOrAnonymous.toString())
return kotlinType.toKtType(analysisContext)
}
override fun commonSuperType(types: Collection<KtType>): KtType {
val kotlinTypes = types.map { (it as KtFe10Type).fe10Type }
return CommonSupertypes.commonSupertype(kotlinTypes).toKtType(analysisContext)
}
override fun getKtType(ktTypeReference: KtTypeReference): KtType {
val bindingContext = analysisContext.analyze(ktTypeReference, AnalysisMode.PARTIAL)
val kotlinType = bindingContext[BindingContext.TYPE, ktTypeReference]
?: getKtTypeAsTypeArgument(ktTypeReference)
?: ErrorUtils.createErrorType(ErrorTypeKind.UNRESOLVED_TYPE, ktTypeReference.text)
return kotlinType.toKtType(analysisContext)
}
private fun getKtTypeAsTypeArgument(ktTypeReference: KtTypeReference): KotlinType? {
val call = ktTypeReference.getParentOfType<KtCallElement>(strict = true) ?: return null
val bindingContext = analysisContext.analyze(ktTypeReference, AnalysisMode.PARTIAL)
val resolvedCall = call.getResolvedCall(bindingContext) ?: return null
val typeProjection = call.typeArguments.find { it.typeReference == ktTypeReference } ?: return null
val index = call.typeArguments.indexOf(typeProjection)
val paramDescriptor = resolvedCall.candidateDescriptor.typeParameters.find { it.index == index } ?: return null
return resolvedCall.typeArguments[paramDescriptor]
}
override fun getReceiverTypeForDoubleColonExpression(expression: KtDoubleColonExpression): KtType? {
val bindingContext = analysisContext.analyze(expression, AnalysisMode.PARTIAL)
val lhs = bindingContext[BindingContext.DOUBLE_COLON_LHS, expression.receiverExpression] ?: return null
return lhs.type.toKtType(analysisContext)
}
override fun withNullability(type: KtType, newNullability: KtTypeNullability): KtType {
require(type is KtFe10Type)
return type.fe10Type.makeNullableAsSpecified(newNullability == KtTypeNullability.NULLABLE).toKtType(analysisContext)
}
override fun haveCommonSubtype(a: KtType, b: KtType): Boolean {
return areTypesCompatible((a as KtFe10Type).fe10Type, (b as KtFe10Type).fe10Type)
}
override fun getImplicitReceiverTypesAtPosition(position: KtElement): List<KtType> {
val elementToAnalyze = position.containingNonLocalDeclaration() ?: position
val bindingContext = analysisContext.analyze(elementToAnalyze)
val lexicalScope = position.getResolutionScope(bindingContext) ?: return emptyList()
return lexicalScope.getImplicitReceiversHierarchy().map { it.type.toKtType(analysisContext) }
}
override fun getDirectSuperTypes(type: KtType, shouldApproximate: Boolean): List<KtType> {
require(type is KtFe10Type)
return TypeUtils.getImmediateSupertypes(type.fe10Type).map { it.toKtType(analysisContext) }
}
override fun getAllSuperTypes(type: KtType, shouldApproximate: Boolean): List<KtType> {
require(type is KtFe10Type)
return TypeUtils.getAllSupertypes(type.fe10Type).map { it.toKtType(analysisContext) }
}
override fun getDispatchReceiverType(symbol: KtCallableSymbol): KtType? {
require(symbol is KtFe10Symbol)
val descriptor = symbol.getDescriptor() as? CallableDescriptor ?: return null
return descriptor.dispatchReceiverParameter?.type?.toKtType(analysisContext)
}
override fun getArrayElementType(type: KtType): KtType? {
require(type is KtFe10Type)
val fe10Type = type.fe10Type
if (!KotlinBuiltIns.isArrayOrPrimitiveArray(fe10Type)) return null
val arrayElementType = fe10Type.builtIns.getArrayElementType(fe10Type)
return arrayElementType.toKtType(analysisContext)
}
private fun areTypesCompatible(a: KotlinType, b: KotlinType): Boolean {
if (a.isNothing() || b.isNothing() || TypeUtils.equalTypes(a, b) || (a.isNullable() && b.isNullable())) {
return true
}
val aConstructor = a.constructor
val bConstructor = b.constructor
if (aConstructor is IntersectionTypeConstructor) {
return aConstructor.supertypes.all { areTypesCompatible(it, b) }
}
if (bConstructor is IntersectionTypeConstructor) {
return bConstructor.supertypes.all { areTypesCompatible(a, it) }
}
val intersectionType = intersectWrappedTypes(listOf(a, b))
val intersectionTypeConstructor = intersectionType.constructor
if (intersectionTypeConstructor is IntersectionTypeConstructor) {
val intersectedTypes = intersectionTypeConstructor.supertypes
if (intersectedTypes.all { it.isNullable() }) {
return true
}
val collectedUpperBounds = intersectedTypes.flatMapTo(mutableSetOf()) { getUpperBounds(it) }
return areBoundsCompatible(collectedUpperBounds, emptySet())
} else {
return !intersectionType.isNothing()
}
}
private fun getUpperBounds(type: KotlinType): List<KotlinType> {
when (type) {
is FlexibleType -> return getUpperBounds(type.upperBound)
is DefinitelyNotNullType -> return getUpperBounds(type.original)
is ErrorType -> return emptyList()
is CapturedType -> return type.constructor.supertypes.flatMap { getUpperBounds(it) }
is NewCapturedType -> return type.constructor.supertypes.flatMap { getUpperBounds(it) }
is SimpleType -> {
val typeParameterDescriptor = TypeUtils.getTypeParameterDescriptorOrNull(type)
if (typeParameterDescriptor != null) {
return typeParameterDescriptor.upperBounds.flatMap { getUpperBounds(it) }
}
val typeConstructor = type.constructor
if (typeConstructor is NewTypeVariableConstructor) {
return typeConstructor.originalTypeParameter?.upperBounds.orEmpty().flatMap { getUpperBounds(it) }
}
if (typeConstructor is IntersectionTypeConstructor) {
return typeConstructor.supertypes.flatMap { getUpperBounds(it) }
}
return listOf(type)
}
else -> return emptyList()
}
}
private fun areBoundsCompatible(
upperBounds: Set<KotlinType>,
lowerBounds: Set<KotlinType>,
checkedTypeParameters: MutableSet<TypeParameterDescriptor> = mutableSetOf()
): Boolean {
val upperBoundClasses = upperBounds.mapNotNull { getBoundClass(it) }.toSet()
val leafClassesOrInterfaces = computeLeafClassesOrInterfaces(upperBoundClasses)
if (areClassesOrInterfacesIncompatible(leafClassesOrInterfaces)) {
return false
}
if (!lowerBounds.all { lowerBoundType ->
val classesSatisfyingLowerBounds = collectSuperClasses(lowerBoundType)
leafClassesOrInterfaces.all { it in classesSatisfyingLowerBounds }
}
) {
return false
}
if (upperBounds.size < 2) {
return true
}
val typeArgumentMapping = collectTypeArgumentMapping(upperBounds)
for ((typeParameter, boundTypeArguments) in typeArgumentMapping) {
if (!boundTypeArguments.isCompatible) {
return false
}
checkedTypeParameters.add(typeParameter)
if (!areBoundsCompatible(boundTypeArguments.upper, boundTypeArguments.lower, checkedTypeParameters)) {
return false
}
}
return true
}
private fun collectTypeArgumentMapping(upperBounds: Set<KotlinType>): Map<TypeParameterDescriptor, BoundTypeArguments> {
val typeArgumentMapping = LinkedHashMap<TypeParameterDescriptor, BoundTypeArguments>()
for (type in upperBounds) {
val mappingForType = type.toTypeArgumentMapping() ?: continue
val queue = ArrayDeque<TypeArgumentMapping>()
queue.addLast(mappingForType)
while (queue.isNotEmpty()) {
val (typeParameterOwner, mapping) = queue.removeFirst()
for (superType in typeParameterOwner.typeConstructor.supertypes) {
val mappingForSupertype = superType.toTypeArgumentMapping(mapping) ?: continue
queue.addLast(mappingForSupertype)
}
for ((typeParameterDescriptor, boundTypeArgument) in mapping) {
val boundsForParameter = typeArgumentMapping.computeIfAbsent(typeParameterDescriptor) {
var isCompatible = true
val languageVersionSettings = analysisContext.resolveSession.languageVersionSettings
if (languageVersionSettings.supportsFeature(LanguageFeature.ProhibitComparisonOfIncompatibleEnums)) {
isCompatible = isCompatible && typeParameterOwner.classId != StandardClassIds.Enum
}
if (languageVersionSettings.supportsFeature(LanguageFeature.ProhibitComparisonOfIncompatibleClasses)) {
isCompatible = isCompatible && typeParameterOwner.classId != StandardClassIds.KClass
}
BoundTypeArguments(mutableSetOf(), mutableSetOf(), isCompatible)
}
if (boundTypeArgument.variance.allowsOutPosition) {
boundsForParameter.upper += boundTypeArgument.type.collectUpperBounds()
}
if (boundTypeArgument.variance.allowsInPosition) {
boundsForParameter.lower += boundTypeArgument.type.collectLowerBounds()
}
}
}
}
return typeArgumentMapping
}
private fun KotlinType.collectLowerBounds(): Set<KotlinType> {
when (this) {
is FlexibleType -> return lowerBound.collectLowerBounds()
is DefinitelyNotNullType -> return original.collectLowerBounds()
is ErrorType -> return emptySet()
is CapturedType, is NewCapturedType -> return constructor.supertypes.flatMapTo(mutableSetOf()) { it.collectLowerBounds() }
is SimpleType -> {
val typeParameterDescriptor = TypeUtils.getTypeParameterDescriptorOrNull(this)
if (typeParameterDescriptor != null) {
return emptySet()
}
return when (val typeConstructor = this.constructor) {
is NewTypeVariableConstructor -> emptySet()
is IntersectionTypeConstructor -> typeConstructor.supertypes.flatMapTo(mutableSetOf()) { it.collectLowerBounds() }
else -> setOf(this)
}
}
else -> return emptySet()
}
}
private fun KotlinType.collectUpperBounds(): Set<KotlinType> {
when (this) {
is FlexibleType -> return lowerBound.collectUpperBounds()
is DefinitelyNotNullType -> return original.collectUpperBounds()
is ErrorType -> return emptySet()
is CapturedType, is NewCapturedType -> return constructor.supertypes.flatMapTo(mutableSetOf()) { it.collectUpperBounds() }
is SimpleType -> {
val typeParameterDescriptor = TypeUtils.getTypeParameterDescriptorOrNull(this)
if (typeParameterDescriptor != null) {
return typeParameterDescriptor.upperBounds.flatMapTo(mutableSetOf()) { it.collectUpperBounds() }
}
return when (val typeConstructor = this.constructor) {
is NewTypeVariableConstructor -> typeConstructor.supertypes.flatMapTo(mutableSetOf()) { it.collectUpperBounds() }
is IntersectionTypeConstructor -> typeConstructor.supertypes.flatMapTo(mutableSetOf()) { it.collectUpperBounds() }
else -> setOf(this)
}
}
else -> return emptySet()
}
}
private fun KotlinType.toTypeArgumentMapping(
envMapping: Map<TypeParameterDescriptor, BoundTypeArgument> = emptyMap()
): TypeArgumentMapping? {
val typeParameterOwner = constructor.declarationDescriptor as? ClassifierDescriptorWithTypeParameters ?: return null
val mapping = mutableMapOf<TypeParameterDescriptor, BoundTypeArgument>()
arguments.forEachIndexed { index, typeProjection ->
val typeParameter = typeParameterOwner.declaredTypeParameters.getOrNull(index) ?: return@forEachIndexed
var boundTypeArgument: BoundTypeArgument = when {
typeProjection.isStarProjection -> return@forEachIndexed
typeProjection.projectionKind == Variance.INVARIANT -> {
when (typeParameter.variance) {
Variance.IN_VARIANCE -> BoundTypeArgument(typeProjection.type, Variance.IN_VARIANCE)
Variance.OUT_VARIANCE -> BoundTypeArgument(typeProjection.type, Variance.OUT_VARIANCE)
else -> BoundTypeArgument(typeProjection.type, Variance.INVARIANT)
}
}
else -> BoundTypeArgument(typeProjection.type, typeProjection.projectionKind)
}
val typeParameterDescriptor = TypeUtils.getTypeParameterDescriptorOrNull(boundTypeArgument.type)
if (typeParameterDescriptor != null) {
val mappedTypeArgument = envMapping[typeParameterDescriptor]
if (mappedTypeArgument != null) {
boundTypeArgument = mappedTypeArgument
}
}
mapping.put(typeParameter, boundTypeArgument)
}
return TypeArgumentMapping(typeParameterOwner, mapping)
}
private data class TypeArgumentMapping(
val owner: ClassifierDescriptorWithTypeParameters,
val mapping: Map<TypeParameterDescriptor, BoundTypeArgument>
)
private data class BoundTypeArgument(val type: KotlinType, val variance: Variance)
private data class BoundTypeArguments(val upper: MutableSet<KotlinType>, val lower: MutableSet<KotlinType>, val isCompatible: Boolean)
private fun computeLeafClassesOrInterfaces(upperBoundClasses: Set<ClassDescriptor>): Set<ClassDescriptor> {
val isLeaf = mutableMapOf<ClassDescriptor, Boolean>()
upperBoundClasses.associateWithTo(isLeaf) { true }
val queue = ArrayDeque(upperBoundClasses)
while (queue.isNotEmpty()) {
for (superClass in DescriptorUtils.getSuperclassDescriptors(queue.removeFirst())) {
when (isLeaf[superClass]) {
true -> isLeaf[superClass] = false
false -> {}
else -> {
isLeaf[superClass] = false
queue.addLast(superClass)
}
}
}
}
return isLeaf.filterValues { it }.keys
}
private fun getBoundClass(type: KotlinType): ClassDescriptor? {
return when (val declaration = type.constructor.declarationDescriptor) {
is ClassDescriptor -> declaration
is TypeAliasDescriptor -> getBoundClass(declaration.expandedType)
else -> null
}
}
private fun collectSuperClasses(type: KotlinType): Set<ClassDescriptor> {
val initialClass = getBoundClass(type) ?: return emptySet()
val result = mutableSetOf<ClassDescriptor>()
result.add(initialClass)
val queue = ArrayDeque<ClassDescriptor>()
queue.addLast(initialClass)
while (queue.isNotEmpty()) {
val current = queue.removeFirst()
val supertypes = DescriptorUtils.getSuperclassDescriptors(current)
supertypes.filterNotTo(queue) { it !in result }
result.addAll(supertypes)
}
return result
}
private fun areClassesOrInterfacesIncompatible(classesOrInterfaces: Collection<ClassDescriptor>): Boolean {
val classes = classesOrInterfaces.filter { !it.isInterfaceLike }
return when {
classes.size >= 2 -> true
!classes.any { it.isFinalOrEnum } -> false
classesOrInterfaces.size > classes.size -> true
else -> false
}
}
}
private class KtFe10BuiltinTypes(private val analysisContext: Fe10AnalysisContext) : KtBuiltinTypes() {
override val token: KtLifetimeToken
get() = analysisContext.token
override val INT: KtType
get() = withValidityAssertion { analysisContext.builtIns.intType.toKtType(analysisContext) }
override val LONG: KtType
get() = withValidityAssertion { analysisContext.builtIns.longType.toKtType(analysisContext) }
override val SHORT: KtType
get() = withValidityAssertion { analysisContext.builtIns.shortType.toKtType(analysisContext) }
override val BYTE: KtType
get() = withValidityAssertion { analysisContext.builtIns.byteType.toKtType(analysisContext) }
override val FLOAT: KtType
get() = withValidityAssertion { analysisContext.builtIns.floatType.toKtType(analysisContext) }
override val DOUBLE: KtType
get() = withValidityAssertion { analysisContext.builtIns.doubleType.toKtType(analysisContext) }
override val BOOLEAN: KtType
get() = withValidityAssertion { analysisContext.builtIns.booleanType.toKtType(analysisContext) }
override val CHAR: KtType
get() = withValidityAssertion { analysisContext.builtIns.charType.toKtType(analysisContext) }
override val STRING: KtType
get() = withValidityAssertion { analysisContext.builtIns.stringType.toKtType(analysisContext) }
override val UNIT: KtType
get() = withValidityAssertion { analysisContext.builtIns.unitType.toKtType(analysisContext) }
override val NOTHING: KtType
get() = withValidityAssertion { analysisContext.builtIns.nothingType.toKtType(analysisContext) }
override val ANY: KtType
get() = withValidityAssertion { analysisContext.builtIns.anyType.toKtType(analysisContext) }
override val THROWABLE: KtType
get() = withValidityAssertion { analysisContext.builtIns.throwable.defaultType.toKtType(analysisContext) }
override val NULLABLE_ANY: KtType
get() = withValidityAssertion { analysisContext.builtIns.nullableAnyType.toKtType(analysisContext) }
override val NULLABLE_NOTHING: KtType
get() = withValidityAssertion { analysisContext.builtIns.nullableNothingType.toKtType(analysisContext) }
}