Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
class A() {
|
||||
class B(val i: Int) {
|
||||
}
|
||||
|
||||
fun test() = Array<B> (10, { B(it) })
|
||||
}
|
||||
|
||||
fun box() = if(A().test()[5].i == 5) "OK" else "fail"
|
||||
@@ -41,12 +41,48 @@ fun test4() : Int {
|
||||
}
|
||||
}
|
||||
|
||||
fun test5() : Int {
|
||||
var x = 0
|
||||
System.out?.println("test 5")
|
||||
while(true) {
|
||||
System.out?.println(x)
|
||||
try {
|
||||
if(x < 10)
|
||||
x++
|
||||
else
|
||||
break
|
||||
}
|
||||
finally {
|
||||
x++
|
||||
}
|
||||
}
|
||||
return x
|
||||
}
|
||||
|
||||
fun test6() : Int {
|
||||
var x = 0
|
||||
System.out?.println("test 6")
|
||||
while(x < 10) {
|
||||
System.out?.println(x)
|
||||
try {
|
||||
x++
|
||||
continue
|
||||
}
|
||||
finally {
|
||||
x++
|
||||
}
|
||||
}
|
||||
return x
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
if(test1()) return "test1 failed"
|
||||
if(test2()) return "test2 failed"
|
||||
if(test3() != 2) return "test3 failed"
|
||||
System.out?.println(test4())
|
||||
if(test4() != 3) return "test4 failed"
|
||||
if(test5() != 11) return "test5 failed"
|
||||
if(test6() != 10) return "test6 failed"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace org2
|
||||
|
||||
enum class Test {
|
||||
A
|
||||
B
|
||||
C
|
||||
}
|
||||
|
||||
fun box() = Test.A.toString()
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace w_range
|
||||
|
||||
fun box() : String {
|
||||
var i = 0
|
||||
when (i) {
|
||||
1 => i--
|
||||
else => { i = 2 }
|
||||
}
|
||||
System.out?.println(i)
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace demo2
|
||||
|
||||
fun print(o : Any?) {}
|
||||
|
||||
fun test(i : Int) {
|
||||
var monthString : String? = "<empty>"
|
||||
when (i) {
|
||||
1 => {
|
||||
print(1)
|
||||
print(2)
|
||||
print(3)
|
||||
print(4)
|
||||
print(5)
|
||||
}
|
||||
else => {
|
||||
monthString = "Invalid month"
|
||||
}
|
||||
}
|
||||
print(monthString)
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
for (i in 1..12) test(i)
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
class GenericArray {
|
||||
public static void ggff() {
|
||||
jet.typeinfo.TypeInfo noise = null;
|
||||
String[] s = namespace.ffgg(noise, new String[0]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
fun <P> ffgg(a: Array<P>) = a
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
class Hello {
|
||||
public static void xx() {
|
||||
String s = namespace.f();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
fun f() = "hello"
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
class Int {
|
||||
{
|
||||
int r = namespace.lll(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
fun lll(a: Int) = a
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
class IntArray {
|
||||
{
|
||||
int[] r = namespace.doNothing(new int[0]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
fun doNothing(array: IntArray) = array
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
class IntWithDefault {
|
||||
{
|
||||
int r = namespace.www(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
fun www(p: Int = 1) = p
|
||||
@@ -0,0 +1,11 @@
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class ListOfInt {
|
||||
|
||||
public static void hhh() {
|
||||
List<Integer> list = new ArrayList<Integer>();
|
||||
List<Integer> r = namespace.ggg(list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import java.util.List
|
||||
|
||||
fun ggg(list: List<Int>) = list
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class ListString {
|
||||
public static void gg() {
|
||||
List<String> list = new ArrayList<String>();
|
||||
namespace.ff(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import java.util.List
|
||||
|
||||
fun ff(p: List<String>) = 1
|
||||
@@ -0,0 +1,12 @@
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
class ListOfT {
|
||||
|
||||
public static void check() {
|
||||
jet.typeinfo.TypeInfo nobodyCaresAboutTypeinfo = null;
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<String> r = namespace.listOfT(nobodyCaresAboutTypeinfo, list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import java.util.List
|
||||
|
||||
fun <P> listOfT(list: List<P>) = list
|
||||
@@ -0,0 +1,13 @@
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
class MapOfKString {
|
||||
public static void gfgdgfg() {
|
||||
jet.typeinfo.TypeInfo useless = null;
|
||||
|
||||
Map<BigDecimal, String> map = new HashMap<BigDecimal, String>();
|
||||
|
||||
Map<BigDecimal, String> r = namespace.fff(useless, map);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import java.util.Map
|
||||
|
||||
fun <K> fff(map: Map<K, String>) = map
|
||||
@@ -0,0 +1,11 @@
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
class MapOfKString {
|
||||
public static void gfgdgfg() {
|
||||
Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
|
||||
Map<String, Integer> r = namespace.fff(map);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import java.util.Map
|
||||
|
||||
fun fff(map: Map<String, Int?>) = map
|
||||
@@ -0,0 +1,5 @@
|
||||
class Void {
|
||||
{
|
||||
namespace.f();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
fun f() { }
|
||||
@@ -0,0 +1,9 @@
|
||||
// KT-557 Wrong type inference near sure extension function
|
||||
|
||||
fun Array<String>.length() : Int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
fun test(array : Array<String?>?) {
|
||||
array<!UNNECESSARY_SAFE_CALL!>?.<!>sure<Array<String?>>()<!UNSAFE_CALL!>.<!>length()
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// +JDK
|
||||
//KT-750 Type inference failed: Constraint violation
|
||||
fun main(args : Array<String>) {
|
||||
var i : Int? = Integer.valueOf(100)
|
||||
var s : Int? = Integer.valueOf(100)
|
||||
|
||||
val o = i .sure() + s.sure()
|
||||
System.out?.println(o)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
//KT-762 Wrong highlighting in imports (No errors reported on unresolved imports)
|
||||
import <!UNRESOLVED_REFERENCE!>aaa<!> // must be an error
|
||||
|
||||
fun main(args : Array<String>) {}
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace test
|
||||
|
||||
fun ff(): String = ""
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace test
|
||||
|
||||
fun ff(): String? = ""
|
||||
Reference in New Issue
Block a user