FIR checker: honor DSL marker annotation on the function type

It seems the original function type gets lost during resolution. Hence
thie change added a custom attribute to recover the original function
type on an anonymous function
This commit is contained in:
Tianyu Geng
2021-09-15 21:36:32 -07:00
committed by TeamCityServer
parent 826ea122a9
commit c572bf05b5
11 changed files with 65 additions and 190 deletions
@@ -103,4 +103,23 @@ var <D : FirCallableDeclaration>
D.originalForIntersectionOverrideAttr: D? by FirDeclarationDataRegistry.data(IntersectionOverrideOriginalKey)
private object InitialSignatureKey : FirDeclarationDataKey()
var FirCallableDeclaration.initialSignatureAttr: FirCallableDeclaration? by FirDeclarationDataRegistry.data(InitialSignatureKey)
private object MatchingParameterFunctionTypeKey : FirDeclarationDataKey()
/**
* Consider the following
* ```
* fun <T> run(block: @Foo T.() -> Unit) {...}
*
* fun test() {
* run<String> {
* <caret>
* }
* }
* ```
* The original function type `@Foo T.() -> Unit` can be accessed with this property on the FirAnonymousFunction at caret.
*/
var <D : FirAnonymousFunction>
D.matchingParameterFunctionType: ConeKotlinType? by FirDeclarationDataRegistry.data(MatchingParameterFunctionTypeKey)