Merge remote branch 'origin/master'
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
import java.util.Collections
|
||||
import java.util.List
|
||||
|
||||
val ab = Collections.emptyList<Int>() : List<Int>?
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
namespace abstract
|
||||
|
||||
class MyClass() {
|
||||
@@ -238,4 +240,4 @@ abstract class B3(i: Int) {
|
||||
fun foo(a: B3) {
|
||||
val <!UNUSED_VARIABLE!>a<!> = <!CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS!>B3()<!>
|
||||
val <!UNUSED_VARIABLE!>b<!> = <!CREATING_AN_INSTANCE_OF_ABSTRACT_CLASS!>B1(2, "s")<!>
|
||||
}
|
||||
}
|
||||
@@ -88,4 +88,4 @@ open class C {
|
||||
t = <!UNUSED_VALUE!>this@C<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.*
|
||||
|
||||
namespace html {
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
namespace Jet86
|
||||
|
||||
class A {
|
||||
@@ -27,4 +29,4 @@ val s = <!NO_CLASS_OBJECT!>System<!> // error
|
||||
fun test() {
|
||||
System.out?.println()
|
||||
java.lang.System.out?.println()
|
||||
}
|
||||
}
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
trait A {
|
||||
fun foo() : Int = 1
|
||||
fun foo2() : Int = 1
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
fun Int?.optint() : Unit {}
|
||||
val Int?.optval : Unit = ()
|
||||
|
||||
@@ -68,4 +70,4 @@ namespace null_safety {
|
||||
if (command == null) 1
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.*;
|
||||
|
||||
class NotRange1() {
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
fun none() {}
|
||||
|
||||
fun unitEmptyInfer() {}
|
||||
@@ -209,4 +211,4 @@ fun testFunctionLiterals() {
|
||||
object A {}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
namespace foo
|
||||
|
||||
class X {}
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
namespace foobar
|
||||
|
||||
namespace a {
|
||||
@@ -60,4 +62,4 @@ abstract class Collection<E> : Iterable<E> {
|
||||
}
|
||||
return iteratee.done()
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
fun test() {
|
||||
val a : Int? = 0
|
||||
if (a != null) {
|
||||
@@ -277,4 +279,4 @@ fun f9(a : Int?) : Int {
|
||||
if (a != null)
|
||||
return a
|
||||
return 1
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
// Fixpoint generic in Java: Enum<T extends Enum<T>>
|
||||
fun test(a : annotation.RetentionPolicy) {
|
||||
|
||||
@@ -17,4 +19,4 @@ fun test(a : java.util.ArrayList<Int>) {
|
||||
|
||||
fun test(a : java.lang.Class<Int>) {
|
||||
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
import java.*
|
||||
import util.*
|
||||
import <!UNRESOLVED_REFERENCE!>utils<!>.*
|
||||
@@ -49,4 +51,4 @@ fun test(l : java.util.List<Int>) {
|
||||
|
||||
namespace xxx {
|
||||
import java.lang.Class;
|
||||
}
|
||||
}
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
fun t1() : Int{
|
||||
return 0
|
||||
<!UNREACHABLE_CODE!>1<!>
|
||||
@@ -50,7 +50,7 @@ class MyTest() {
|
||||
i = <!UNUSED_VALUE!>456<!>;
|
||||
}
|
||||
|
||||
fun testWhile(a : Any?, b : Any?) {
|
||||
fun testWhile() {
|
||||
var a : Any? = true
|
||||
var b : Any? = 34
|
||||
while (a is Any) {
|
||||
@@ -139,4 +139,4 @@ fun testBackingFieldsNotMarked() {
|
||||
}
|
||||
}
|
||||
|
||||
fun doSmth(i : Int) {}
|
||||
fun doSmth(i : Int) {}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
class Foo1() : java.util.ArrayList<Int>()
|
||||
|
||||
open class Bar() {
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// KT-389 Wrong type inference for varargs etc.
|
||||
// +JDK
|
||||
|
||||
import java.util.*
|
||||
|
||||
@@ -23,4 +24,4 @@ fun test() {
|
||||
fool(1, 2, 3)
|
||||
food(1.0, 2.0, 3.0)
|
||||
foof(1.0.flt, 2.0.flt, 3.0.flt)
|
||||
}
|
||||
}
|
||||
+11
-8
@@ -13,16 +13,19 @@ fun foo() : Int {
|
||||
1 + <!UNRESOLVED_REFERENCE!>a<!> => 1
|
||||
in 1..<!UNRESOLVED_REFERENCE!>a<!> => 1
|
||||
!in 1..<!UNRESOLVED_REFERENCE!>a<!> => 1
|
||||
.<!UNRESOLVED_REFERENCE!>a<!> => 1
|
||||
.equals(1).<!UNRESOLVED_REFERENCE!>a<!> => 1
|
||||
<!UNNECESSARY_SAFE_CALL!>?.<!>equals(1) => 1
|
||||
// Commented for KT-621 .<!!UNRESOLVED_REFERENCE!>a<!!> => 1
|
||||
// Commented for KT-621 .equals(1).<!!UNRESOLVED_REFERENCE!>a<!!> => 1
|
||||
// Commented for KT-621 <!UNNECESSARY_SAFE_CALL!!>?.<!!>equals(1) => 1
|
||||
else => 1
|
||||
}
|
||||
return when (<!USELESS_ELVIS!>x<!>?:null) {
|
||||
<!UNSAFE_CALL!>.<!>foo() => 1
|
||||
.equals(1) => 1
|
||||
?.equals(1).equals(2) => 1
|
||||
}
|
||||
|
||||
// Commented for KT-621
|
||||
// return when (<!!USELESS_ELVIS!>x<!!>?:null) {
|
||||
// <!!UNSAFE_CALL!!>.<!!>foo() => 1
|
||||
// .equals(1) => 1
|
||||
// ?.equals(1).equals(2) => 1
|
||||
// }
|
||||
return 0
|
||||
}
|
||||
|
||||
val _type_test : Int = foo() // this is needed to ensure the inferred return type of foo()
|
||||
@@ -0,0 +1,6 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
fun ff(c: Collection<String>) = c <!CAST_NEVER_SUCCEEDS!>as<!> List<Int>
|
||||
@@ -0,0 +1,6 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
fun ff(c: Collection<String>) = c as List<String>
|
||||
@@ -0,0 +1,6 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List;
|
||||
|
||||
fun ff(l: Any) = l as List<*>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List;
|
||||
|
||||
fun ff(a: Any) = <!UNCHECKED_CAST!>a as List<String><!>
|
||||
@@ -0,0 +1,7 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
fun ff(l: Collection<String>) = l is List<String>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
open class A
|
||||
|
||||
class B : A
|
||||
|
||||
fun ff(l: Collection<B>) = l is List<out A>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List;
|
||||
|
||||
fun ff(l: Any) = l is <!CANNOT_CHECK_FOR_ERASED!>List<String><!>
|
||||
@@ -0,0 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List;
|
||||
|
||||
fun ff(l: Any) = l is List<*>
|
||||
@@ -0,0 +1,3 @@
|
||||
class MyList<T>
|
||||
|
||||
fun ff(a: Any) = a is MyList<String>
|
||||
@@ -0,0 +1,4 @@
|
||||
trait Aaa
|
||||
trait Bbb
|
||||
|
||||
fun f(a: Aaa) = a is Bbb
|
||||
@@ -0,0 +1,8 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List;
|
||||
|
||||
fun ff(l: Any) = when(l) {
|
||||
is <!CANNOT_CHECK_FOR_ERASED!>List<String><!> => 1
|
||||
else 2
|
||||
}
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
import java.*
|
||||
import util.*
|
||||
|
||||
@@ -63,4 +65,4 @@ fun main(args: Array<String>) {
|
||||
catch(e: Throwable) {
|
||||
System.out?.println(e.getMessage())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.Collections
|
||||
import java.util.List
|
||||
|
||||
val ab = Collections.emptyList<Int>() : List<Int>?
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// JET-72 Type inference doesn't work when iterating over ArrayList
|
||||
// +JDK
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
@@ -8,8 +8,11 @@ fun Any?.equals1(other : Any?) : Boolean = true
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
val command : Foo? = null
|
||||
when (command) {
|
||||
.equals(null) => 1; // must be resolved
|
||||
?.equals(null) => 1 // same here
|
||||
}
|
||||
|
||||
// Commented for KT-621
|
||||
// when (command) {
|
||||
// .equals(null) => 1; // must be resolved
|
||||
// ?.equals(null) => 1 // same here
|
||||
// }
|
||||
command.equals(null)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//KT-235 Illegal assignment return type
|
||||
// +JDK
|
||||
|
||||
namespace kt235
|
||||
|
||||
@@ -46,4 +47,4 @@ class MyArray1() {
|
||||
|
||||
class MyNumber() {
|
||||
fun inc(): MyNumber = MyNumber()
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// KT-258 Support equality constraints in type inference
|
||||
// +JDK
|
||||
|
||||
import java.util.*
|
||||
|
||||
+2
@@ -1,4 +1,6 @@
|
||||
// KT-287 Infer constructor type arguments
|
||||
// +JDK
|
||||
|
||||
import java.util.*
|
||||
|
||||
fun attributes() : Map<String, String> = HashMap() // Should be inferred;
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// KT-313 Bug in substitutions in a function returning its type parameter T
|
||||
// +JDK
|
||||
|
||||
fun <T> Iterable<T>.join(separator : String?) : String {
|
||||
return separator.npe()
|
||||
+1
@@ -1,5 +1,6 @@
|
||||
// KT-336 Can't infer type parameter for ArrayList in a generic function (Exception in type inference)
|
||||
// KT-335 Type inference fails on Collections.sort
|
||||
// +JDK
|
||||
|
||||
import java.util.*
|
||||
import java.lang.Comparable as Comparable
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
// KT-385 type inference does not work properly`
|
||||
// KT-109 Good code is red: type arguments are not inferred
|
||||
// KT-441 Exception in type inference when multiple overloads accepting an integer literal are accessible
|
||||
// +JDK
|
||||
|
||||
import java.util.*
|
||||
|
||||
@@ -31,4 +32,4 @@ inline fun run<T>(body : fun() : T) : T = body()
|
||||
fun main(args : Array<String>) {
|
||||
|
||||
println(run { 1 })
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
// KT-459 Type argument inference fails when class names are fully qualified
|
||||
// +JDK
|
||||
|
||||
fun test() {
|
||||
val attributes : java.util.HashMap<String, String> = java.util.HashMap() // failure!
|
||||
attributes["href"] = "1" // inference fails, but it shouldn't
|
||||
}
|
||||
|
||||
fun <K, V> java.util.Map<K, V>.set(key : K, value : V) {}//= this.put(key, value)
|
||||
fun <K, V> java.util.Map<K, V>.set(key : K, value : V) {}//= this.put(key, value)
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
namespace kt469
|
||||
|
||||
//KT-512 plusAssign() : Unit does not work properly
|
||||
@@ -0,0 +1,18 @@
|
||||
//KT-549 type inference failed
|
||||
// +JDK
|
||||
|
||||
namespace demo
|
||||
|
||||
fun filter<T>(list : Array<T>, filter : fun (T) : Boolean) : java.util.List<T> {
|
||||
val answer = java.util.ArrayList<T>();
|
||||
for (l in list) {
|
||||
if (filter(l)) answer.add(l)
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
for (a in filter(args, {it.length > 1})) {
|
||||
System.out?.println("Hello, ${a}!")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
//KT-571 Type inference failed
|
||||
fun <T, R> let(t : T, body : fun(T) : R) = body(t)
|
||||
private fun double(d : Int) : Int = let(d * 2) {it / 10 + it * 2 % 10}
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
//KT-58 Allow finally around definite returns
|
||||
// +JDK
|
||||
|
||||
namespace kt58
|
||||
|
||||
@@ -88,4 +89,4 @@ fun t7() : Int {
|
||||
}
|
||||
|
||||
fun doSmth(i: Int) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//KT-580 Type inference failed
|
||||
// +JDK
|
||||
|
||||
namespace whats.the.difference
|
||||
|
||||
import java.util.*
|
||||
|
||||
fun iarray(vararg a : String) = a // BUG
|
||||
|
||||
fun main(vals : IntArray) {
|
||||
val vals = iarray("789", "678", "567")
|
||||
val diffs = ArrayList<Int>
|
||||
for (i in vals.indices) {
|
||||
for (j in i..vals.lastIndex()) // Type inference failed
|
||||
diffs.add(vals[i].length - vals[j].length)
|
||||
for (j in i..vals.lastIndex) // Type inference failed
|
||||
diffs.add(vals[i].length - vals[j].length)
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> Array<T>.lastIndex() = size - 1
|
||||
val <T> Array<T>.lastIndex : Int get() = size - 1
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user