[FIR] Fix resolving of single underscore _
Now compiler throws `UNRESOLVED_REFERENCE` here:
```
val boo = { _: Exception -> `_`.stackTrace }
```
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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.fir
|
||||
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
|
||||
@NoMutableState
|
||||
class FirLanguageSettingsComponent(val languageVersionSettings: LanguageVersionSettings) : FirSessionComponent
|
||||
|
||||
private val FirSession.languageSettingsComponent: FirLanguageSettingsComponent by FirSession.sessionComponentAccessor()
|
||||
|
||||
val FirSession.languageVersionSettings: LanguageVersionSettings
|
||||
get() = languageSettingsComponent.languageVersionSettings
|
||||
+4
-1
@@ -39,6 +39,7 @@ import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.fir.types.FirImplicitTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.coneType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.name.SpecialNames.UNDERSCORE_FOR_UNUSED_VAR
|
||||
|
||||
class BodyResolveContext(
|
||||
val returnTypeCalculator: ReturnTypeCalculator,
|
||||
@@ -612,7 +613,9 @@ class BodyResolveContext(
|
||||
valueParameter: FirValueParameter,
|
||||
f: () -> T
|
||||
): T {
|
||||
storeVariable(valueParameter)
|
||||
if (!valueParameter.name.isSpecial || valueParameter.name != UNDERSCORE_FOR_UNUSED_VAR) {
|
||||
storeVariable(valueParameter)
|
||||
}
|
||||
return withContainer(valueParameter, f)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user