-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
…er crashes This diagnostic is reported in rare situations when StubTypeForBuilderInference is kept as a parameter type of for loop or lambda. Before this commit, we had in K1 "Could not load module <error module>" from IrLinker instead. Related to: KT-52757, KT-53109, KT-63841, KT-64066 #KT-53478 Fixed
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright 2010-2024 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.resolve.checkers | ||
|
||
import org.jetbrains.kotlin.config.LanguageFeature | ||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor | ||
import org.jetbrains.kotlin.descriptors.ValueDescriptor | ||
import org.jetbrains.kotlin.diagnostics.Errors | ||
import org.jetbrains.kotlin.psi.KtDeclaration | ||
import org.jetbrains.kotlin.psi.KtParameter | ||
import org.jetbrains.kotlin.types.StubTypeForBuilderInference | ||
|
||
object StubForBuilderInferenceParameterTypeChecker : DeclarationChecker { | ||
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) { | ||
if (declaration !is KtParameter || | ||
descriptor !is ValueDescriptor || | ||
descriptor.returnType !is StubTypeForBuilderInference | ||
) return | ||
if (context.languageVersionSettings.supportsFeature(LanguageFeature.NoBuilderInferenceWithoutAnnotationRestriction)) return | ||
|
||
context.trace.report(Errors.BUILDER_INFERENCE_STUB_PARAMETER_TYPE.on(declaration, declaration.nameAsSafeName)) | ||
} | ||
} |