diff --git a/compiler/testData/codegen/regressions/kt606.kt b/compiler/testData/codegen/regressions/kt606.kt index f2e00fb0fb2..83dc0b6f83d 100644 --- a/compiler/testData/codegen/regressions/kt606.kt +++ b/compiler/testData/codegen/regressions/kt606.kt @@ -1,3 +1,7 @@ +package kt606 + +//KT-606 wrong resolved call + class StandardPipelineFactory(val config : ChannelPipeline.() -> Unit) : ChannelPipelineFactory { override fun getPipeline() : ChannelPipeline { val pipeline : ChannelPipeline = DefaultChannelPipeline() @@ -19,7 +23,43 @@ trait ChannelPipelineFactory { fun getPipeline() : ChannelPipeline } -fun box() : String { +fun testKt606() { StandardPipelineFactory({ print("OK") }).getPipeline() +} + +//Tests for duplicates +//KT-1061 Can't call function defined as a val +object X { + val doit = { (i: Int) -> i } +} + +fun testKt1061() : String = if (X.doit(3) == 3) "OK" else "fail" + + +//KT-1249 IllegalStateException invoking function property +class TestClass(val body : () -> Unit) : Any { + fun run() { + body() + } +} + +fun testKt1249() { + TestClass({}).run() +} + +class Foo(val filter: (T) -> Boolean) { + public fun bar(tee: T) : Boolean { + return filter(tee); + } +} + +//KT-1290 Method property in constructor causes NPE +fun testKt1290() = Foo({ (i: Int) -> i < 5 }).bar(2) + +fun box() : String { + testKt606() + testKt1061() + testKt1249() + if (!testKt1290()) return "fail" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/regressions/kt1489_1728.jet b/compiler/testData/diagnostics/tests/regressions/kt1489_1728.jet new file mode 100644 index 00000000000..cc3e7c771d2 --- /dev/null +++ b/compiler/testData/diagnostics/tests/regressions/kt1489_1728.jet @@ -0,0 +1,30 @@ +package kt606_dependents + +//KT-1489 Code analyzer fails with assertion +trait AutoCloseable{ + fun close() +} + +class C { + class Resource : AutoCloseable { + override fun close() { + throw UnsupportedOperationException() + } + } + + fun foo(x : X, body : (X) -> Unit) { + } + + fun p() : Resource? = null + + fun bar() { + foo(p()) { + + } + } +} + +//KT-1728 Can't invoke extension property as a function + +val Int.ext : () -> Int = { 5 } +val x = 1.ext() \ No newline at end of file