From b9131234edd66b22d74712b71bbb2b130c82883a Mon Sep 17 00:00:00 2001 From: Bloder Date: Tue, 31 May 2022 00:12:43 -0300 Subject: [PATCH] Create polymorphic type parameters tests use case for context receivers --- ...with_polymorphic_type_parameter.fir.ir.txt | 179 ++++++++++++++++++ ...rs_with_polymorphic_type_parameter.fir.txt | 46 +++++ ...ceivers_with_polymorphic_type_parameter.kt | 34 ++++ ...rs_with_polymorphic_type_parameter.fir.txt | 30 +++ ...ceivers_with_polymorphic_type_parameter.kt | 23 +++ .../plugin/runners/BoxTestGenerated.java | 6 + .../runners/DiagnosticTestGenerated.java | 6 + 7 files changed, 324 insertions(+) create mode 100644 arrow-inject-compiler-plugin/src/testData/box/context-receivers/context_receivers_with_polymorphic_type_parameter.fir.ir.txt create mode 100644 arrow-inject-compiler-plugin/src/testData/box/context-receivers/context_receivers_with_polymorphic_type_parameter.fir.txt create mode 100644 arrow-inject-compiler-plugin/src/testData/box/context-receivers/context_receivers_with_polymorphic_type_parameter.kt create mode 100644 arrow-inject-compiler-plugin/src/testData/diagnostics/context-receivers/context_receivers_with_polymorphic_type_parameter.fir.txt create mode 100644 arrow-inject-compiler-plugin/src/testData/diagnostics/context-receivers/context_receivers_with_polymorphic_type_parameter.kt diff --git a/arrow-inject-compiler-plugin/src/testData/box/context-receivers/context_receivers_with_polymorphic_type_parameter.fir.ir.txt b/arrow-inject-compiler-plugin/src/testData/box/context-receivers/context_receivers_with_polymorphic_type_parameter.fir.ir.txt new file mode 100644 index 0000000..e545a9b --- /dev/null +++ b/arrow-inject-compiler-plugin/src/testData/box/context-receivers/context_receivers_with_polymorphic_type_parameter.fir.ir.txt @@ -0,0 +1,179 @@ +FILE fqName:foo.bar fileName:/context_receivers_with_polymorphic_type_parameter.kt + CLASS INTERFACE name:Repository modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:foo.bar.Repository + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false + 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: 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: 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: type:kotlin.Any + CLASS CLASS name:IntRepo modality:FINAL visibility:public superTypes:[foo.bar.Repository] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:foo.bar.IntRepo + CONSTRUCTOR visibility:public <> () returnType:foo.bar.IntRepo [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:IntRepo modality:FINAL visibility:public superTypes:[foo.bar.Repository]' + 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 [fake_override,operator] declared in foo.bar.Repository + $this: VALUE_PARAMETER name: 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 [fake_override] declared in foo.bar.Repository + $this: VALUE_PARAMETER name: 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 [fake_override] declared in foo.bar.Repository + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:repo visibility:public modality:FINAL <> () returnType:foo.bar.Repository + annotations: + Provider + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun repo (): foo.bar.Repository declared in foo.bar' + CONSTRUCTOR_CALL 'public constructor () [primary] declared in foo.bar.IntRepo' type=foo.bar.IntRepo origin=null + CLASS CLASS name:UseCase modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:foo.bar.UseCase + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false + FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:foo.bar.Repository visibility:private [final] + CONSTRUCTOR visibility:public <> (_context_receiver_0:foo.bar.Repository, x:kotlin.Int) returnType:foo.bar.UseCase [primary] + VALUE_PARAMETER name:_context_receiver_0 index:0 type:foo.bar.Repository + VALUE_PARAMETER name:x index:1 type:kotlin.Int + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + SET_FIELD 'FIELD FIELD_FOR_CLASS_CONTEXT_RECEIVER name:contextReceiverField0 type:foo.bar.Repository visibility:private [final]' type=kotlin.Unit origin=null + receiver: GET_VAR ': foo.bar.UseCase declared in foo.bar.UseCase' type=foo.bar.UseCase origin=null + value: GET_VAR '_context_receiver_0: foo.bar.Repository declared in foo.bar.UseCase.' type=foo.bar.Repository origin=null + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:UseCase modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:x visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final] + EXPRESSION_BODY + GET_VAR 'x: kotlin.Int declared in foo.bar.UseCase.' type=kotlin.Int origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:foo.bar.UseCase) returnType:kotlin.Int + correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:foo.bar.UseCase + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in foo.bar.UseCase' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': foo.bar.UseCase declared in foo.bar.UseCase.' type=foo.bar.UseCase 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: 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: 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: type:kotlin.Any + FUN name:f visibility:public modality:FINAL <> () returnType:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun f (): kotlin.Int declared in foo.bar' + CALL 'public final fun contextual (ev: T of arrow.inject.annotations.RunKt.contextual, f: @[ExtensionFunctionType] kotlin.Function1): R of arrow.inject.annotations.RunKt.contextual [inline] declared in arrow.inject.annotations.RunKt' type=kotlin.Int origin=null + : foo.bar.Repository + : kotlin.Int + ev: CALL 'public final fun repo (): foo.bar.Repository declared in foo.bar' type=foo.bar.Repository origin=null + f: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1, kotlin.Int> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:foo.bar.Repository) returnType:kotlin.Int + $receiver: VALUE_PARAMETER name:$this$contextual type:foo.bar.Repository + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun f (): kotlin.Int declared in foo.bar' + CALL 'public final fun (): kotlin.Int declared in foo.bar.UseCase' type=kotlin.Int origin=GET_PROPERTY + $this: CONSTRUCTOR_CALL 'public constructor (_context_receiver_0: foo.bar.Repository, x: kotlin.Int) [primary] declared in foo.bar.UseCase' type=foo.bar.UseCase origin=null + : kotlin.Int + _context_receiver_0: GET_VAR '$this$contextual: foo.bar.Repository declared in foo.bar.f.' type=foo.bar.Repository origin=null + x: CONST Int type=kotlin.Int value=0 + FUN name:f3 visibility:public modality:FINAL <> () returnType:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun f3 (): kotlin.Int declared in foo.bar' + CALL 'public final fun contextual (ev: T of arrow.inject.annotations.RunKt.contextual, f: @[ExtensionFunctionType] kotlin.Function1): R of arrow.inject.annotations.RunKt.contextual [inline] declared in arrow.inject.annotations.RunKt' type=kotlin.Int origin=null + : foo.bar.Repository + : kotlin.Int + ev: CALL 'public final fun repo (): foo.bar.Repository declared in foo.bar' type=foo.bar.Repository origin=null + f: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1, kotlin.Int> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:foo.bar.Repository) returnType:kotlin.Int + $receiver: VALUE_PARAMETER name:$this$contextual type:foo.bar.Repository + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun f3 (): kotlin.Int declared in foo.bar' + CALL 'public final fun (): kotlin.Int declared in foo.bar.UseCase' type=kotlin.Int origin=GET_PROPERTY + $this: CONSTRUCTOR_CALL 'public constructor (_context_receiver_0: foo.bar.Repository, x: kotlin.Int) [primary] declared in foo.bar.UseCase' type=foo.bar.UseCase origin=null + : kotlin.Int + _context_receiver_0: GET_VAR '$this$contextual: foo.bar.Repository declared in foo.bar.f3.' type=foo.bar.Repository origin=null + x: CONST Int type=kotlin.Int value=0 + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + VAR name:result type:kotlin.Int [val] + CALL 'public final fun f (): kotlin.Int declared in foo.bar' type=kotlin.Int origin=null + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in foo.bar' + WHEN type=kotlin.String 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 'val result: kotlin.Int [val] declared in foo.bar.box' type=kotlin.Int origin=null + arg1: CONST Int type=kotlin.Int value=0 + then: CONST String type=kotlin.String value="OK" + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Fail: " + GET_VAR 'val result: kotlin.Int [val] declared in foo.bar.box' type=kotlin.Int origin=null +FILE fqName:foo.bar.annotations fileName:/Annotations.kt + CLASS ANNOTATION_CLASS name:Given modality:OPEN visibility:public superTypes:[kotlin.Annotation] + annotations: + Context + Retention(value = GET_ENUM 'ENUM_ENTRY IR_EXTERNAL_DECLARATION_STUB name:RUNTIME' type=kotlin.annotation.AnnotationRetention) + Target(allowedTargets = [GET_ENUM 'ENUM_ENTRY IR_EXTERNAL_DECLARATION_STUB name:CLASS' type=kotlin.annotation.AnnotationTarget, GET_ENUM 'ENUM_ENTRY IR_EXTERNAL_DECLARATION_STUB name:FUNCTION' type=kotlin.annotation.AnnotationTarget, GET_ENUM 'ENUM_ENTRY IR_EXTERNAL_DECLARATION_STUB name:PROPERTY' type=kotlin.annotation.AnnotationTarget, GET_ENUM 'ENUM_ENTRY IR_EXTERNAL_DECLARATION_STUB name:VALUE_PARAMETER' type=kotlin.annotation.AnnotationTarget]) + MustBeDocumented + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:foo.bar.annotations.Given + CONSTRUCTOR visibility:public <> () returnType:foo.bar.annotations.Given [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Given modality:OPEN visibility:public superTypes:[kotlin.Annotation]' + 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 [fake_override,operator] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: 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 [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: 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 [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS ANNOTATION_CLASS name:Config modality:OPEN visibility:public superTypes:[kotlin.Annotation] + annotations: + Context + Retention(value = GET_ENUM 'ENUM_ENTRY IR_EXTERNAL_DECLARATION_STUB name:RUNTIME' type=kotlin.annotation.AnnotationRetention) + Target(allowedTargets = [GET_ENUM 'ENUM_ENTRY IR_EXTERNAL_DECLARATION_STUB name:CLASS' type=kotlin.annotation.AnnotationTarget, GET_ENUM 'ENUM_ENTRY IR_EXTERNAL_DECLARATION_STUB name:FUNCTION' type=kotlin.annotation.AnnotationTarget, GET_ENUM 'ENUM_ENTRY IR_EXTERNAL_DECLARATION_STUB name:PROPERTY' type=kotlin.annotation.AnnotationTarget, GET_ENUM 'ENUM_ENTRY IR_EXTERNAL_DECLARATION_STUB name:VALUE_PARAMETER' type=kotlin.annotation.AnnotationTarget]) + MustBeDocumented + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:foo.bar.annotations.Config + CONSTRUCTOR visibility:public <> () returnType:foo.bar.annotations.Config [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Config modality:OPEN visibility:public superTypes:[kotlin.Annotation]' + 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 [fake_override,operator] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: 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 [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: 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 [fake_override] declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any +FILE fqName:foo.bar.identity fileName:/Identity.kt diff --git a/arrow-inject-compiler-plugin/src/testData/box/context-receivers/context_receivers_with_polymorphic_type_parameter.fir.txt b/arrow-inject-compiler-plugin/src/testData/box/context-receivers/context_receivers_with_polymorphic_type_parameter.fir.txt new file mode 100644 index 0000000..49db449 --- /dev/null +++ b/arrow-inject-compiler-plugin/src/testData/box/context-receivers/context_receivers_with_polymorphic_type_parameter.fir.txt @@ -0,0 +1,46 @@ +FILE: context_receivers_with_polymorphic_type_parameter.kt + package foo.bar + + public abstract interface Repository : R|kotlin/Any| { + } + public final class IntRepo : R|foo/bar/Repository| { + public constructor(): R|foo/bar/IntRepo| { + super() + } + + } + @R|arrow/inject/annotations/Provider|() public final fun repo(): R|foo/bar/Repository| { + ^repo R|foo/bar/IntRepo.IntRepo|() + } + context(R|foo/bar/Repository|) + public final class UseCase : R|kotlin/Any| { + public constructor(x: R|kotlin/Int|): R|foo/bar/UseCase| { + super() + } + + public final val x: R|kotlin/Int| = R|/x| + public get(): R|kotlin/Int| + + } + public final fun f(): R|kotlin/Int| { + R|arrow/inject/annotations/context||>() + ^f R|foo/bar/UseCase.UseCase|(x = Int(0)).R|SubstitutionOverride| + } + public final fun f3(): R|kotlin/Int| { + ^f3 R|arrow/inject/annotations/contextual||, R|kotlin/Int|>(R|foo/bar/repo|(), = contextual@fun R|foo/bar/Repository|.(): R|kotlin/Int| { + ^f3 R|foo/bar/UseCase.UseCase|(x = Int(0)).R|SubstitutionOverride| + } + ) + } + public final fun box(): R|kotlin/String| { + lval result: R|kotlin/Int| = R|foo/bar/f|() + ^box when () { + ==(R|/result|, Int(0)) -> { + String(OK) + } + else -> { + (String(Fail: ), R|/result|) + } + } + + } diff --git a/arrow-inject-compiler-plugin/src/testData/box/context-receivers/context_receivers_with_polymorphic_type_parameter.kt b/arrow-inject-compiler-plugin/src/testData/box/context-receivers/context_receivers_with_polymorphic_type_parameter.kt new file mode 100644 index 0000000..dc6437c --- /dev/null +++ b/arrow-inject-compiler-plugin/src/testData/box/context-receivers/context_receivers_with_polymorphic_type_parameter.kt @@ -0,0 +1,34 @@ +package foo.bar + +import arrow.inject.annotations.context +import arrow.inject.annotations.Provider +import arrow.inject.annotations.contextual + +interface Repository + +class IntRepo : Repository + +@Provider fun repo(): Repository = IntRepo() + +context(Repository) +class UseCase(val x: Int) + +fun f(): Int { + context>() + return UseCase(x = 0).x +} + +fun f3(): Int { + return contextual, Int>(repo()) { + return UseCase(x = 0).x + } +} + +fun box(): String { + val result = f() + return if (result == 0) { + "OK" + } else { + "Fail: $result" + } +} diff --git a/arrow-inject-compiler-plugin/src/testData/diagnostics/context-receivers/context_receivers_with_polymorphic_type_parameter.fir.txt b/arrow-inject-compiler-plugin/src/testData/diagnostics/context-receivers/context_receivers_with_polymorphic_type_parameter.fir.txt new file mode 100644 index 0000000..4db29c3 --- /dev/null +++ b/arrow-inject-compiler-plugin/src/testData/diagnostics/context-receivers/context_receivers_with_polymorphic_type_parameter.fir.txt @@ -0,0 +1,30 @@ +FILE: context_receivers_with_polymorphic_type_parameter.kt + package foo.bar + + public abstract fun interface Repository : R|kotlin/Any| { + public abstract fun fetch(): R|T| + + } + @R|arrow/inject/annotations/Provider|() public final fun intRepo(): R|foo/bar/Repository| { + ^intRepo R|foo/bar/Repository|( = Repository@fun (): R|kotlin/Int| { + ^ Int(1) + } + ) + } + context(R|foo/bar/Repository|) + public final class UseCase : R|kotlin/Any| { + public constructor(): R|foo/bar/UseCase| { + super() + } + + } + public final fun foo(): R|kotlin/Int| { + R|arrow/inject/annotations/context||>() + ^foo R|kotlin/with||, R|kotlin/Int|>(R|foo/bar/UseCase.UseCase|(), = with@fun R|foo/bar/UseCase|.(): R|kotlin/Int| { + ^ this@R|foo/bar/foo|.R|SubstitutionOverride|() + } + ) + } + public final fun main(): R|kotlin/Unit| { + R|foo/bar/foo|() + } diff --git a/arrow-inject-compiler-plugin/src/testData/diagnostics/context-receivers/context_receivers_with_polymorphic_type_parameter.kt b/arrow-inject-compiler-plugin/src/testData/diagnostics/context-receivers/context_receivers_with_polymorphic_type_parameter.kt new file mode 100644 index 0000000..d2b56c8 --- /dev/null +++ b/arrow-inject-compiler-plugin/src/testData/diagnostics/context-receivers/context_receivers_with_polymorphic_type_parameter.kt @@ -0,0 +1,23 @@ +package foo.bar + +import arrow.inject.annotations.Provider +import arrow.inject.annotations.context + +fun interface Repository { + + fun fetch(): T +} + +@Provider fun intRepo(): Repository = Repository { 1 } + +context(Repository) +class UseCase + +fun foo(): Int { + context>() + return with(UseCase()) { fetch() } +} + +fun main() { + foo() +} diff --git a/arrow-inject-compiler-plugin/src/testGenerated/arrow/inject/compiler/plugin/runners/BoxTestGenerated.java b/arrow-inject-compiler-plugin/src/testGenerated/arrow/inject/compiler/plugin/runners/BoxTestGenerated.java index 63c0f3d..68f0d91 100644 --- a/arrow-inject-compiler-plugin/src/testGenerated/arrow/inject/compiler/plugin/runners/BoxTestGenerated.java +++ b/arrow-inject-compiler-plugin/src/testGenerated/arrow/inject/compiler/plugin/runners/BoxTestGenerated.java @@ -171,5 +171,11 @@ public void testAllFilesPresentInContext_receivers() throws Exception { public void testContext_receivers() throws Exception { runTest("src/testData/box/context-receivers/context_receivers.kt"); } + + @Test + @TestMetadata("context_receivers_with_polymorphic_type_parameter.kt") + public void testContext_receivers_with_polymorphic_type_parameter() throws Exception { + runTest("src/testData/box/context-receivers/context_receivers_with_polymorphic_type_parameter.kt"); + } } } diff --git a/arrow-inject-compiler-plugin/src/testGenerated/arrow/inject/compiler/plugin/runners/DiagnosticTestGenerated.java b/arrow-inject-compiler-plugin/src/testGenerated/arrow/inject/compiler/plugin/runners/DiagnosticTestGenerated.java index ab1847b..169eb51 100644 --- a/arrow-inject-compiler-plugin/src/testGenerated/arrow/inject/compiler/plugin/runners/DiagnosticTestGenerated.java +++ b/arrow-inject-compiler-plugin/src/testGenerated/arrow/inject/compiler/plugin/runners/DiagnosticTestGenerated.java @@ -135,6 +135,12 @@ public void testContext_receivers() throws Exception { runTest("src/testData/diagnostics/context-receivers/context_receivers.kt"); } + @Test + @TestMetadata("context_receivers_with_polymorphic_type_parameter.kt") + public void testContext_receivers_with_polymorphic_type_parameter() throws Exception { + runTest("src/testData/diagnostics/context-receivers/context_receivers_with_polymorphic_type_parameter.kt"); + } + @Test @TestMetadata("inductive.kt") public void testInductive() throws Exception {