[FIR] Introduce TYPE_ARGUMENTS_NOT_ALLOWED & some other type errors
This commit introduces several different things, in particular: - check type arguments in expressions - new TypeArgumentList node to deal with diagnostic source - ConeDiagnostic was moved to fir:cones - ConeIntermediateDiagnostic to use in inference (?) without reporting - detailed diagnostics on error type
This commit is contained in:
Vendored
+12
-2
@@ -1,5 +1,15 @@
|
||||
package org.jetbrains.kotlin.codegen.range.inExpression
|
||||
|
||||
interface ExpressionCodegen
|
||||
interface KtSimpleNameExpression
|
||||
interface InExpressionGenerator
|
||||
interface StackValue
|
||||
open class BranchedValue
|
||||
interface Type
|
||||
interface KotlinType
|
||||
interface Label
|
||||
interface InstructionAdapter
|
||||
|
||||
class CallBasedInExpressionGenerator(
|
||||
val codegen: ExpressionCodegen,
|
||||
operatorReference: KtSimpleNameExpression
|
||||
@@ -8,10 +18,10 @@ class CallBasedInExpressionGenerator(
|
||||
private val isInverted = operatorReference.<!UNRESOLVED_REFERENCE!>getReferencedNameElementType<!>() == <!UNRESOLVED_REFERENCE!>KtTokens<!>.<!UNRESOLVED_REFERENCE!>NOT_IN<!>
|
||||
|
||||
override fun generate(argument: StackValue): BranchedValue =
|
||||
gen(argument).<!INAPPLICABLE_CANDIDATE!>let<!> { if (isInverted) <!UNRESOLVED_REFERENCE!>Invert<!>(it) else it }
|
||||
gen(argument).let { if (isInverted) <!UNRESOLVED_REFERENCE!>Invert<!>(it) else it }
|
||||
|
||||
private fun gen(argument: StackValue): BranchedValue =
|
||||
object : BranchedValue(argument, null, argument.<!UNRESOLVED_REFERENCE!>type<!>, <!UNRESOLVED_REFERENCE!>Opcodes<!>.<!UNRESOLVED_REFERENCE!>IFEQ<!>) {
|
||||
object : <!INAPPLICABLE_CANDIDATE!>BranchedValue<!>(argument, null, argument.<!UNRESOLVED_REFERENCE!>type<!>, <!UNRESOLVED_REFERENCE!>Opcodes<!>.<!UNRESOLVED_REFERENCE!>IFEQ<!>) {
|
||||
override fun putSelector(type: Type, kotlinType: KotlinType?, v: InstructionAdapter) {
|
||||
invokeFunction(v)
|
||||
<!UNRESOLVED_REFERENCE!>coerceTo<!>(type, kotlinType, v)
|
||||
|
||||
Vendored
+34
-12
@@ -1,11 +1,33 @@
|
||||
FILE: CallBasedInExpressionGenerator.kt
|
||||
public final class CallBasedInExpressionGenerator : R|ERROR CLASS: Symbol not found, for `InExpressionGenerator`| {
|
||||
public constructor(codegen: R|ERROR CLASS: Symbol not found, for `ExpressionCodegen`|, operatorReference: R|ERROR CLASS: Symbol not found, for `KtSimpleNameExpression`|): R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator| {
|
||||
public abstract interface ExpressionCodegen : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface KtSimpleNameExpression : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface InExpressionGenerator : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface StackValue : R|kotlin/Any| {
|
||||
}
|
||||
public open class BranchedValue : R|kotlin/Any| {
|
||||
public constructor(): R|org/jetbrains/kotlin/codegen/range/inExpression/BranchedValue| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val codegen: R|ERROR CLASS: Symbol not found, for `ExpressionCodegen`| = R|<local>/codegen|
|
||||
public get(): R|ERROR CLASS: Symbol not found, for `ExpressionCodegen`|
|
||||
}
|
||||
public abstract interface Type : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface KotlinType : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface Label : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface InstructionAdapter : R|kotlin/Any| {
|
||||
}
|
||||
public final class CallBasedInExpressionGenerator : R|org/jetbrains/kotlin/codegen/range/inExpression/InExpressionGenerator| {
|
||||
public constructor(codegen: R|org/jetbrains/kotlin/codegen/range/inExpression/ExpressionCodegen|, operatorReference: R|org/jetbrains/kotlin/codegen/range/inExpression/KtSimpleNameExpression|): R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val codegen: R|org/jetbrains/kotlin/codegen/range/inExpression/ExpressionCodegen| = R|<local>/codegen|
|
||||
public get(): R|org/jetbrains/kotlin/codegen/range/inExpression/ExpressionCodegen|
|
||||
|
||||
private final val resolvedCall: <ERROR TYPE REF: Unresolved name: getResolvedCallWithAssert> = R|<local>/operatorReference|.<Unresolved name: getResolvedCallWithAssert>#(R|<local>/codegen|.<Unresolved name: bindingContext>#)
|
||||
private get(): <ERROR TYPE REF: Unresolved name: getResolvedCallWithAssert>
|
||||
@@ -13,8 +35,8 @@ FILE: CallBasedInExpressionGenerator.kt
|
||||
private final val isInverted: R|kotlin/Boolean| = ==(R|<local>/operatorReference|.<Unresolved name: getReferencedNameElementType>#(), <Unresolved name: KtTokens>#.<Unresolved name: NOT_IN>#)
|
||||
private get(): R|kotlin/Boolean|
|
||||
|
||||
public final override fun generate(argument: R|ERROR CLASS: Symbol not found, for `StackValue`|): R|ERROR CLASS: Symbol not found, for `BranchedValue`| {
|
||||
^generate this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.gen|(R|<local>/argument|).<Inapplicable(WRONG_RECEIVER): kotlin/let>#<R|kotlin/Any?|, R|kotlin/Nothing|>(<L> = let@fun <anonymous>(it: R|kotlin/Any?|): <ERROR TYPE REF: Can't resolve when expression> <kind=EXACTLY_ONCE> {
|
||||
public final override fun generate(argument: R|org/jetbrains/kotlin/codegen/range/inExpression/StackValue|): R|org/jetbrains/kotlin/codegen/range/inExpression/BranchedValue| {
|
||||
^generate this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.gen|(R|<local>/argument|).R|kotlin/let|<R|org/jetbrains/kotlin/codegen/range/inExpression/BranchedValue|, R|org/jetbrains/kotlin/codegen/range/inExpression/BranchedValue|>(<L> = let@fun <anonymous>(it: R|org/jetbrains/kotlin/codegen/range/inExpression/BranchedValue|): R|org/jetbrains/kotlin/codegen/range/inExpression/BranchedValue| <kind=EXACTLY_ONCE> {
|
||||
^ when () {
|
||||
this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.isInverted| -> {
|
||||
<Unresolved name: Invert>#(R|<local>/it|)
|
||||
@@ -28,18 +50,18 @@ FILE: CallBasedInExpressionGenerator.kt
|
||||
)
|
||||
}
|
||||
|
||||
private final fun gen(argument: R|ERROR CLASS: Symbol not found, for `StackValue`|): R|ERROR CLASS: Symbol not found, for `BranchedValue`| {
|
||||
^gen object : R|ERROR CLASS: Symbol not found, for `BranchedValue`| {
|
||||
private final fun gen(argument: R|org/jetbrains/kotlin/codegen/range/inExpression/StackValue|): R|org/jetbrains/kotlin/codegen/range/inExpression/BranchedValue| {
|
||||
^gen object : R|org/jetbrains/kotlin/codegen/range/inExpression/BranchedValue| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|ERROR CLASS: Symbol not found, for `BranchedValue`|>(R|<local>/argument|, Null(null), R|<local>/argument|.<Unresolved name: type>#, <Unresolved name: Opcodes>#.<Unresolved name: IFEQ>#)
|
||||
super<R|org/jetbrains/kotlin/codegen/range/inExpression/BranchedValue|>(R|<local>/argument|, Null(null), R|<local>/argument|.<Unresolved name: type>#, <Unresolved name: Opcodes>#.<Unresolved name: IFEQ>#)
|
||||
}
|
||||
|
||||
public final override fun putSelector(type: R|ERROR CLASS: Symbol not found, for `Type`|, kotlinType: R|ERROR CLASS: Symbol not found, for `KotlinType?`|, v: R|ERROR CLASS: Symbol not found, for `InstructionAdapter`|): R|kotlin/Unit| {
|
||||
public final override fun putSelector(type: R|org/jetbrains/kotlin/codegen/range/inExpression/Type|, kotlinType: R|org/jetbrains/kotlin/codegen/range/inExpression/KotlinType?|, v: R|org/jetbrains/kotlin/codegen/range/inExpression/InstructionAdapter|): R|kotlin/Unit| {
|
||||
this@R|/<anonymous>|.R|/<anonymous>.invokeFunction|(R|<local>/v|)
|
||||
<Unresolved name: coerceTo>#(R|<local>/type|, R|<local>/kotlinType|, R|<local>/v|)
|
||||
}
|
||||
|
||||
public final override fun condJump(jumpLabel: R|ERROR CLASS: Symbol not found, for `Label`|, v: R|ERROR CLASS: Symbol not found, for `InstructionAdapter`|, jumpIfFalse: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
public final override fun condJump(jumpLabel: R|org/jetbrains/kotlin/codegen/range/inExpression/Label|, v: R|org/jetbrains/kotlin/codegen/range/inExpression/InstructionAdapter|, jumpIfFalse: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
this@R|/<anonymous>|.R|/<anonymous>.invokeFunction|(R|<local>/v|)
|
||||
R|<local>/v|.<Unresolved name: visitJumpInsn>#(when () {
|
||||
R|<local>/jumpIfFalse| -> {
|
||||
@@ -52,7 +74,7 @@ FILE: CallBasedInExpressionGenerator.kt
|
||||
, R|<local>/jumpLabel|)
|
||||
}
|
||||
|
||||
private final fun invokeFunction(v: R|ERROR CLASS: Symbol not found, for `InstructionAdapter`|): R|kotlin/Unit| {
|
||||
private final fun invokeFunction(v: R|org/jetbrains/kotlin/codegen/range/inExpression/InstructionAdapter|): R|kotlin/Unit| {
|
||||
lval result: <ERROR TYPE REF: Unresolved name: invokeFunction> = this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.codegen|.<Unresolved name: invokeFunction>#(this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.resolvedCall|.<Unresolved name: call>#, this@R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator|.R|org/jetbrains/kotlin/codegen/range/inExpression/CallBasedInExpressionGenerator.resolvedCall|, <Unresolved name: none>#())
|
||||
R|<local>/result|.<Unresolved name: put>#(R|<local>/result|.<Unresolved name: type>#, R|<local>/result|.<Unresolved name: kotlinType>#, R|<local>/v|)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user