Added test for obsolete bug and removed workaround in code.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
trait A
|
||||
trait B
|
||||
|
||||
fun <R: A> R.f() {
|
||||
}
|
||||
|
||||
fun <R: B> R.f() {
|
||||
}
|
||||
|
||||
class AImpl: A
|
||||
class BImpl: B
|
||||
|
||||
class C: A, B
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
AImpl().f()
|
||||
BImpl().f()
|
||||
C().<!CANNOT_COMPLETE_RESOLVE!>f<!>()
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package
|
||||
|
||||
internal fun main(/*0*/ args: kotlin.Array<kotlin.String>): kotlin.Unit
|
||||
internal fun </*0*/ R : A> R.f(): kotlin.Unit
|
||||
internal fun </*0*/ R : B> R.f(): kotlin.Unit
|
||||
|
||||
internal trait A {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal final class AImpl : A {
|
||||
public constructor AImpl()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal trait B {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal final class BImpl : B {
|
||||
public constructor BImpl()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal final class C : A, B {
|
||||
public constructor C()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -8437,6 +8437,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt2493.kt")
|
||||
public void testKt2493() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/overload/kt2493.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt7068.kt")
|
||||
public void testKt7068() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/overload/kt7068.kt");
|
||||
|
||||
@@ -37,7 +37,7 @@ fun <T> Connection.use(block : (Connection) -> T) : T {
|
||||
fun <T> Connection.statement(block: (Statement) -> T): T {
|
||||
val statement = createStatement()
|
||||
if (statement != null) {
|
||||
return statement.useSql(block)
|
||||
return statement.use(block)
|
||||
} else {
|
||||
throw IllegalStateException("No Statement returned from $this")
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import kotlin.template.StringTemplate
|
||||
/**
|
||||
* Processes a connection from the pool using the given function block
|
||||
*/
|
||||
fun <T> DataSource.useDataSource(block : (Connection) -> T): T { // TODO rename to "use" when KT-2493 is fixed
|
||||
fun <T> DataSource.use(block : (Connection) -> T): T {
|
||||
val connection = getConnection()
|
||||
if (connection != null) {
|
||||
try {
|
||||
@@ -24,33 +24,33 @@ fun <T> DataSource.useDataSource(block : (Connection) -> T): T { // TODO rename
|
||||
* Helper method to process a statement on this collection
|
||||
*/
|
||||
fun <T> DataSource.statement(block: (Statement) -> T): T {
|
||||
return useDataSource{ it.statement(block) }
|
||||
return use { it.statement(block) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform an SQL update on the connection
|
||||
*/
|
||||
fun DataSource.update(sql: String): Int {
|
||||
return useDataSource{ it.update(sql) }
|
||||
return use { it.update(sql) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a query on the connection and processes the result set with a function
|
||||
*/
|
||||
fun <T> DataSource.query(sql: String, block: (ResultSet) -> T): T {
|
||||
return useDataSource{ it.query(sql, block) }
|
||||
return use { it.query(sql, block) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the update using the given SQL using a [[StringTemplate]]
|
||||
*/
|
||||
fun DataSource.update(template : StringTemplate) : Int {
|
||||
return useDataSource{ it.update(template) }
|
||||
return use { it.update(template) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a query on the connection using the SQL from the [[StringTemplate]] and processes the result set with a function
|
||||
*/
|
||||
fun <T> DataSource.query(template : StringTemplate, resultBlock : (ResultSet) -> T) : T {
|
||||
return useDataSource{ it.query(template, resultBlock) }
|
||||
return use { it.query(template, resultBlock) }
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.sql.Statement
|
||||
/**
|
||||
* Uses the statement with the given block then closes the statement
|
||||
*/
|
||||
fun <T, S : Statement> S.useSql(block : (S) -> T) : T { // TODO rename to "use" when KT-2493 is fixed
|
||||
fun <T, S : Statement> S.use(block : (S) -> T) : T {
|
||||
try {
|
||||
return block(this)
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user