K2: reproduce KT-58520 in FIR2IR (K2 fails with exception)
This commit is contained in:
committed by
Space Team
parent
d83f6a40fb
commit
8bc72cb2e5
+6
@@ -2840,6 +2840,12 @@ public class FirLightTreeJvmIrTextTestGenerated extends AbstractFirLightTreeJvmI
|
||||
runTest("compiler/testData/ir/irText/firProblems/throwableStackTrace.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("timesInBuilder.kt")
|
||||
public void testTimesInBuilder() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/timesInBuilder.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterBounds.kt")
|
||||
public void testTypeParameterBounds() throws Exception {
|
||||
|
||||
compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/FirPsiJvmIrTextTestGenerated.java
Generated
+6
@@ -2840,6 +2840,12 @@ public class FirPsiJvmIrTextTestGenerated extends AbstractFirPsiJvmIrTextTest {
|
||||
runTest("compiler/testData/ir/irText/firProblems/throwableStackTrace.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("timesInBuilder.kt")
|
||||
public void testTimesInBuilder() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/timesInBuilder.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterBounds.kt")
|
||||
public void testTypeParameterBounds() throws Exception {
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
FILE fqName:<root> fileName:/timesInBuilder.kt
|
||||
FUN name:test visibility:private modality:FINAL <> (x:kotlin.Long) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Long
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='private final fun test (x: kotlin.Long): kotlin.Unit declared in <root>'
|
||||
CALL 'private final fun countIssues (restrictionsBuilder: @[ExtensionFunctionType] kotlin.Function1<<root>.ArgumentsBuilder, kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||
restrictionsBuilder: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1<<root>.ArgumentsBuilder, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> ($receiver:<root>.ArgumentsBuilder) returnType:kotlin.Unit
|
||||
$receiver: VALUE_PARAMETER name:$this$countIssues type:<root>.ArgumentsBuilder
|
||||
BLOCK_BODY
|
||||
CALL 'public final fun unaryPlus (): kotlin.Unit [operator] declared in <root>.ArgumentsBuilder' type=kotlin.Unit origin=UPLUS
|
||||
$this: GET_VAR '$this$countIssues: <root>.ArgumentsBuilder declared in <root>.test.<anonymous>' type=<root>.ArgumentsBuilder origin=null
|
||||
$receiver: CALL 'public final fun lessEq <T> (t: T of <root>.lessEq): <root>.Expression [infix] declared in <root>' type=<root>.Expression origin=null
|
||||
<T>: kotlin.Int
|
||||
$receiver: CALL 'public final fun <get-spentTime> (): <root>.Column declared in <root>' type=<root>.Column origin=GET_PROPERTY
|
||||
t: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MUL
|
||||
$this: CONST Int type=kotlin.Int value=2
|
||||
other: CONST Int type=kotlin.Int value=60
|
||||
CALL 'public final fun unaryPlus (): kotlin.Unit [operator] declared in <root>.ArgumentsBuilder' type=kotlin.Unit origin=UPLUS
|
||||
$this: GET_VAR '$this$countIssues: <root>.ArgumentsBuilder declared in <root>.test.<anonymous>' type=<root>.ArgumentsBuilder origin=null
|
||||
$receiver: CALL 'public final fun lessEq <T> (t: T of <root>.lessEq): <root>.Expression [infix] declared in <root>' type=<root>.Expression origin=null
|
||||
<T>: kotlin.Int
|
||||
$receiver: CALL 'public final fun <get-spentTime> (): <root>.Column declared in <root>' type=<root>.Column origin=GET_PROPERTY
|
||||
t: CALL 'public final fun id <I> (arg: I of <root>.id): I of <root>.id declared in <root>' type=kotlin.Int origin=null
|
||||
<I>: kotlin.Int
|
||||
arg: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MUL
|
||||
$this: CONST Int type=kotlin.Int value=2
|
||||
other: CONST Int type=kotlin.Int value=60
|
||||
CALL 'public final fun unaryPlus (): kotlin.Unit [operator] declared in <root>.ArgumentsBuilder' type=kotlin.Unit origin=UPLUS
|
||||
$this: GET_VAR '$this$countIssues: <root>.ArgumentsBuilder declared in <root>.test.<anonymous>' type=<root>.ArgumentsBuilder origin=null
|
||||
$receiver: CALL 'public final fun select <T> (t: T of <root>.select, r: T of <root>.select): <root>.Expression declared in <root>' type=<root>.Expression origin=null
|
||||
<T>: kotlin.Long
|
||||
$receiver: CALL 'public final fun <get-spentTime> (): <root>.Column declared in <root>' type=<root>.Column origin=GET_PROPERTY
|
||||
t: CALL 'public open fun toLong (): kotlin.Long declared in kotlin.Int' type=kotlin.Long origin=null
|
||||
$this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MUL
|
||||
$this: CONST Int type=kotlin.Int value=2
|
||||
other: CONST Int type=kotlin.Int value=60
|
||||
r: GET_VAR 'x: kotlin.Long declared in <root>.test' type=kotlin.Long origin=null
|
||||
PROPERTY name:spentTime visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:spentTime type:<root>.Column visibility:private [final,static]
|
||||
EXPRESSION_BODY
|
||||
CALL 'public final fun integer (name: kotlin.String): <root>.Column declared in <root>' type=<root>.Column origin=null
|
||||
name: CONST String type=kotlin.String value="spentTime"
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-spentTime> visibility:public modality:FINAL <> () returnType:<root>.Column
|
||||
correspondingProperty: PROPERTY name:spentTime visibility:public modality:FINAL [val]
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-spentTime> (): <root>.Column declared in <root>'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:spentTime type:<root>.Column visibility:private [final,static]' type=<root>.Column origin=null
|
||||
FUN name:integer visibility:public modality:FINAL <> (name:kotlin.String) returnType:<root>.Column
|
||||
VALUE_PARAMETER name:name index:0 type:kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun integer (name: kotlin.String): <root>.Column declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Column' type=<root>.Column origin=null
|
||||
FUN name:id visibility:public modality:FINAL <I> (arg:I of <root>.id) returnType:I of <root>.id
|
||||
TYPE_PARAMETER name:I index:0 variance: superTypes:[kotlin.Any?] reified:false
|
||||
VALUE_PARAMETER name:arg index:0 type:I of <root>.id
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun id <I> (arg: I of <root>.id): I of <root>.id declared in <root>'
|
||||
GET_VAR 'arg: I of <root>.id declared in <root>.id' type=I of <root>.id origin=null
|
||||
FUN name:lessEq visibility:public modality:FINAL <T> ($receiver:<root>.Column, t:T of <root>.lessEq) returnType:<root>.Expression [infix]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Comparable<T of <root>.lessEq>] reified:false
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.Column
|
||||
VALUE_PARAMETER name:t index:0 type:T of <root>.lessEq
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun lessEq <T> (t: T of <root>.lessEq): <root>.Expression [infix] declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Expression' type=<root>.Expression origin=null
|
||||
FUN name:select visibility:public modality:FINAL <T> ($receiver:<root>.Column, t:T of <root>.select, r:T of <root>.select) returnType:<root>.Expression
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Comparable<T of <root>.select>] reified:false
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.Column
|
||||
VALUE_PARAMETER name:t index:0 type:T of <root>.select
|
||||
VALUE_PARAMETER name:r index:1 type:T of <root>.select
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun select <T> (t: T of <root>.select, r: T of <root>.select): <root>.Expression declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Expression' type=<root>.Expression origin=null
|
||||
CLASS CLASS name:Expression modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Expression
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.Expression [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Expression modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:Column modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Column
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.Column [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Column modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:ArgumentsBuilder modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.ArgumentsBuilder
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.ArgumentsBuilder [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ArgumentsBuilder modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:arguments visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:arguments type:kotlin.collections.MutableList<<root>.Expression> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CALL 'public final fun mutableListOf <T> (): kotlin.collections.MutableList<T of kotlin.collections.CollectionsKt.mutableListOf> [inline] declared in kotlin.collections.CollectionsKt' type=kotlin.collections.MutableList<<root>.Expression> origin=null
|
||||
<T>: <root>.Expression
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-arguments> visibility:public modality:FINAL <> ($this:<root>.ArgumentsBuilder) returnType:kotlin.collections.MutableList<<root>.Expression>
|
||||
correspondingProperty: PROPERTY name:arguments visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.ArgumentsBuilder
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-arguments> (): kotlin.collections.MutableList<<root>.Expression> declared in <root>.ArgumentsBuilder'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:arguments type:kotlin.collections.MutableList<<root>.Expression> visibility:private [final]' type=kotlin.collections.MutableList<<root>.Expression> origin=null
|
||||
receiver: GET_VAR '<this>: <root>.ArgumentsBuilder declared in <root>.ArgumentsBuilder.<get-arguments>' type=<root>.ArgumentsBuilder origin=null
|
||||
FUN name:unaryPlus visibility:public modality:FINAL <> ($this:<root>.ArgumentsBuilder, $receiver:<root>.Expression) returnType:kotlin.Unit [operator]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.ArgumentsBuilder
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.Expression
|
||||
BLOCK_BODY
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CALL 'public abstract fun add (element: E of kotlin.collections.MutableList): kotlin.Boolean declared in kotlin.collections.MutableList' type=kotlin.Boolean origin=null
|
||||
$this: CALL 'public final fun <get-arguments> (): kotlin.collections.MutableList<<root>.Expression> declared in <root>.ArgumentsBuilder' type=kotlin.collections.MutableList<<root>.Expression> origin=GET_PROPERTY
|
||||
$this: GET_VAR '<this>: <root>.ArgumentsBuilder declared in <root>.ArgumentsBuilder.unaryPlus' type=<root>.ArgumentsBuilder origin=null
|
||||
element: GET_VAR '<this>: <root>.Expression declared in <root>.ArgumentsBuilder.unaryPlus' type=<root>.Expression origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:countIssues visibility:private modality:FINAL <> (restrictionsBuilder:@[ExtensionFunctionType] kotlin.Function1<<root>.ArgumentsBuilder, kotlin.Unit>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:restrictionsBuilder index:0 type:@[ExtensionFunctionType] kotlin.Function1<<root>.ArgumentsBuilder, kotlin.Unit>
|
||||
BLOCK_BODY
|
||||
@@ -0,0 +1,31 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_STDLIB
|
||||
private fun test(x: Long) =
|
||||
countIssues {
|
||||
+(spentTime lessEq 2 * 60)
|
||||
+(spentTime lessEq id(2 * 60))
|
||||
+(spentTime.select(2 * 60, x))
|
||||
}
|
||||
|
||||
val spentTime = integer("spentTime")
|
||||
|
||||
fun integer(name: String) = Column()
|
||||
|
||||
fun <I> id(arg: I): I = arg
|
||||
|
||||
infix fun <T : Comparable<T>> Column.lessEq(t: T) = Expression()
|
||||
fun <T : Comparable<T>> Column.select(t: T, r: T) = Expression()
|
||||
|
||||
class Expression
|
||||
|
||||
class Column
|
||||
|
||||
class ArgumentsBuilder {
|
||||
val arguments = mutableListOf<Expression>()
|
||||
|
||||
operator fun Expression.unaryPlus() {
|
||||
arguments.add(this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun countIssues(restrictionsBuilder: ArgumentsBuilder.() -> Unit) {}
|
||||
@@ -0,0 +1,66 @@
|
||||
private fun test(x: Long) {
|
||||
return countIssues(restrictionsBuilder = local fun ArgumentsBuilder.<anonymous>() {
|
||||
($this$countIssues, <get-spentTime>().lessEq<Int>(t = 2.times(other = 60))).unaryPlus()
|
||||
($this$countIssues, <get-spentTime>().lessEq<Int>(t = id<Int>(arg = 2.times(other = 60)))).unaryPlus()
|
||||
($this$countIssues, <get-spentTime>().select<Long>(t = 2.times(other = 60).toLong(), r = x)).unaryPlus()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
val spentTime: Column
|
||||
field = integer(name = "spentTime")
|
||||
get
|
||||
|
||||
fun integer(name: String): Column {
|
||||
return Column()
|
||||
}
|
||||
|
||||
fun <I : Any?> id(arg: I): I {
|
||||
return arg
|
||||
}
|
||||
|
||||
infix fun <T : Comparable<T>> Column.lessEq(t: T): Expression {
|
||||
return Expression()
|
||||
}
|
||||
|
||||
fun <T : Comparable<T>> Column.select(t: T, r: T): Expression {
|
||||
return Expression()
|
||||
}
|
||||
|
||||
class Expression {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Column {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ArgumentsBuilder {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val arguments: MutableList<Expression>
|
||||
field = mutableListOf<Expression>()
|
||||
get
|
||||
|
||||
operator fun Expression.unaryPlus() {
|
||||
<this>.<get-arguments>().add(element = <this>) /*~> Unit */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun countIssues(restrictionsBuilder: @ExtensionFunctionType Function1<ArgumentsBuilder, Unit>) {
|
||||
}
|
||||
+6
@@ -2840,6 +2840,12 @@ public class ClassicJvmIrTextTestGenerated extends AbstractClassicJvmIrTextTest
|
||||
runTest("compiler/testData/ir/irText/firProblems/throwableStackTrace.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("timesInBuilder.kt")
|
||||
public void testTimesInBuilder() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/timesInBuilder.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypeParameterBounds.kt")
|
||||
public void testTypeParameterBounds() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user