FIR IDE: add KtSubstitutor

This commit is contained in:
Tianyu Geng
2021-08-26 14:35:08 -07:00
committed by Ilya Kirillov
parent ba8dc49a31
commit 245c4082cd
3 changed files with 71 additions and 18 deletions
@@ -0,0 +1,20 @@
/*
* 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.types
import org.jetbrains.kotlin.analysis.api.ValidityTokenOwner
import org.jetbrains.kotlin.analysis.api.tokens.ValidityToken
import org.jetbrains.kotlin.analysis.api.withValidityAssertion
public interface KtSubstitutor : ValidityTokenOwner {
public fun substituteOrSelf(type: KtType): KtType = substituteOrNull(type) ?: type
public fun substituteOrNull(type: KtType): KtType?
public class Empty(override val token: ValidityToken) : KtSubstitutor {
override fun substituteOrNull(type: KtType): KtType = withValidityAssertion { type }
}
}