FIR: Introduce new kotlin types aka 'cones' #KT-24063 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
12acbaaa21
commit
ce7456c93d
@@ -0,0 +1,22 @@
|
||||
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. 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.fir
|
||||
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.FqNameUnsafe
|
||||
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
data class UnambiguousFqName(val packageFqName: FqNameUnsafe, val classFqName: FqName) {
|
||||
|
||||
override fun toString(): String {
|
||||
return packageFqName.asString() + "/" + classFqName.asString()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. 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.fir.types
|
||||
|
||||
import org.jetbrains.kotlin.fir.UnambiguousFqName
|
||||
|
||||
sealed class ConeKotlinTypeProjection(val kind: ProjectionKind)
|
||||
|
||||
enum class ProjectionKind {
|
||||
STAR, IN, OUT, INVARIANT
|
||||
}
|
||||
|
||||
|
||||
object StarProjection : ConeKotlinTypeProjection(ProjectionKind.STAR)
|
||||
|
||||
abstract class ConeKotlinTypeProjectionIn : ConeKotlinTypeProjection(ProjectionKind.IN) {
|
||||
abstract val type: ConeKotlinType
|
||||
}
|
||||
|
||||
abstract class ConeKotlinTypeProjectionOut : ConeKotlinTypeProjection(ProjectionKind.OUT) {
|
||||
abstract val type: ConeKotlinType
|
||||
}
|
||||
|
||||
abstract class ConeKotlinType : ConeKotlinTypeProjection(ProjectionKind.INVARIANT) {
|
||||
abstract val typeArguments: List<ConeKotlinTypeProjection>
|
||||
}
|
||||
|
||||
abstract class ConeClassType : ConeKotlinType() {
|
||||
abstract val fqName: UnambiguousFqName
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. 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.fir.types.impl
|
||||
|
||||
import org.jetbrains.kotlin.fir.UnambiguousFqName
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
|
||||
class ConeClassTypeImpl(
|
||||
override val fqName: UnambiguousFqName,
|
||||
override val typeArguments: List<ConeKotlinTypeProjection>
|
||||
) : ConeClassType()
|
||||
|
||||
class NewKotlinTypeProjectionInImpl(override val type: ConeKotlinType) : ConeKotlinTypeProjectionIn()
|
||||
|
||||
class ConeKotlinTypeProjectionOutImpl(override val type: ConeKotlinType) : ConeKotlinTypeProjectionOut()
|
||||
|
||||
class ConeKotlinErrorType(val reason: String) : ConeKotlinType() {
|
||||
override val typeArguments: List<ConeKotlinTypeProjection>
|
||||
get() = emptyList()
|
||||
|
||||
override fun toString(): String {
|
||||
return "<ERROR TYPE: $reason>"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user