[FIR] Report friendly errors for type aliases from stdlib if -no-jdk option is set
^KT-54531 Fixed
This commit is contained in:
committed by
Space Team
parent
8eeb7e2631
commit
879deb90fc
+3
-3
@@ -174,7 +174,7 @@ internal class FirInvokeResolveTowerExtension(
|
||||
val invokeReceiverExpression =
|
||||
components.createExplicitReceiverForInvoke(
|
||||
invokeReceiverCandidate, info, invokeBuiltinExtensionMode, extensionReceiverExpression
|
||||
)
|
||||
) ?: continue
|
||||
|
||||
val invokeFunctionInfo =
|
||||
info.copy(
|
||||
@@ -283,7 +283,7 @@ private fun BodyResolveComponents.createExplicitReceiverForInvoke(
|
||||
info: CallInfo,
|
||||
invokeBuiltinExtensionMode: Boolean,
|
||||
extensionReceiverExpression: FirExpression
|
||||
): FirExpression {
|
||||
): FirExpression? {
|
||||
return when (val symbol = candidate.symbol) {
|
||||
is FirCallableSymbol<*> -> createExplicitReceiverForInvokeByCallable(
|
||||
candidate, info, invokeBuiltinExtensionMode, extensionReceiverExpression, symbol
|
||||
@@ -294,7 +294,7 @@ private fun BodyResolveComponents.createExplicitReceiverForInvoke(
|
||||
)
|
||||
is FirTypeAliasSymbol -> {
|
||||
val type = symbol.fir.expandedTypeRef.coneTypeUnsafe<ConeClassLikeType>().fullyExpandedType(session)
|
||||
val expansionRegularClassSymbol = type.lookupTag.toSymbolOrError(session)
|
||||
val expansionRegularClassSymbol = type.lookupTag.toSymbol(session) ?: return null
|
||||
buildResolvedQualifierForClass(expansionRegularClassSymbol, sourceElement = symbol.fir.source)
|
||||
}
|
||||
else -> throw AssertionError()
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
$TESTDATA_DIR$/firFriendlyErrorIfNoJdkOptionIsSet.kt
|
||||
-language-version
|
||||
2.0
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-no-jdk
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
throw NullPointerException()
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||
compiler/testData/cli/jvm/firFriendlyErrorIfNoJdkOptionIsSet.kt:2:11: error: unresolved reference: NullPointerException
|
||||
throw NullPointerException()
|
||||
^
|
||||
compiler/testData/cli/jvm/firFriendlyErrorIfNoJdkOptionIsSet.kt:2:11: error: type mismatch: inferred type is ERROR CLASS: Unresolved name: NullPointerException but kotlin/Throwable was expected
|
||||
throw NullPointerException()
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
@@ -525,6 +525,11 @@ public class CliTestGenerated extends AbstractCliTest {
|
||||
runTest("compiler/testData/cli/jvm/firErrorOnLastLineNoEol.args");
|
||||
}
|
||||
|
||||
@TestMetadata("firFriendlyErrorIfNoJdkOptionIsSet.args")
|
||||
public void testFirFriendlyErrorIfNoJdkOptionIsSet() throws Exception {
|
||||
runTest("compiler/testData/cli/jvm/firFriendlyErrorIfNoJdkOptionIsSet.args");
|
||||
}
|
||||
|
||||
@TestMetadata("firHello.args")
|
||||
public void testFirHello() throws Exception {
|
||||
runTest("compiler/testData/cli/jvm/firHello.args");
|
||||
|
||||
Reference in New Issue
Block a user