Skip to content

Commit

Permalink
fixing compiler-plugin tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolanrensen committed Mar 25, 2024
1 parent 6b63c96 commit 4e5438b
Show file tree
Hide file tree
Showing 9 changed files with 313 additions and 43 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ fun main() {
testDataRoot = "${Artifacts.projectRoot}/${Artifacts.compilerPluginArtifactId}/src/test/resources/testData",
testsRoot = "${Artifacts.projectRoot}/${Artifacts.compilerPluginArtifactId}/src/test-gen/kotlin",
) {
testClass<AbstractDiagnosticTest> {
model("diagnostics")
}
// testClass<AbstractDiagnosticTest> {
// model("diagnostics")
// }

testClass<AbstractBoxTest> {
model("box")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,52 @@ FILE fqName:foo.bar fileName:/dataClassInFunctionTest.kt
overridden:
public open fun toString (): kotlin.String declared in kotlin.Annotation
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS INTERFACE name:Equals modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:foo.bar.Equals
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 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:canEqual visibility:public modality:ABSTRACT <> ($this:foo.bar.Equals, that:kotlin.Any?) returnType:kotlin.Boolean
$this: VALUE_PARAMETER name:<this> type:foo.bar.Equals
VALUE_PARAMETER name:that index:0 type:kotlin.Any?
CLASS INTERFACE name:Product modality:ABSTRACT visibility:public superTypes:[foo.bar.Equals]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:foo.bar.Product
FUN FAKE_OVERRIDE name:canEqual visibility:public modality:ABSTRACT <> ($this:foo.bar.Equals, that:kotlin.Any?) returnType:kotlin.Boolean [fake_override]
overridden:
public abstract fun canEqual (that: kotlin.Any?): kotlin.Boolean declared in foo.bar.Equals
$this: VALUE_PARAMETER name:<this> type:foo.bar.Equals
VALUE_PARAMETER name:that index:0 type: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 declared in foo.bar.Equals
$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 foo.bar.Equals
$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 foo.bar.Equals
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:productArity visibility:public modality:ABSTRACT <> ($this:foo.bar.Product) returnType:kotlin.Int
$this: VALUE_PARAMETER name:<this> type:foo.bar.Product
FUN name:productElement visibility:public modality:ABSTRACT <> ($this:foo.bar.Product, n:kotlin.Int) returnType:kotlin.Any
$this: VALUE_PARAMETER name:<this> type:foo.bar.Product
VALUE_PARAMETER name:n index:0 type:kotlin.Int
FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String
BLOCK_BODY
CLASS CLASS name:User modality:FINAL visibility:local [data] superTypes:[kotlin.Any]
CLASS CLASS name:User modality:FINAL visibility:local [data] superTypes:[kotlin.Any; foo.bar.Product]
annotations:
Sparkify
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:foo.bar.box.User
Expand Down Expand Up @@ -125,7 +168,7 @@ FILE fqName:foo.bar fileName:/dataClassInFunctionTest.kt
CONST Double type=kotlin.Double value=2.0
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:User modality:FINAL visibility:local [data] superTypes:[kotlin.Any]'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:User modality:FINAL visibility:local [data] superTypes:[kotlin.Any; foo.bar.Product]'
FUN GENERATED_DATA_CLASS_MEMBER name:component1 visibility:public modality:FINAL <> ($this:foo.bar.box.User) returnType:kotlin.String [operator]
$this: VALUE_PARAMETER name:<this> type:foo.bar.box.User
BLOCK_BODY
Expand Down Expand Up @@ -300,38 +343,90 @@ FILE fqName:foo.bar fileName:/dataClassInFunctionTest.kt
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test2 type:kotlin.Double visibility:private [final]' type=kotlin.Double origin=null
receiver: GET_VAR '<this>: foo.bar.box.User declared in foo.bar.box.User.toString' type=foo.bar.box.User origin=null
CONST String type=kotlin.String value=")"
FUN name:canEqual visibility:public modality:OPEN <> ($this:foo.bar.box.User, that:kotlin.Any?) returnType:kotlin.Boolean
overridden:
public abstract fun canEqual (that: kotlin.Any?): kotlin.Boolean declared in foo.bar.Equals
$this: VALUE_PARAMETER name:$this type:foo.bar.box.User
VALUE_PARAMETER name:that index:0 type:kotlin.Any?
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun canEqual (that: kotlin.Any?): kotlin.Boolean declared in foo.bar.box.User'
TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=foo.bar.box.User
GET_VAR 'that: kotlin.Any? declared in foo.bar.box.User.canEqual' type=kotlin.Any? origin=null
FUN name:productArity visibility:public modality:OPEN <> ($this:foo.bar.box.User) returnType:kotlin.Int
overridden:
public abstract fun productArity (): kotlin.Int declared in foo.bar.Product
$this: VALUE_PARAMETER name:$this type:foo.bar.box.User
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun productArity (): kotlin.Int declared in foo.bar.box.User'
CONST Int type=kotlin.Int value=4
FUN name:productElement visibility:public modality:OPEN <> ($this:foo.bar.box.User, n:kotlin.Int) returnType:kotlin.Any?
overridden:
public abstract fun productElement (n: kotlin.Int): kotlin.Any declared in foo.bar.Product
$this: VALUE_PARAMETER name:$this type:foo.bar.box.User
VALUE_PARAMETER name:n index:0 type:kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun productElement (n: kotlin.Int): kotlin.Any? declared in foo.bar.box.User'
WHEN type=kotlin.Any? origin=IF
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'n: kotlin.Int declared in foo.bar.box.User.productElement' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=0
then: CALL 'public final fun <get-name> (): kotlin.String declared in foo.bar.box.User' type=kotlin.String origin=GET_PROPERTY
$this: GET_VAR '$this: foo.bar.box.User declared in foo.bar.box.User.productElement' type=foo.bar.box.User origin=null
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'n: kotlin.Int declared in foo.bar.box.User.productElement' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=1
then: CALL 'public final fun <get-age> (): kotlin.Int declared in foo.bar.box.User' type=kotlin.Int origin=GET_PROPERTY
$this: GET_VAR '$this: foo.bar.box.User declared in foo.bar.box.User.productElement' type=foo.bar.box.User origin=null
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'n: kotlin.Int declared in foo.bar.box.User.productElement' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=2
then: CALL 'public final fun <get-test> (): kotlin.Double declared in foo.bar.box.User' type=kotlin.Double origin=GET_PROPERTY
$this: GET_VAR '$this: foo.bar.box.User declared in foo.bar.box.User.productElement' type=foo.bar.box.User origin=null
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'n: kotlin.Int declared in foo.bar.box.User.productElement' type=kotlin.Int origin=null
arg1: CONST Int type=kotlin.Int value=3
then: CALL 'public final fun <get-test2> (): kotlin.Double declared in foo.bar.box.User' type=kotlin.Double origin=GET_PROPERTY
$this: GET_VAR '$this: foo.bar.box.User declared in foo.bar.box.User.productElement' type=foo.bar.box.User origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: THROW type=kotlin.Nothing
CONSTRUCTOR_CALL 'public constructor <init> () declared in java.lang.IndexOutOfBoundsException' type=java.lang.IndexOutOfBoundsException origin=null
VAR name:user type:foo.bar.box.User [val]
CONSTRUCTOR_CALL 'public constructor <init> (name: kotlin.String, age: kotlin.Int, test: kotlin.Double, test2: kotlin.Double) declared in foo.bar.box.User' type=foo.bar.box.User origin=null
VAR name:name type:@[FlexibleNullability] kotlin.Any? [val]
CALL 'public open fun invoke (p0: @[FlexibleNullability] kotlin.Any?, vararg p1: @[FlexibleNullability] kotlin.Any?): @[FlexibleNullability] kotlin.Any? declared in java.lang.reflect.Method' type=@[FlexibleNullability] kotlin.Any? origin=null
$this: CALL 'public open fun getMethod (p0: @[FlexibleNullability] kotlin.String?, vararg p1: @[FlexibleNullability] java.lang.Class<*>?): @[FlexibleNullability] java.lang.reflect.Method? declared in java.lang.Class' type=@[FlexibleNullability] java.lang.reflect.Method? origin=null
$this: CALL 'public final fun <get-java> <T> (): java.lang.Class<T of kotlin.jvm.<get-java>> declared in kotlin.jvm' type=java.lang.Class<foo.bar.box.User> origin=GET_PROPERTY
<T>: foo.bar.box.User
$receiver: CLASS_REFERENCE 'CLASS CLASS name:User modality:FINAL visibility:local [data] superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<foo.bar.box.User>
$receiver: CLASS_REFERENCE 'CLASS CLASS name:User modality:FINAL visibility:local [data] superTypes:[kotlin.Any; foo.bar.Product]' type=kotlin.reflect.KClass<foo.bar.box.User>
p0: CONST String type=kotlin.String value="name"
p0: GET_VAR 'val user: foo.bar.box.User declared in foo.bar.box' type=foo.bar.box.User origin=null
VAR name:age type:@[FlexibleNullability] kotlin.Any? [val]
CALL 'public open fun invoke (p0: @[FlexibleNullability] kotlin.Any?, vararg p1: @[FlexibleNullability] kotlin.Any?): @[FlexibleNullability] kotlin.Any? declared in java.lang.reflect.Method' type=@[FlexibleNullability] kotlin.Any? origin=null
$this: CALL 'public open fun getMethod (p0: @[FlexibleNullability] kotlin.String?, vararg p1: @[FlexibleNullability] java.lang.Class<*>?): @[FlexibleNullability] java.lang.reflect.Method? declared in java.lang.Class' type=@[FlexibleNullability] java.lang.reflect.Method? origin=null
$this: CALL 'public final fun <get-java> <T> (): java.lang.Class<T of kotlin.jvm.<get-java>> declared in kotlin.jvm' type=java.lang.Class<foo.bar.box.User> origin=GET_PROPERTY
<T>: foo.bar.box.User
$receiver: CLASS_REFERENCE 'CLASS CLASS name:User modality:FINAL visibility:local [data] superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<foo.bar.box.User>
$receiver: CLASS_REFERENCE 'CLASS CLASS name:User modality:FINAL visibility:local [data] superTypes:[kotlin.Any; foo.bar.Product]' type=kotlin.reflect.KClass<foo.bar.box.User>
p0: CONST String type=kotlin.String value="age"
p0: GET_VAR 'val user: foo.bar.box.User declared in foo.bar.box' type=foo.bar.box.User origin=null
VAR name:a type:@[FlexibleNullability] kotlin.Any? [val]
CALL 'public open fun invoke (p0: @[FlexibleNullability] kotlin.Any?, vararg p1: @[FlexibleNullability] kotlin.Any?): @[FlexibleNullability] kotlin.Any? declared in java.lang.reflect.Method' type=@[FlexibleNullability] kotlin.Any? origin=null
$this: CALL 'public open fun getMethod (p0: @[FlexibleNullability] kotlin.String?, vararg p1: @[FlexibleNullability] java.lang.Class<*>?): @[FlexibleNullability] java.lang.reflect.Method? declared in java.lang.Class' type=@[FlexibleNullability] java.lang.reflect.Method? origin=null
$this: CALL 'public final fun <get-java> <T> (): java.lang.Class<T of kotlin.jvm.<get-java>> declared in kotlin.jvm' type=java.lang.Class<foo.bar.box.User> origin=GET_PROPERTY
<T>: foo.bar.box.User
$receiver: CLASS_REFERENCE 'CLASS CLASS name:User modality:FINAL visibility:local [data] superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<foo.bar.box.User>
$receiver: CLASS_REFERENCE 'CLASS CLASS name:User modality:FINAL visibility:local [data] superTypes:[kotlin.Any; foo.bar.Product]' type=kotlin.reflect.KClass<foo.bar.box.User>
p0: CONST String type=kotlin.String value="a"
p0: GET_VAR 'val user: foo.bar.box.User declared in foo.bar.box' type=foo.bar.box.User origin=null
VAR name:b type:@[FlexibleNullability] kotlin.Any? [val]
CALL 'public open fun invoke (p0: @[FlexibleNullability] kotlin.Any?, vararg p1: @[FlexibleNullability] kotlin.Any?): @[FlexibleNullability] kotlin.Any? declared in java.lang.reflect.Method' type=@[FlexibleNullability] kotlin.Any? origin=null
$this: CALL 'public open fun getMethod (p0: @[FlexibleNullability] kotlin.String?, vararg p1: @[FlexibleNullability] java.lang.Class<*>?): @[FlexibleNullability] java.lang.reflect.Method? declared in java.lang.Class' type=@[FlexibleNullability] java.lang.reflect.Method? origin=null
$this: CALL 'public final fun <get-java> <T> (): java.lang.Class<T of kotlin.jvm.<get-java>> declared in kotlin.jvm' type=java.lang.Class<foo.bar.box.User> origin=GET_PROPERTY
<T>: foo.bar.box.User
$receiver: CLASS_REFERENCE 'CLASS CLASS name:User modality:FINAL visibility:local [data] superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<foo.bar.box.User>
$receiver: CLASS_REFERENCE 'CLASS CLASS name:User modality:FINAL visibility:local [data] superTypes:[kotlin.Any; foo.bar.Product]' type=kotlin.reflect.KClass<foo.bar.box.User>
p0: CONST String type=kotlin.String value="b"
p0: GET_VAR 'val user: foo.bar.box.User declared in foo.bar.box' type=foo.bar.box.User origin=null
WHEN type=kotlin.Unit origin=IF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ FILE: dataClassInFunctionTest.kt
public final val name: R|kotlin/String| = R|<local>/name|
public get(): R|kotlin/String|

}
public abstract interface Equals : R|kotlin/Any| {
public abstract fun canEqual(that: R|kotlin/Any?|): R|kotlin/Boolean|

}
public abstract interface Product : R|foo/bar/Equals| {
public abstract fun productElement(n: R|kotlin/Int|): R|kotlin/Any|

public abstract fun productArity(): R|kotlin/Int|

}
public final fun box(): R|kotlin/String| {
@R|foo/bar/Sparkify|() local final data class User : R|kotlin/Any| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ package foo.bar
annotation class Sparkify
annotation class ColumnName(val name: String)

// Fake Equals
interface Equals {
fun canEqual(that: Any?): Boolean
}

// Fake Product
interface Product: Equals {
fun productElement(n: Int): Any
fun productArity(): Int
}

fun box(): String {

@Sparkify
Expand Down
Loading

0 comments on commit 4e5438b

Please sign in to comment.