diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/FirInvokeResolveTowerExtension.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/FirInvokeResolveTowerExtension.kt index dacac5e204b..52a0c932869 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/FirInvokeResolveTowerExtension.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/tower/FirInvokeResolveTowerExtension.kt @@ -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().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() diff --git a/compiler/testData/cli/jvm/firFriendlyErrorIfNoJdkOptionIsSet.args b/compiler/testData/cli/jvm/firFriendlyErrorIfNoJdkOptionIsSet.args new file mode 100644 index 00000000000..c0f0286857f --- /dev/null +++ b/compiler/testData/cli/jvm/firFriendlyErrorIfNoJdkOptionIsSet.args @@ -0,0 +1,6 @@ +$TESTDATA_DIR$/firFriendlyErrorIfNoJdkOptionIsSet.kt +-language-version +2.0 +-d +$TEMP_DIR$ +-no-jdk \ No newline at end of file diff --git a/compiler/testData/cli/jvm/firFriendlyErrorIfNoJdkOptionIsSet.kt b/compiler/testData/cli/jvm/firFriendlyErrorIfNoJdkOptionIsSet.kt new file mode 100644 index 00000000000..c91aab85aad --- /dev/null +++ b/compiler/testData/cli/jvm/firFriendlyErrorIfNoJdkOptionIsSet.kt @@ -0,0 +1,3 @@ +fun main() { + throw NullPointerException() +} \ No newline at end of file diff --git a/compiler/testData/cli/jvm/firFriendlyErrorIfNoJdkOptionIsSet.out b/compiler/testData/cli/jvm/firFriendlyErrorIfNoJdkOptionIsSet.out new file mode 100644 index 00000000000..4799647102f --- /dev/null +++ b/compiler/testData/cli/jvm/firFriendlyErrorIfNoJdkOptionIsSet.out @@ -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 diff --git a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java index b63b6c9daca..819002b2c72 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -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");