Merge remote-tracking branch 'origin/master'

This commit is contained in:
svtk
2011-12-26 18:37:27 +04:00
467 changed files with 5068 additions and 2902 deletions
+8 -8
View File
@@ -121,17 +121,17 @@ sink:
<SINK> NEXT:[] PREV:[<END>]
=====================
== flfun ==
fun flfun(f : fun () : Any) : Unit {}
fun flfun(f : () -> Any) : Unit {}
---------------------
l0:
<START> NEXT:[v(f : fun () : Any)] PREV:[]
v(f : fun () : Any) NEXT:[w(f)] PREV:[<START>]
w(f) NEXT:[read (Unit)] PREV:[v(f : fun () : Any)]
read (Unit) NEXT:[<END>] PREV:[w(f)]
<START> NEXT:[v(f : () -> Any)] PREV:[]
v(f : () -> Any) NEXT:[w(f)] PREV:[<START>]
w(f) NEXT:[read (Unit)] PREV:[v(f : () -> Any)]
read (Unit) NEXT:[<END>] PREV:[w(f)]
l1:
<END> NEXT:[<SINK>] PREV:[read (Unit)]
<END> NEXT:[<SINK>] PREV:[read (Unit)]
error:
<ERROR> NEXT:[] PREV:[]
<ERROR> NEXT:[] PREV:[]
sink:
<SINK> NEXT:[] PREV:[<END>]
<SINK> NEXT:[] PREV:[<END>]
=====================
+1 -1
View File
@@ -20,4 +20,4 @@ fun foo(a : Boolean, b : Int) : Unit {}
fun genfun<T>() : Unit {}
fun flfun(f : fun () : Any) : Unit {}
fun flfun(f : () -> Any) : Unit {}
+1 -1
View File
@@ -1,4 +1,4 @@
namespace foo;
package foo;
fun main(args : Array<String>) {
@@ -1,7 +1,7 @@
fun box() : String {
return apply( "OK", {(arg: String) => arg } )
return apply( "OK", {(arg: String) -> arg } )
}
fun apply(arg : String, f : fun (p:String) : String) : String {
fun apply(arg : String, f : (p:String) -> String) : String {
return f(arg)
}
@@ -1,7 +1,7 @@
fun box() : String {
return if (apply( 5, {(arg: Int) => arg + 13 } ) == 18) "OK" else "fail"
return if (apply( 5, {(arg: Int) -> arg + 13 } ) == 18) "OK" else "fail"
}
fun apply(arg : Int, f : fun (p:Int) : Int) : Int {
fun apply(arg : Int, f : (p:Int) -> Int) : Int {
return f(arg)
}
@@ -3,6 +3,6 @@ fun box() : String {
return if (sum(200, { val ff = {cl}; ff() }) == 239) "OK" else "FAIL"
}
fun sum(arg:Int, f : fun () : Int) : Int {
fun sum(arg:Int, f : () -> Int) : Int {
return arg + f()
}
@@ -3,6 +3,6 @@ fun box() : String {
return if (sum(200, { val m = { val r = { cl }; r() }; m() }) == 239) "OK" else "FAIL"
}
fun sum(arg:Int, f : fun () : Int) : Int {
fun sum(arg:Int, f : () -> Int) : Int {
return arg + f()
}
@@ -1,10 +1,10 @@
class Point(val x:Int, val y:Int) {
fun mul() : fun (scalar:Int):Point {
return { (scalar:Int):Point => Point(x * scalar, y * scalar) }
fun mul() : (scalar:Int)->Point {
return { (scalar:Int):Point -> Point(x * scalar, y * scalar) }
}
}
val m = Point(2, 3).mul() : fun (scalar:Int):Point
val m = Point(2, 3).mul() : (scalar:Int)->Point
fun box() : String {
val answer = m(5)
@@ -1,13 +1,13 @@
class Point(val x : Int, val y : Int)
fun box() : String {
val answer = apply(Point(3, 5), { Point.(scalar : Int) : Point =>
val answer = apply(Point(3, 5), { Point.(scalar : Int) : Point ->
Point(x * scalar, y * scalar)
})
return if (answer.x == 6 && answer.y == 10) "OK" else "FAIL"
}
fun apply(arg:Point, f : fun Point.(scalar : Int) : Point) : Point {
fun apply(arg:Point, f : Point.(scalar : Int) -> Point) : Point {
return arg.f(2)
}
@@ -2,6 +2,6 @@ fun box() : String {
return invoker( {"OK"} )
}
fun invoker(gen : fun () : String) : String {
fun invoker(gen : () -> String) : String {
return gen()
}
@@ -2,6 +2,6 @@ fun box() : String {
return if (int_invoker( { 7 } ) == 7) "OK" else "fail"
}
fun int_invoker(gen : fun () : Int) : Int {
fun int_invoker(gen : () -> Int) : Int {
return gen()
}
@@ -1,7 +1,7 @@
import java.util.concurrent.*
import java.util.concurrent.atomic.*
fun thread(block: fun():Unit ) {
fun thread(block: ()->Unit ) {
val thread = object: Thread() {
override fun run() {
block()
@@ -1,6 +1,6 @@
import java.util.*
fun <T> ArrayList<T>.findAll(predicate: fun (T) : Boolean): ArrayList<T> {
fun <T> ArrayList<T>.findAll(predicate: (T) -> Boolean): ArrayList<T> {
val result = ArrayList<T>()
for(val t in this) {
if (predicate(t)) result.add(t)
@@ -16,6 +16,6 @@ fun box(): String {
list.add("Moscow")
list.add("Munich")
val m: ArrayList<String> = list.findAll<String>({(name: String) => name.startsWith("M")})
val m: ArrayList<String> = list.findAll<String>({(name: String) -> name.startsWith("M")})
return if (m.size() == 2) "OK" else "fail"
}
@@ -2,7 +2,7 @@ fun <T> T.mustBe(t : T) {
assert("$this must be $t") {this == t}
}
inline fun assert(message : String, condition : fun() : Boolean) {
inline fun assert(message : String, condition : () -> Boolean) {
if (!condition())
throw AssertionError(message)
}
@@ -3,7 +3,7 @@ class Request(val path: String) {
}
class Handler() {
fun Int.times(op: fun(): Unit) {
fun Int.times(op: ()-> Unit) {
for(i in 0..this)
op()
}
@@ -8,7 +8,7 @@ fun StringBuilder.takeFirst(): Char {
fun foo(expr: StringBuilder): Int {
val c = expr.takeFirst()
when(c) {
0.chr => throw Exception("zero")
else => throw Exception("nonzero" + c)
0.chr -> throw Exception("zero")
else -> throw Exception("nonzero" + c)
}
}
@@ -5,7 +5,7 @@ fun reformat(
divideByCamelHumps : Boolean = true,
wordSeparator : String = " "
) =
(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator)
#(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator)
trait A {
fun bar2(arg: Int = 239) : Int
@@ -38,7 +38,7 @@ class C() : B() {
fun <T> T.toPrefixedString(prefix: String = "", suffix: String="") = prefix + (this as java.lang.Object).toString() + suffix
fun box() : String {
val expected = (true, true, true, " ")
val expected = #(true, true, true, " ")
if("mama".toPrefixedString(suffix="321", prefix="papa") != "papamama321") return "fail"
if("mama".toPrefixedString(prefix="papa") != "papamama") return "fail"
@@ -1,24 +1,24 @@
fun Any.foo1() : fun(): String {
fun Any.foo1() : ()-> String {
return { "239" + this }
}
fun Int.foo2() : fun(i : Int) : Int {
return { x => x + this }
fun Int.foo2() : (i : Int) -> Int {
return { x -> x + this }
}
fun fooT1<T>(t : T) = { t.toString() }
fun fooT2<T>(t: T) = { (x:T) => t.toString() + x.toString() }
fun fooT2<T>(t: T) = { (x:T) -> t.toString() + x.toString() }
fun box() : String {
if( (10.foo1())() != "23910") return "foo1 fail"
if( (10.foo2())(1) != 11 ) return "foo2 fail"
if(1.{Int.() => this + 1}() != 2) return "test 3 failed";
if(1.{Int.() -> this + 1}() != 2) return "test 3 failed";
if( {1}() != 1) return "test 4 failed";
if( {(x : Int) => x}(1) != 1) return "test 5 failed";
if( 1.{Int.(x : Int) => x + this}(1) != 2) return "test 6 failed";
if( 1.({Int.() => this})() != 1) return "test 7 failed";
if( {(x : Int) -> x}(1) != 1) return "test 5 failed";
if( 1.{Int.(x : Int) -> x + this}(1) != 2) return "test 6 failed";
if( 1.({Int.() -> this})() != 1) return "test 7 failed";
if( (fooT1<String>("mama"))() != "mama") return "test 8 failed";
if( (fooT2<String>("mama"))("papa") != "mamapapa") return "test 9 failed";
return "OK"
@@ -1,6 +1,6 @@
fun loop(var times : Int) {
while(times > 0) {
val u : fun(value : Int) : Unit = {
val u : (value : Int) -> Unit = {
System.out?.println(it)
}
u(times--)
@@ -1,5 +1,5 @@
class X<T> () {
fun getTypeChecker() = { (a : Any) => a is T }
fun getTypeChecker() = { (a : Any) -> a is T }
}
fun box() : String {
@@ -1,4 +1,4 @@
namespace Foo {
package Foo {
fun bar() = 610
}
@@ -1,4 +1,4 @@
fun isZero(x: Int) = when(x) {
0 => true
else => false
0 -> true
else -> false
}
@@ -1,3 +1,3 @@
fun isZero(x: Int) = when(x) {
0 => true
0 -> true
}
@@ -1,7 +1,7 @@
fun typeName(a: Any?) : String {
return when(a) {
is java.util.ArrayList<*> => "array list"
else => "no idea"
is java.util.ArrayList<*> -> "array list"
else -> "no idea"
}
}
@@ -1,4 +1,4 @@
fun isString(x: Any) = when(x) {
is String => "string"
else => "something"
is String -> "string"
else -> "something"
}
@@ -3,9 +3,9 @@ fun isDigit(a: Int) : String {
aa.add(239)
return when(a) {
in aa => "array list"
in 0..9 => "digit"
!in 0..100 => "not small"
else => "something"
in aa -> "array list"
in 0..9 -> "digit"
!in 0..100 -> "not small"
else -> "something"
}
}
@@ -1,4 +1,4 @@
fun isDigit(a: Char) = when(a) {
in '0'..'9' => "digit"
else => "something"
in '0'..'9' -> "digit"
else -> "something"
}
@@ -1,11 +1,11 @@
fun main(args: Array<String>?) {
val y: Unit = () //do not compile
val y: Unit = #() //do not compile
A<Unit>() //do not compile
C<Unit>(()) //do not compile
C<Unit>(#()) //do not compile
//do not compile
System.out?.println(fff<Unit>(())) //do not compile
System.out?.println(fff<Unit>(#())) //do not compile
System.out?.println(id<Unit>(y)) //do not compile
System.out?.println(fff<Unit>(id<Unit>(y)) == id<Unit>(foreach(Array<Int>(0,{0}),{(e : Int) : Unit => }))) //do not compile
System.out?.println(fff<Unit>(id<Unit>(y)) == id<Unit>(foreach(Array<Int>(0,{0}),{(e : Int) : Unit -> }))) //do not compile
}
class A<T>()
@@ -17,13 +17,13 @@ fun <T> fff(x: T) : T { return x }
fun <T> id(value: T): T = value
fun foreach(array: Array<Int>?, action: fun(Int): Unit) {
fun foreach(array: Array<Int>?, action: (Int)-> Unit) {
for (el in array) {
action(el) //exception through compilation (see below)
}
}
fun almostFilter(array: Array<Int>, action: fun(Int): Int) {
fun almostFilter(array: Array<Int>, action: (Int)-> Int) {
for (el in array) {
action(el)
}
@@ -34,8 +34,8 @@ fun box() : String {
a[0] = 0
a[1] = 1
a[2] = 2
foreach(a, { (el : Int) : Unit => System.out?.println(el) })
almostFilter(a, { (el : Int) : Int => el })
foreach(a, { (el : Int) : Unit -> System.out?.println(el) })
almostFilter(a, { (el : Int) : Int -> el })
main(null)
return "OK"
}
@@ -1,4 +1,4 @@
namespace x
package x
class Outer() {
class object {
@@ -1,4 +1,4 @@
namespace test
package test
class List<T>(len: Int) {
val a : Array<T?> = Array<T?>(len)
@@ -1,12 +1,12 @@
import java.util.ArrayList
fun launch(f : fun() : Unit) {
fun launch(f : () -> Unit) {
f()
}
fun box(): String {
val list = ArrayList<Int>()
val foo : fun() : Unit = {
val foo : () -> Unit = {
list.add(2) //first exception
}
foo()
@@ -27,7 +27,7 @@ fun t1() : Boolean {
x = x + "45" + y
x = x.substring(3)
x += "aaa"
()
#()
}
foo()
@@ -43,7 +43,7 @@ fun t2() : Boolean {
x = x + 5 + y
x += 5
x++
()
#()
}
foo()
x -= 55
@@ -55,7 +55,7 @@ fun t3() : Boolean {
var x = true
val foo = {
x = false
()
#()
}
foo()
return !x
@@ -67,7 +67,7 @@ fun t4() : Boolean {
val foo = {
x = x + 200.flt + y
x += 18
()
#()
}
foo()
System.out?.println(x)
@@ -80,7 +80,7 @@ fun t5() : Boolean {
val foo = {
x = x + 200.dbl + y
x -= 22
()
#()
}
foo()
System.out?.println(x)
@@ -94,7 +94,7 @@ fun t6() : Boolean {
x = (x + 20.byt + y).byt
x += 2
x--
()
#()
}
foo()
System.out?.println(x)
@@ -105,7 +105,7 @@ fun t7() : Boolean {
var x : Char = 'a'
val foo = {
x = 'b'
()
#()
}
foo()
System.out?.println(x)
@@ -117,10 +117,10 @@ fun t8() : Boolean {
val foo = {
val bar = {
x = 30.sht
()
#()
}
bar()
()
#()
}
foo()
return x == 30.sht
@@ -1,6 +1,6 @@
fun Any.with(operation : fun Any.() : Any) = operation().toString()
fun Any.with(operation : Any.() -> Any) = operation().toString()
val f = { (a : Int) :Unit => }
val f = { (a : Int) :Unit -> }
fun box () : String {
return if(20.with {
@@ -1,4 +1,4 @@
namespace mult_constructors_3_bug
package mult_constructors_3_bug
public open class Identifier() {
private var myNullable : Boolean = true
@@ -1,4 +1,4 @@
namespace one_extends_base
package one_extends_base
open class Base<T>(name : T?) {
var myName : T?
@@ -1,4 +1,4 @@
namespace mask
package mask
import std.io.*
import java.io.*
@@ -52,7 +52,7 @@ class Luhny() {
fun check() {
if (digits.size() < 14) return
print("check")
val sum = digits.sum { i, d =>
val sum = digits.sum { i, d ->
// println("$i -> $d")
if (i % 2 == digits.size()) {
val f = d * 2 / 10
@@ -94,12 +94,12 @@ class Luhny() {
}
}
fun <T> T.pr(f : fun(T) : Unit) : T {
fun <T> T.pr(f : (T) -> Unit) : T {
f(this)
return this
}
fun LinkedList<Int>.sum(f : fun(Int, Int ): Int): Int {
fun LinkedList<Int>.sum(f : (Int, Int )-> Int): Int {
var sum = 0
for (i in 1..size()) {
val j = size() - i
@@ -120,7 +120,7 @@ fun LinkedList<Int>.sum(f : fun(Int, Int ): Int): Int {
fun Char.isDigit() = Character.isDigit(this)
fun Reader.forEachChar(body : fun(Char) : Unit) {
fun Reader.forEachChar(body : (Char) -> Unit) {
do {
var i = read();
if (i == -1) break
@@ -1,4 +1,4 @@
namespace mask
package mask
import std.io.*
import java.io.*
@@ -46,7 +46,7 @@ class Luhny() {
private fun check() {
val size = digits.size()
if (size < 14) return
val sum = digits.sum {i, d =>
val sum = digits.sum {i, d ->
if (i % 2 == size % 2) double(d) else d
}
// var sum = 0
@@ -89,7 +89,7 @@ class Luhny() {
fun Char.isDigit() = Character.isDigit(this)
fun java.lang.Iterable<Int>.sum(f : fun(index : Int, value : Int) : Int) : Int {
fun java.lang.Iterable<Int>.sum(f : (index : Int, value : Int) -> Int) : Int {
var sum = 0
var i = 0
for (d in this) {
@@ -99,7 +99,7 @@ fun java.lang.Iterable<Int>.sum(f : fun(index : Int, value : Int) : Int) : Int {
return sum
}
fun Reader.forEachChar(body : fun(Char) : Unit) {
fun Reader.forEachChar(body : (Char) -> Unit) {
do {
var i = read();
if (i == -1) break
@@ -1,4 +1,4 @@
namespace mask
package mask
import std.io.*
import java.io.*
@@ -50,7 +50,7 @@ class Luhny() {
fun check() {
if (digits.size() < 14) return
val sum = digits.sum { i, d =>
val sum = digits.sum { i, d ->
if (i % 2 != 0)
d * 2 / 10 + d * 2 % 10
else d
@@ -85,7 +85,7 @@ class Luhny() {
}
}
fun LinkedList<Int>.sum(f : fun(Int, Int) : Int) : Int {
fun LinkedList<Int>.sum(f : (Int, Int) -> Int) : Int {
var sum = 0
var i = 0
for (d in backwards()) {
@@ -136,7 +136,7 @@ fun Char.isDigit() = Character.isDigit(this)
// fun clear() {}
//}
fun Reader.forEachChar(body : fun(Char) : Unit) {
fun Reader.forEachChar(body : (Char) -> Unit) {
do {
var i = read();
if (i == -1) break
@@ -1,4 +1,4 @@
namespace while_bug_1
package while_bug_1
import java.io.*
@@ -1,4 +1,4 @@
namespace whats.the.difference
package whats.the.difference
import java.util.HashSet
@@ -1,4 +1,4 @@
namespace array_test
package array_test
fun box() : String {
var array : IntArray? = IntArray(10)
@@ -1,4 +1,4 @@
namespace name
package name
class Test() {
var i = 5
@@ -1,4 +1,4 @@
namespace demo
package demo
public open class Identifier<T>(myName : T?, myHasDollar : Boolean) {
{
@@ -1,8 +1,8 @@
fun escapeChar(c : Char) : String? = when (c) {
'\\' => "\\\\"
'\n' => "\\n"
'"' => "\\\""
else => String.valueOf(c)
'\\' -> "\\\\"
'\n' -> "\\n"
'"' -> "\\\""
else -> String.valueOf(c)
}
fun String.escape(i : Int = 0, result : String = "") : String =
@@ -1,4 +1,4 @@
namespace org2
package org2
enum class Test {
A
@@ -1,6 +1,6 @@
class List<T>(val head: T, val tail: List<T>? = null)
fun <T> List<T>.mapHead(f: fun(T): T): List<T> = List<T>(f(head), null)
fun <T> List<T>.mapHead(f: (T)-> T): List<T> = List<T>(f(head), null)
fun box() : String {
val a: Int = List<Int>(1).mapHead{it * 2}.head
@@ -1,4 +1,4 @@
namespace demo_range
package demo_range
fun Int?.rangeTo(other : Int?) : IntRange = this.sure().rangeTo(other.sure())
@@ -1,4 +1,4 @@
namespace bitwise_demo
package bitwise_demo
fun Long?.shl(bits : Int?) : Long = this.sure().shl(bits.sure())
@@ -1,4 +1,4 @@
namespace demo_range
package demo_range
fun Int?.plus() : Int = this.sure().plus()
fun Int?.dec() : Int = this.sure().dec()
@@ -1,4 +1,4 @@
namespace demo_long
package demo_long
fun Long?.inv() : Long = this.sure().inv()
@@ -1,10 +1,10 @@
namespace w_range
package w_range
fun box() : String {
var i = 0
when (i) {
1 => i--
else => { i = 2 }
1 -> i--
else -> { i = 2 }
}
System.out?.println(i)
return "OK"
@@ -1,18 +1,18 @@
namespace demo2
package demo2
fun print(o : Any?) {}
fun test(i : Int) {
var monthString : String? = "<empty>"
when (i) {
1 => {
1 -> {
print(1)
print(2)
print(3)
print(4)
print(5)
}
else => {
else -> {
monthString = "Invalid month"
}
}
@@ -1,18 +1,18 @@
namespace demo2
package demo2
fun print(o : Any?) {}
fun test(i : Int) {
var monthString : String? = "<empty>"
when (i) {
1 => {
1 -> {
print(1)
print(2)
print(3)
print(4)
print(5)
}
else => {
else -> {
monthString = "Invalid month"
}
}
@@ -1,7 +1,7 @@
class A() {
var x : Int = 0
var z = { () =>
var z = { () ->
x++
}
}
@@ -1,4 +1,4 @@
namespace foo
package foo
import java.util.*;
@@ -1,4 +1,4 @@
namespace demo
package demo
fun box() : String {
var res : Boolean = true
@@ -0,0 +1,7 @@
package container_test
class Container<T>(var t : T) {
fun getT() : T = t
}
fun box() = Container<String>("OK").getT()
@@ -0,0 +1,5 @@
fun box() = when {
1 > 2 -> "false"
1 >= 1 -> "OK"
else -> "else"
}
+1 -1
View File
@@ -36,7 +36,7 @@ trait WriteOnlyArray<in T> : ISized {
}
}
class MutableArray<T>(length: Int, init : fun(Int) : T) : ReadOnlyArray<T>, WriteOnlyArray<T> {
class MutableArray<T>(length: Int, init : (Int) -> T) : ReadOnlyArray<T>, WriteOnlyArray<T> {
private val array = Array<T>(length, init)
override fun get(index : Int) : T = array[index]
+1 -1
View File
@@ -1,4 +1,4 @@
namespace Smoke
package Smoke
import std.io.*
+4 -6
View File
@@ -1,8 +1,6 @@
import kotlin.modules.ModuleSetBuilder
import kotlin.modules.*
fun ModuleSetBuilder.defineModules() {
module("smoke") {
source files "Smoke.kt"
jar name System.getProperty("java.io.tmpdir") + "/smoke.jar"
}
val modules = module("smoke") {
source files "Smoke.kt"
jar name System.getProperty("java.io.tmpdir") + "/smoke.jar"
}
@@ -2,7 +2,7 @@ fun foo(u : Unit) : Int = 1
fun test() : Int {
foo(1)
val a : fun() : Unit = {
val a : () -> Unit = {
foo(1)
}
return 1 - "1"
@@ -1,6 +1,6 @@
// +JDK
namespace abstract
package abstract
class MyClass() {
//properties
@@ -180,7 +180,7 @@ enum class MyEnum() {
abstract enum class MyAbstractEnum() {}
namespace MyNamespace {
package MyNamespace {
//properties
val <!MUST_BE_INITIALIZED!>a<!>: Int
val a1: Int = 1
@@ -1,10 +1,10 @@
fun text() {
"direct:a" to "mock:a"
"direct:a" on {it.body == "<hello/>"} to "mock:a"
"direct:a" on {it => it.body == "<hello/>"} to "mock:a"
"direct:a" on {it -> it.body == "<hello/>"} to "mock:a"
bar <!TYPE_MISMATCH!>{1}<!>
bar <!TYPE_MISMATCH!>{<!UNRESOLVED_REFERENCE!>it<!> + 1}<!>
bar {it, it1 => it}
bar {it, it1 -> it}
bar1 {1}
bar1 {it + 1}
@@ -12,18 +12,18 @@ fun text() {
bar2 <!TYPE_MISMATCH!>{<!TYPE_MISMATCH!><!>}<!>
bar2 {1}
bar2 {<!UNRESOLVED_REFERENCE!>it<!>}
bar2 <!TYPE_MISMATCH!>{<!CANNOT_INFER_PARAMETER_TYPE!>it<!> => it}<!>
bar2 <!TYPE_MISMATCH!>{<!CANNOT_INFER_PARAMETER_TYPE!>it<!> -> it}<!>
}
fun bar(<!UNUSED_PARAMETER!>f<!> : fun (Int, Int) : Int) {}
fun bar1(<!UNUSED_PARAMETER!>f<!> : fun (Int) : Int) {}
fun bar2(<!UNUSED_PARAMETER!>f<!> : fun () : Int) {}
fun bar(<!UNUSED_PARAMETER!>f<!> : (Int, Int) -> Int) {}
fun bar1(<!UNUSED_PARAMETER!>f<!> : (Int) -> Int) {}
fun bar2(<!UNUSED_PARAMETER!>f<!> : () -> Int) {}
fun String.to(<!UNUSED_PARAMETER!>dest<!> : String) {
}
fun String.on(<!UNUSED_PARAMETER!>predicate<!> : fun (s : URI) : Boolean) : URI {
fun String.on(<!UNUSED_PARAMETER!>predicate<!> : (s : URI) -> Boolean) : URI {
return URI(this)
}
@@ -1,6 +1,6 @@
namespace example;
package example;
namespace ns {
package ns {
val y : Any? = 2
}
@@ -2,7 +2,7 @@ fun foo(<!UNUSED_PARAMETER!>u<!> : Unit) : Int = 1
fun test() : Int {
foo(<!TYPE_MISMATCH!>1<!>)
val <!UNUSED_VARIABLE!>a<!> : fun() : Unit = {
val <!UNUSED_VARIABLE!>a<!> : () -> Unit = {
foo(<!TYPE_MISMATCH!>1<!>)
}
return 1 <!NONE_APPLICABLE!>-<!> "1"
@@ -1,4 +1,4 @@
namespace boundsWithSubstitutors {
package boundsWithSubstitutors {
open class A<T>
class B<X : A<X>>()
@@ -18,10 +18,10 @@ namespace boundsWithSubstitutors {
open class A {}
open class B<T : A>()
abstract class C<T : B<<!UPPER_BOUND_VIOLATED!>Int<!>>, X : fun (B<<!UPPER_BOUND_VIOLATED!>Char<!>>) : (B<<!UPPER_BOUND_VIOLATED!>Any<!>>, B<A>)>() : B<<!UPPER_BOUND_VIOLATED, UPPER_BOUND_VIOLATED!>Any<!>>() { // 2 errors
abstract class C<T : B<<!UPPER_BOUND_VIOLATED!>Int<!>>, X : (B<<!UPPER_BOUND_VIOLATED!>Char<!>>) -> #(B<<!UPPER_BOUND_VIOLATED!>Any<!>>, B<A>)>() : B<<!UPPER_BOUND_VIOLATED, UPPER_BOUND_VIOLATED!>Any<!>>() { // 2 errors
val a = B<<!UPPER_BOUND_VIOLATED!>Char<!>>() // error
abstract val x : fun (B<<!UPPER_BOUND_VIOLATED!>Char<!>>) : B<<!UPPER_BOUND_VIOLATED!>Any<!>>
abstract val x : (B<<!UPPER_BOUND_VIOLATED!>Char<!>>) -> B<<!UPPER_BOUND_VIOLATED!>Any<!>>
}
@@ -2,7 +2,7 @@
import java.util.*
namespace html {
package html {
abstract class Factory<T> {
abstract fun create() : T
@@ -16,7 +16,7 @@ namespace html {
val children = ArrayList<Element>()
val attributes = HashMap<String, String>()
protected fun initTag<T : Element>(init : fun T.() : Unit) : T
protected fun initTag<T : Element>(init : T.() -> Unit) : T
where class object T : Factory<T>{
val tag = T.create()
tag.init()
@@ -36,9 +36,9 @@ namespace html {
override fun create() = HTML()
}
fun head(init : fun Head.() : Unit) = initTag<Head>(init)
fun head(init : Head.() -> Unit) = initTag<Head>(init)
fun body(init : fun Body.() : Unit) = initTag<Body>(init)
fun body(init : Body.() -> Unit) = initTag<Body>(init)
}
class Head() : TagWithText("head") {
@@ -46,7 +46,7 @@ namespace html {
override fun create() = Head()
}
fun title(init : fun Title.() : Unit) = initTag<Title>(init)
fun title(init : Title.() -> Unit) = initTag<Title>(init)
}
class Title() : TagWithText("title")
@@ -59,10 +59,10 @@ namespace html {
override fun create() = Body()
}
fun b(init : fun B.() : Unit) = initTag<B>(init)
fun p(init : fun P.() : Unit) = initTag<P>(init)
fun h1(init : fun H1.() : Unit) = initTag<H1>(init)
fun a(href : String, init : fun A.() : Unit) {
fun b(init : B.() -> Unit) = initTag<B>(init)
fun p(init : P.() -> Unit) = initTag<P>(init)
fun h1(init : H1.() -> Unit) = initTag<H1>(init)
fun a(href : String, init : A.() -> Unit) {
val a = initTag<A>(init)
a.href = href
}
@@ -79,7 +79,7 @@ namespace html {
fun Map<String, String>.set(key : String, value : String) = this.put(key, value)
fun html(init : fun HTML.() : Unit) : HTML {
fun html(init : HTML.() -> Unit) : HTML {
val html = HTML()
html.init()
return html
@@ -87,7 +87,7 @@ namespace html {
}
namespace foo {
package foo {
import html.*
@@ -12,5 +12,5 @@ fun test() : Unit {
y <!USELESS_CAST!>as?<!> Int : Int?
x <!USELESS_CAST!>as?<!> Int? : Int?
y <!USELESS_CAST_STATIC_ASSERT_IS_FINE!>as?<!> Int? : Int?
()
#()
}
@@ -1,6 +1,6 @@
// +JDK
namespace Jet86
package Jet86
class A {
class object {
@@ -13,7 +13,7 @@ class A {
}
}
namespace deepSpace {
package deepSpace {
<!CONFLICTING_OVERLOADS!>fun c(<!UNUSED_PARAMETER!>s<!>: String)<!> {
}
@@ -32,23 +32,23 @@ namespace deepSpace {
// check no error in overload in different namespaces
namespace ns1 {
package ns1 {
fun e() = 1
}
namespace ns2 {
package ns2 {
fun e() = 1
}
namespace ns3 {
namespace ns1 {
package ns3 {
package ns1 {
fun e() = 1
}
}
// check same rules apply for ext functions
namespace extensionFunctions {
package extensionFunctions {
<!CONFLICTING_OVERLOADS!>fun Int.qwe(<!UNUSED_PARAMETER!>a<!>: Float)<!> = 1
<!CONFLICTING_OVERLOADS!>fun Int.qwe(<!UNUSED_PARAMETER!>a<!>: Float)<!> = 2
@@ -60,7 +60,7 @@ namespace extensionFunctions {
// check no error when regular function and extension function have same name
namespace extensionAndRegular {
package extensionAndRegular {
fun who() = 1
fun Int.who() = 1
@@ -68,7 +68,7 @@ namespace extensionAndRegular {
// constructor vs. fun overload
namespace constructorVsFun {
package constructorVsFun {
class <!CONFLICTING_OVERLOADS!>a()<!> { }
<!CONFLICTING_OVERLOADS!>fun a()<!> = 1
@@ -1,4 +1,4 @@
namespace dollar
package dollar
open class `$$$$$`() {
}
@@ -1,22 +1,22 @@
namespace foo
package foo
fun Any.foo() : fun() : Unit {
fun Any.foo() : () -> Unit {
return {}
}
fun Any.foo1() : fun(i : Int) : Unit {
fun Any.foo1() : (i : Int) -> Unit {
return {}
}
fun foo2() : fun(i : fun()) : Unit {
fun foo2() : (i : () -> Unit) -> Unit {
return {}
}
fun fooT1<T>(t : T) : fun() : T {
fun fooT1<T>(t : T) : () -> T {
return {t}
}
fun fooT2<T>() : fun(t : T) : T {
fun fooT2<T>() : (t : T) -> T {
return {it}
}
@@ -34,8 +34,8 @@ fun main(args : Array<String>) {
foo2()({})
foo2()<!TOO_MANY_ARGUMENTS!>{}<!>
(foo2()){}
(foo2())<!TYPE_MISMATCH!>{<!CANNOT_INFER_PARAMETER_TYPE!>x<!> => }<!>
foo2()(<!TYPE_MISMATCH!>{<!CANNOT_INFER_PARAMETER_TYPE!>x<!> => }<!>)
(foo2())<!TYPE_MISMATCH!>{<!CANNOT_INFER_PARAMETER_TYPE!>x<!> -> }<!>
foo2()(<!TYPE_MISMATCH!>{<!CANNOT_INFER_PARAMETER_TYPE!>x<!> -> }<!>)
val a = fooT1(1)()
a : Int
@@ -49,19 +49,19 @@ fun main(args : Array<String>) {
<!CALLEE_NOT_A_FUNCTION!>1<!>(){}
}
fun f() : fun Int.() : Unit = {}
fun f() : Int.() -> Unit = {}
fun main1() {
1.{Int.() => 1}();
1.{Int.() -> 1}();
{1}()
{(x : Int) => x}(1)
1.{Int.(x : Int) => x}(1)
{(x : Int) -> x}(1)
1.{Int.(x : Int) -> x}(1)
@l{1}()
1.({Int.() => 1})()
1.({Int.() -> 1})()
1.(f())()
1.if(true){f()}else{f()}()
1.if(true){Int.() => 1}else{f()}()
1.if(true){Int.() => 1}else{Int.() => 1}()
1.if(true){Int.() -> 1}else{f()}()
1.if(true){Int.() -> 1}else{Int.() -> 1}()
1.<!CALLEE_NOT_A_FUNCTION!>"sdf"<!>()
@@ -71,12 +71,12 @@ fun main1() {
}
fun test() {
{(x : Int) => 1}<!NO_VALUE_FOR_PARAMETER!>()<!>
<!MISSING_RECEIVER!>{Int.() => 1}<!>()
<!TYPE_MISMATCH!>"sd"<!>.{Int.() => 1}()
{(x : Int) -> 1}<!NO_VALUE_FOR_PARAMETER!>()<!>
<!MISSING_RECEIVER!>{Int.() -> 1}<!>()
<!TYPE_MISMATCH!>"sd"<!>.{Int.() -> 1}()
val i : Int? = null
i<!UNSAFE_CALL!>.<!>{Int.() => 1}()
i<!UNSAFE_CALL!>.<!>{Int.() -> 1}()
{}<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!>()
1<!UNNECESSARY_SAFE_CALL!>?.<!>{Int.() => 1}()
1<!UNNECESSARY_SAFE_CALL!>?.<!>{Int.() -> 1}()
1.<!NO_RECEIVER_ADMITTED!>{}<!>()
}
@@ -6,11 +6,11 @@ fun unitEmptyInfer() {}
fun unitEmpty() : Unit {}
fun unitEmptyReturn() : Unit {return}
fun unitIntReturn() : Unit {return <!TYPE_MISMATCH!>1<!>}
fun unitUnitReturn() : Unit {return ()}
fun unitUnitReturn() : Unit {return #()}
fun test1() : Any = {<!RETURN_TYPE_MISMATCH, RETURN_NOT_ALLOWED!>return<!>}
fun test2() : Any = @a {return@a 1}
fun test3() : Any { <!RETURN_TYPE_MISMATCH!>return<!> }
fun test4(): fun(): Unit = { <!RETURN_TYPE_MISMATCH, RETURN_NOT_ALLOWED!>return@test4<!> }
fun test4(): ()-> Unit = { <!RETURN_TYPE_MISMATCH, RETURN_NOT_ALLOWED!>return@test4<!> }
fun test5(): Any = @{ return@ }
fun test6(): Any = {<!RETURN_NOT_ALLOWED!>return 1<!>}
@@ -21,13 +21,13 @@ fun bbb() {
fun foo(<!UNUSED_PARAMETER!>expr<!>: StringBuilder): Int {
val c = 'a'
when(c) {
0.chr => throw Exception("zero")
else => throw Exception("nonzero" + c)
0.chr -> throw Exception("zero")
else -> throw Exception("nonzero" + c)
}
}
fun unitShort() : Unit = ()
fun unitShort() : Unit = #()
fun unitShortConv() : Unit = <!TYPE_MISMATCH!>1<!>
fun unitShortNull() : Unit = <!TYPE_MISMATCH!>null<!>
@@ -44,7 +44,7 @@ fun intFunctionLiteral(): Int = <!TYPE_MISMATCH!>{ 10 }<!>
fun blockReturnUnitMismatch() : Int {<!RETURN_TYPE_MISMATCH!>return<!>}
fun blockReturnValueTypeMismatch() : Int {return <!ERROR_COMPILE_TIME_VALUE!>3.4<!>}
fun blockReturnValueTypeMatch() : Int {return 1}
fun blockReturnValueTypeMismatchUnit() : Int {return <!TYPE_MISMATCH!>()<!>}
fun blockReturnValueTypeMismatchUnit() : Int {return <!TYPE_MISMATCH!>#()<!>}
fun blockAndAndMismatch() : Int {
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>true && false<!>
@@ -176,37 +176,37 @@ class B() {
}
fun testFunctionLiterals() {
val <!UNUSED_VARIABLE!>endsWithVarDeclaration<!> : fun() : Boolean = {
val <!UNUSED_VARIABLE!>endsWithVarDeclaration<!> : () -> Boolean = {
<!EXPECTED_TYPE_MISMATCH!>val x = 2<!>
}
val <!UNUSED_VARIABLE!>endsWithAssignment<!> = { () : Int =>
val <!UNUSED_VARIABLE!>endsWithAssignment<!> = { () : Int ->
var x = 1
<!EXPECTED_TYPE_MISMATCH!>x = 333<!>
}
val <!UNUSED_VARIABLE!>endsWithReAssignment<!> = { () : Int =>
val <!UNUSED_VARIABLE!>endsWithReAssignment<!> = { () : Int ->
var x = 1
<!ASSIGNMENT_TYPE_MISMATCH!>x += 333<!>
}
val <!UNUSED_VARIABLE!>endsWithFunDeclaration<!> : fun() : String = {
val <!UNUSED_VARIABLE!>endsWithFunDeclaration<!> : () -> String = {
var x = 1
x = 333
<!EXPECTED_TYPE_MISMATCH!>fun meow() : Unit {}<!>
}
val <!UNUSED_VARIABLE!>endsWithObjectDeclaration<!> : fun() : Int = {
val <!UNUSED_VARIABLE!>endsWithObjectDeclaration<!> : () -> Int = {
var x = 1
x = 333
<!EXPECTED_TYPE_MISMATCH!>object A {}<!>
}
val <!UNUSED_VARIABLE!>expectedUnitReturnType1<!> = { () : Unit =>
val <!UNUSED_VARIABLE!>expectedUnitReturnType1<!> = { () : Unit ->
val x = 1
}
val <!UNUSED_VARIABLE!>expectedUnitReturnType2<!> = { () : Unit =>
val <!UNUSED_VARIABLE!>expectedUnitReturnType2<!> = { () : Unit ->
fun meow() : Unit {}
object A {}
}
@@ -13,28 +13,28 @@ trait BB1 : BA1<Int> {}
trait BB2 : <!INCONSISTENT_TYPE_PARAMETER_VALUES!>BA1<Any>, BB1<!> {}
namespace x {
package x {
trait AA1<out T> {}
trait AB1 : AA1<Int> {}
trait AB3 : AA1<Comparable<Int>> {}
trait AB2 : AA1<Number>, AB1, AB3 {}
}
namespace x2 {
package x2 {
trait AA1<out T> {}
trait AB1 : AA1<Any> {}
trait AB3 : AA1<Comparable<Int>> {}
trait AB2 : <!INCONSISTENT_TYPE_PARAMETER_VALUES!>AA1<Number>, AB1, AB3<!> {}
}
namespace x3 {
package x3 {
trait AA1<in T> {}
trait AB1 : AA1<Any> {}
trait AB3 : AA1<Comparable<Int>> {}
trait AB2 : AA1<Number>, AB1, AB3 {}
}
namespace sx2 {
package sx2 {
trait AA1<in T> {}
trait AB1 : AA1<Int> {}
trait AB3 : AA1<Comparable<Int>> {}
@@ -1,4 +1,4 @@
namespace illegal_modifiers
package illegal_modifiers
abstract class A() {
<!INCOMPATIBLE_MODIFIERS!>abstract<!> <!INCOMPATIBLE_MODIFIERS!>final<!> fun f()
@@ -1,22 +1,22 @@
// KT-355 Resolve imports after all symbols are built
namespace a {
package a {
import b.*
val x : X = X()
}
namespace b {
package b {
class X() {
}
}
namespace c {
package c {
import d.X
val x : X = X()
}
namespace d {
package d {
class X() {
}
@@ -1,4 +1,4 @@
namespace lvalue_assignment
package lvalue_assignment
open class B() {
var b: Int = 2
@@ -38,7 +38,7 @@ class D() {
fun cannotBe(var <!UNUSED_PARAMETER!>i<!>: Int) {
<!UNRESOLVED_REFERENCE!>z<!> = 30;
<!VARIABLE_EXPECTED!>()<!> = ();
<!VARIABLE_EXPECTED!>#()<!> = #();
(<!VARIABLE_EXPECTED!>i <!USELESS_CAST!>as<!> Int<!>) = 34
(<!VARIABLE_EXPECTED!>i is Int<!>) = false
@@ -2,7 +2,7 @@
// KT-689 Allow to put Java and Kotlin files in the same packages
// This is a stub test. One should not extend Java packages that come from libraries.
namespace java
package java
val c : lang.Class<*>? = null
@@ -1,4 +1,4 @@
namespace Jet87
package Jet87
open class A() {
fun foo() : Int = 1
@@ -1,8 +1,8 @@
namespace root
package root
namespace a {
package a {
}
val x = <!EXPRESSION_EXPECTED_NAMESPACE_FOUND!>a<!>
val y2 = <!NAMESPACE_IS_NOT_AN_EXPRESSION!>namespace<!>
val y2 = <!NAMESPACE_IS_NOT_AN_EXPRESSION!>package<!>
@@ -1,6 +1,6 @@
// +JDK
namespace foo
package foo
class X {}
@@ -1,8 +1,8 @@
// +JDK
namespace foobar
package foobar
namespace a {
package a {
import java.*
val a : util.List<Int>? = null
@@ -14,7 +14,7 @@ abstract class Foo<T>() {
abstract val x : T<Int>
}
namespace a {
package a {
import java.util.*
val b : List<Int>? = a
@@ -40,28 +40,28 @@ fun test() {
out.println();
}
if (out == null || out.println(0) == ()) {
if (out == null || out.println(0) == #()) {
out?.println(1)
}
else {
out.println(2)
}
if (out != null && out.println() == ()) {
if (out != null && out.println() == #()) {
out.println();
}
else {
out?.println();
}
if (out == null || out != null && out.println() == ()) {
if (out == null || out != null && out.println() == #()) {
out?.println();
}
else {
out.println();
}
if (1 == 2 || out != null && out.println(1) == ()) {
if (1 == 2 || out != null && out.println(1) == #()) {
out?.println(2);
}
else {
@@ -96,28 +96,28 @@ fun test() {
out.println();
}
if (out == null || out.println(0) == ()) {
if (out == null || out.println(0) == #()) {
out?.println(1)
}
else {
out.println(2)
}
if (out != null && out.println() == ()) {
if (out != null && out.println() == #()) {
out.println();
}
else {
out?.println();
}
if (out == null || out != null && out.println() == ()) {
if (out == null || out != null && out.println() == #()) {
out?.println();
}
else {
out.println();
}
if (1 == 2 || out != null && out.println(1) == ()) {
if (1 == 2 || out != null && out.println(1) == #()) {
out?.println(2);
}
else {
@@ -1,4 +1,4 @@
namespace toplevelObjectDeclarations {
package toplevelObjectDeclarations {
open class Foo(y : Int) {
open fun foo() : Int = 1
}
@@ -28,7 +28,7 @@ namespace toplevelObjectDeclarations {
val z = y.foo()
}
namespace nestedObejcts {
package nestedObejcts {
object A {
val b = B
val d = A.B.A
@@ -58,7 +58,7 @@ namespace nestedObejcts {
val e = B.<!UNRESOLVED_REFERENCE!>A<!>.B
}
namespace localObjects {
package localObjects {
object A {
val x : Int = 0
}
@@ -1,6 +1,6 @@
namespace override
package override
namespace normal {
package normal {
trait MyTrait {
fun foo()
val pr : Unit
@@ -16,8 +16,8 @@ namespace normal {
override fun foo() {}
override fun bar() {}
override val pr : Unit = ()
override val prr : Unit = ()
override val pr : Unit = #()
override val prr : Unit = #()
}
class MyChildClass() : MyClass() {}
@@ -26,14 +26,14 @@ namespace normal {
class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass2<!>() : MyTrait, MyAbstractClass {
override fun foo() {}
override val pr : Unit = ()
override val prr : Unit = ()
override val pr : Unit = #()
override val prr : Unit = #()
}
class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass3<!>() : MyTrait, MyAbstractClass {
override fun bar() {}
override val pr : Unit = ()
override val prr : Unit = ()
override val pr : Unit = #()
override val prr : Unit = #()
}
class <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>MyIllegalClass4<!>() : MyTrait, MyAbstractClass {
@@ -45,13 +45,13 @@ namespace normal {
class MyChildClass1() : MyClass() {
fun <!VIRTUAL_MEMBER_HIDDEN!>foo<!>() {}
val <!VIRTUAL_MEMBER_HIDDEN!>pr<!> : Unit = ()
val <!VIRTUAL_MEMBER_HIDDEN!>pr<!> : Unit = #()
override fun bar() {}
override val prr : Unit = ()
override val prr : Unit = #()
}
}
namespace generics {
package generics {
trait MyTrait<T> {
fun foo(t: T) : T
}
@@ -1,4 +1,4 @@
namespace qualified_expressions
package qualified_expressions
fun test(s: String?) {
val <!UNUSED_VARIABLE!>a<!>: Int = <!TYPE_MISMATCH!>s?.length<!>
@@ -21,7 +21,7 @@ fun foo1() : Unit {
this<!UNRESOLVED_REFERENCE!>@a<!>
}
namespace closures {
package closures {
class A(val a:Int) {
class B() {
@@ -31,10 +31,10 @@ namespace closures {
val Int.xx = this : Int
fun Char.xx() : Any {
this : Char
val <!UNUSED_VARIABLE!>a<!> = {Double.() => this : Double + this@xx : Char}
val <!UNUSED_VARIABLE!>b<!> = @a{Double.() => this@a : Double + this@xx : Char}
val <!UNUSED_VARIABLE!>c<!> = @a{() => <!NO_THIS!>this@a<!> + this@xx : Char}
return (@a{Double.() => this@a : Double + this@xx : Char})
val <!UNUSED_VARIABLE!>a<!> = {Double.() -> this : Double + this@xx : Char}
val <!UNUSED_VARIABLE!>b<!> = @a{Double.() -> this@a : Double + this@xx : Char}
val <!UNUSED_VARIABLE!>c<!> = @a{() -> <!NO_THIS!>this@a<!> + this@xx : Char}
return (@a{Double.() -> this@a : Double + this@xx : Char})
}
}
}
@@ -1,16 +1,16 @@
namespace a {
package a {
val foo = bar()
fun bar() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>foo<!>
}
namespace b {
package b {
fun foo() = bar()
fun bar() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>foo()<!>
}
namespace c {
package c {
fun bazz() = bar()
fun foo() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>bazz()<!>
@@ -18,21 +18,21 @@ namespace c {
fun bar() = foo()
}
namespace ok {
package ok {
namespace a {
package a {
val foo = bar()
fun bar() : Int = foo
}
namespace b {
package b {
fun foo() : Int = bar()
fun bar() = foo()
}
namespace c {
package c {
fun bazz() = bar()
fun foo() : Int = bazz()
@@ -1,11 +1,11 @@
namespace redeclarations {
package redeclarations {
object <!REDECLARATION, REDECLARATION!>A<!> {
val x : Int = 0
val A = 1
}
namespace <!REDECLARATION!>A<!> {
package <!REDECLARATION!>A<!> {
class A {}
}
@@ -49,6 +49,6 @@ fun test(<!UNUSED_PARAMETER!>l<!> : java.util.List<Int>) {
}
namespace xxx {
package xxx {
import java.lang.Class;
}
@@ -1,4 +1,4 @@
namespace <!SYNTAX!>return<!>
package <!SYNTAX!>return<!>
class A {
fun outer() {
@@ -0,0 +1,51 @@
class A {
}
package n {
class B
}
abstract class XXX() {
abstract val a : Int
abstract val a1 : package.<!UNRESOLVED_REFERENCE!>Int<!>
abstract val a2 : n.B
abstract val a3 : (A)
abstract val a31 : (n.B)
abstract val a4 : A?
abstract val a5 : (A)?
abstract val a6 : (A?)
abstract val a7 : (A) -> n.B
abstract val a8 : (A, n.B) -> n.B
//val a9 : (A, B)
//val a10 : (B)? -> B
val a11 : ((Int) -> Int)? = null
val a12 : ((Int) -> (Int))? = null
abstract val a13 : Int.(Int) -> Int
abstract val a14 : n.B.(Int) -> Int
abstract val a15 : Int? .(Int) -> Int
abstract val a152 : (Int?).(Int) -> Int
// abstract val a151 : Int?.(Int) -> Int
abstract val a16 : (Int) -> (Int) -> Int
abstract val a17 : ((Int) -> Int).(Int) -> Int
abstract val a18 : (Int) -> ((Int) -> Int)
abstract val a19 : ((Int) -> Int) -> Int
}
abstract class YYY() {
abstract val a7 : (a : A) -> n.B
abstract val a8 : (a : A, b : n.B) -> n.B
//val a9 : (A, B)
//val a10 : (B)? -> B
val a11 : ((a : Int) -> Int)? = null
val a12 : ((a : Int) -> (Int))? = null
abstract val a13 : Int.(a : Int) -> Int
abstract val a14 : n.B.(a : Int) -> Int
abstract val a15 : Int? .(a : Int) -> Int
abstract val a152 : (Int?).(a : Int) -> Int
//abstract val a151 : Int?.(a : Int) -> Int
abstract val a16 : (a : Int) -> (a : Int) -> Int
abstract val a17 : ((a : Int) -> Int).(a : Int) -> Int
abstract val a18 : (a : Int) -> ((a : Int) -> Int)
abstract val a19 : (b : (a : Int) -> Int) -> Int
}
@@ -3,8 +3,8 @@ fun demo() {
val a = ""
val asd = 1
val bar = 5
fun map(f : fun () : Any?) : Int = 1
fun buzz(f : fun () : Any?) : Int = 1
fun map(f : () -> Any?) : Int = 1
fun buzz(f : () -> Any?) : Int = 1
val sdf = 1
val foo = 3;
"$abc"
@@ -1,4 +1,4 @@
namespace example;
package example;
fun any(<!UNUSED_PARAMETER!>a<!> : Any) {}
@@ -7,7 +7,7 @@ fun notAnExpression() {
if (<!SUPER_IS_NOT_AN_EXPRESSION!>super<!>) {} else {} // not an expression
val <!UNUSED_VARIABLE!>x<!> = <!SUPER_IS_NOT_AN_EXPRESSION!>super<!> // not an expression
when (1) {
<!SUPER_IS_NOT_AN_EXPRESSION!>super<!> => 1 // not an expression
<!SUPER_IS_NOT_AN_EXPRESSION!>super<!> -> 1 // not an expression
}
}
@@ -33,8 +33,8 @@ class A<E>() : C(), T {
super<<!NOT_A_SUPERTYPE!>E<!>>@A.bar()
super<<!NOT_A_SUPERTYPE!>Int<!>>.foo()
super<<!SYNTAX!><!>>.foo()
super<<!NOT_A_SUPERTYPE!>fun() : Unit<!>>.foo()
super<<!NOT_A_SUPERTYPE!>()<!>>.foo()
super<<!NOT_A_SUPERTYPE!>() -> Unit<!>>.foo()
super<<!NOT_A_SUPERTYPE!>#()<!>>.foo()
super<T><!UNRESOLVED_REFERENCE!>@B<!>.foo()
super<C><!UNRESOLVED_REFERENCE!>@B<!>.bar()
}
@@ -1,4 +1,4 @@
namespace uninitialized_reassigned_variables
package uninitialized_reassigned_variables
fun doSmth(<!UNUSED_PARAMETER!>s<!>: String) {}
fun doSmth(<!UNUSED_PARAMETER!>i<!>: Int) {}
@@ -1,3 +1,3 @@
fun foo(f : fun()) {
fun foo(f : () -> Unit) {
val <!UNUSED_VARIABLE!>x<!> : Unit = f()
}
@@ -1,8 +1,8 @@
namespace unresolved
package unresolved
fun testGenericArgumentsCount() {
val <!UNUSED_VARIABLE!>p1<!>: Tuple2<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!> = (2, 2)
val <!UNUSED_VARIABLE!>p2<!>: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Tuple2<!> = (2, 2)
val <!UNUSED_VARIABLE!>p1<!>: Tuple2<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!> = #(2, 2)
val <!UNUSED_VARIABLE!>p2<!>: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Tuple2<!> = #(2, 2)
}
fun testUnresolved() {
@@ -16,8 +16,8 @@ fun testUnresolved() {
s.<!UNRESOLVED_REFERENCE!>foo<!>()
when(<!UNRESOLVED_REFERENCE!>a<!>) {
is Int => <!UNRESOLVED_REFERENCE!>a<!>
is String => <!UNRESOLVED_REFERENCE!>a<!>
is Int -> <!UNRESOLVED_REFERENCE!>a<!>
is String -> <!UNRESOLVED_REFERENCE!>a<!>
}
//TODO
@@ -1,4 +1,4 @@
namespace unused_variables
package unused_variables
fun testSimpleCases() {
var i = <!VARIABLE_WITH_REDUNDANT_INITIALIZER!>2<!>
@@ -103,11 +103,11 @@ fun testInnerFunctions() {
fun testFunctionLiterals() {
var x = 1
var <!UNUSED_VARIABLE!>fl<!> = { (): Int =>
var <!UNUSED_VARIABLE!>fl<!> = { (): Int ->
x
}
var y = 2
var <!UNUSED_VARIABLE!>fl1<!> = { (): Unit =>
var <!UNUSED_VARIABLE!>fl1<!> = { (): Unit ->
doSmth(y)
}
}
@@ -1,5 +1,5 @@
fun v(<!UNUSED_PARAMETER!>x<!> : Int, <!UNUSED_PARAMETER!>y<!> : String, vararg <!UNUSED_PARAMETER!>f<!> : Long) {}
fun v1(vararg <!UNUSED_PARAMETER!>f<!> : fun (Int) : Unit) {}
fun v1(vararg <!UNUSED_PARAMETER!>f<!> : (Int) -> Unit) {}
fun test() {
v(1, "")

Some files were not shown because too many files have changed in this diff Show More