GreatSyntacticShift: Checker test data fixed
This commit is contained in:
@@ -18,9 +18,9 @@ namespace boundsWithSubstitutors {
|
|||||||
open class A {}
|
open class A {}
|
||||||
open class B<T : A>()
|
open class B<T : A>()
|
||||||
|
|
||||||
abstract class C<T : B<<error>Int</error>>, X : fun (B<<error>Char</error>>) : (B<<error>Any</error>>, B<A>)>() : B<<error>Any</error>>() { // 2 errors
|
abstract class C<T : B<<error>Int</error>>, X : (B<<error>Char</error>>) -> #(B<<error>Any</error>>, B<A>)>() : B<<error>Any</error>>() { // 2 errors
|
||||||
val a = B<<error>Char</error>>() // error
|
val a = B<<error>Char</error>>() // error
|
||||||
|
|
||||||
abstract val x : fun (B<<error>Char</error>>) : B<<error>Any</error>>
|
abstract val x : (B<<error>Char</error>>) -> B<<error>Any</error>>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
namespace html {
|
package html {
|
||||||
|
|
||||||
abstract class Factory<T> {
|
abstract class Factory<T> {
|
||||||
abstract fun create() : T
|
abstract fun create() : T
|
||||||
@@ -14,7 +14,7 @@ namespace html {
|
|||||||
val children = ArrayList<Element>()
|
val children = ArrayList<Element>()
|
||||||
val attributes = HashMap<String, String>()
|
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>{
|
where class object T : Factory<T>{
|
||||||
val tag = T.create()
|
val tag = T.create()
|
||||||
tag.init()
|
tag.init()
|
||||||
@@ -34,9 +34,9 @@ namespace html {
|
|||||||
override fun create() = 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") {
|
class Head() : TagWithText("head") {
|
||||||
@@ -44,7 +44,7 @@ namespace html {
|
|||||||
override fun create() = Head()
|
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")
|
class Title() : TagWithText("title")
|
||||||
@@ -57,10 +57,10 @@ namespace html {
|
|||||||
override fun create() = Body()
|
override fun create() = Body()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun b(init : fun B.() : Unit) = initTag<B>(init)
|
fun b(init : B.() -> Unit) = initTag<B>(init)
|
||||||
fun p(init : fun P.() : Unit) = initTag<P>(init)
|
fun p(init : P.() -> Unit) = initTag<P>(init)
|
||||||
fun h1(init : fun H1.() : Unit) = initTag<H1>(init)
|
fun h1(init : H1.() -> Unit) = initTag<H1>(init)
|
||||||
fun a(href : String, init : fun A.() : Unit) {
|
fun a(href : String, init : A.() -> Unit) {
|
||||||
val a = initTag<A>(init)
|
val a = initTag<A>(init)
|
||||||
a.href = href
|
a.href = href
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ namespace html {
|
|||||||
|
|
||||||
fun Map<String, String>.set(key : String, value : String) = this.put(key, value)
|
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()
|
val html = HTML()
|
||||||
html.init()
|
html.init()
|
||||||
return html
|
return html
|
||||||
@@ -85,7 +85,7 @@ namespace html {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace foo {
|
package foo {
|
||||||
|
|
||||||
import html.*
|
import html.*
|
||||||
|
|
||||||
|
|||||||
@@ -12,5 +12,5 @@ fun test() : Unit {
|
|||||||
y <warning>as?</warning> Int : Int?
|
y <warning>as?</warning> Int : Int?
|
||||||
x <warning>as?</warning> Int? : Int?
|
x <warning>as?</warning> Int? : Int?
|
||||||
y <warning>as?</warning> Int? : Int?
|
y <warning>as?</warning> Int? : Int?
|
||||||
()
|
#()
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fun Int?.optint() : Unit {}
|
fun Int?.optint() : Unit {}
|
||||||
val Int?.optval : Unit = ()
|
val Int?.optval : Unit = #()
|
||||||
|
|
||||||
fun <T, E> T.foo(<warning>x</warning> : E, y : A) : T {
|
fun <T, E> T.foo(<warning>x</warning> : E, y : A) : T {
|
||||||
y.plus(1)
|
y.plus(1)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ fun unitEmptyInfer() {}
|
|||||||
fun unitEmpty() : Unit {}
|
fun unitEmpty() : Unit {}
|
||||||
fun unitEmptyReturn() : Unit {return}
|
fun unitEmptyReturn() : Unit {return}
|
||||||
fun unitIntReturn() : Unit {return <error>1</error>}
|
fun unitIntReturn() : Unit {return <error>1</error>}
|
||||||
fun unitUnitReturn() : Unit {return ()}
|
fun unitUnitReturn() : Unit {return #()}
|
||||||
fun test1() : Any = { <error>return</error> }
|
fun test1() : Any = { <error>return</error> }
|
||||||
fun test2() : Any = @a {return@a 1}
|
fun test2() : Any = @a {return@a 1}
|
||||||
fun test3() : Any { <error>return</error> }
|
fun test3() : Any { <error>return</error> }
|
||||||
@@ -16,13 +16,13 @@ fun bbb() {
|
|||||||
fun foo(<warning>expr</warning>: StringBuilder): Int {
|
fun foo(<warning>expr</warning>: StringBuilder): Int {
|
||||||
val c = 'a'
|
val c = 'a'
|
||||||
when(c) {
|
when(c) {
|
||||||
0.chr => throw Exception("zero")
|
0.chr -> throw Exception("zero")
|
||||||
else => throw Exception("nonzero" + c)
|
else -> throw Exception("nonzero" + c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun unitShort() : Unit = ()
|
fun unitShort() : Unit = #()
|
||||||
fun unitShortConv() : Unit = <error>1</error>
|
fun unitShortConv() : Unit = <error>1</error>
|
||||||
fun unitShortNull() : Unit = <error>null</error>
|
fun unitShortNull() : Unit = <error>null</error>
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ fun intFunctionLiteral(): Int = <error>{ 10 }</error>
|
|||||||
fun blockReturnUnitMismatch() : Int {<error>return</error>}
|
fun blockReturnUnitMismatch() : Int {<error>return</error>}
|
||||||
fun blockReturnValueTypeMismatch() : Int {return <error>3.4</error>}
|
fun blockReturnValueTypeMismatch() : Int {return <error>3.4</error>}
|
||||||
fun blockReturnValueTypeMatch() : Int {return 1}
|
fun blockReturnValueTypeMatch() : Int {return 1}
|
||||||
fun blockReturnValueTypeMismatchUnit() : Int {return <error>()</error>}
|
fun blockReturnValueTypeMismatchUnit() : Int {return <error>#()</error>}
|
||||||
|
|
||||||
fun blockAndAndMismatch() : Int {
|
fun blockAndAndMismatch() : Int {
|
||||||
<error>true && false</error>
|
<error>true && false</error>
|
||||||
|
|||||||
@@ -38,28 +38,28 @@ fun test() {
|
|||||||
out.println();
|
out.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out == null || out.println(0) == ()) {
|
if (out == null || out.println(0) == #()) {
|
||||||
out?.println(1)
|
out?.println(1)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
out.println(2)
|
out.println(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out != null && out.println() == ()) {
|
if (out != null && out.println() == #()) {
|
||||||
out.println();
|
out.println();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
out?.println();
|
out?.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out == null || out != null && out.println() == ()) {
|
if (out == null || out != null && out.println() == #()) {
|
||||||
out?.println();
|
out?.println();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
out.println();
|
out.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 == 2 || out != null && out.println(1) == ()) {
|
if (1 == 2 || out != null && out.println(1) == #()) {
|
||||||
out?.println(2);
|
out?.println(2);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -94,28 +94,28 @@ fun test() {
|
|||||||
out.println();
|
out.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out == null || out.println(0) == ()) {
|
if (out == null || out.println(0) == #()) {
|
||||||
out?.println(1)
|
out?.println(1)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
out.println(2)
|
out.println(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out != null && out.println() == ()) {
|
if (out != null && out.println() == #()) {
|
||||||
out.println();
|
out.println();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
out?.println();
|
out?.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out == null || out != null && out.println() == ()) {
|
if (out == null || out != null && out.println() == #()) {
|
||||||
out?.println();
|
out?.println();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
out.println();
|
out.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 == 2 || out != null && out.println(1) == ()) {
|
if (1 == 2 || out != null && out.println(1) == #()) {
|
||||||
out?.println(2);
|
out?.println(2);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ namespace closures {
|
|||||||
val Int.xx = this : Int
|
val Int.xx = this : Int
|
||||||
fun Char.xx() : Any {
|
fun Char.xx() : Any {
|
||||||
this : Char
|
this : Char
|
||||||
val <warning>a</warning> = {Double.() => this : Double + this@xx : Char}
|
val <warning>a</warning> = {Double.() -> this : Double + this@xx : Char}
|
||||||
val <warning>b</warning> = @a{Double.() => this@a : Double + this@xx : Char}
|
val <warning>b</warning> = @a{Double.() -> this@a : Double + this@xx : Char}
|
||||||
val <warning>c</warning> = @a{() => <error>this@a</error> + this@xx : Char}
|
val <warning>c</warning> = @a{() -> <error>this@a</error> + this@xx : Char}
|
||||||
return (@a{Double.() => this@a : Double + this@xx : Char})
|
return (@a{Double.() -> this@a : Double + this@xx : Char})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
namespace a {
|
package a {
|
||||||
val foo = bar()
|
val foo = bar()
|
||||||
|
|
||||||
fun bar() = <error descr="[TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM] Type checking has run into a recursive problem">foo</error>
|
fun bar() = <error descr="[TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM] Type checking has run into a recursive problem">foo</error>
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace b {
|
package b {
|
||||||
fun foo() = bar()
|
fun foo() = bar()
|
||||||
|
|
||||||
fun bar() = <error descr="[TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM] Type checking has run into a recursive problem">foo()</error>
|
fun bar() = <error descr="[TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM] Type checking has run into a recursive problem">foo()</error>
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace c {
|
package c {
|
||||||
fun bazz() = bar()
|
fun bazz() = bar()
|
||||||
|
|
||||||
fun foo() = <error descr="[TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM] Type checking has run into a recursive problem">bazz()</error>
|
fun foo() = <error descr="[TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM] Type checking has run into a recursive problem">bazz()</error>
|
||||||
@@ -18,21 +18,21 @@ namespace c {
|
|||||||
fun bar() = foo()
|
fun bar() = foo()
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ok {
|
package ok {
|
||||||
|
|
||||||
namespace a {
|
package a {
|
||||||
val foo = bar()
|
val foo = bar()
|
||||||
|
|
||||||
fun bar() : Int = foo
|
fun bar() : Int = foo
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace b {
|
package b {
|
||||||
fun foo() : Int = bar()
|
fun foo() : Int = bar()
|
||||||
|
|
||||||
fun bar() = foo()
|
fun bar() = foo()
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace c {
|
package c {
|
||||||
fun bazz() = bar()
|
fun bazz() = bar()
|
||||||
|
|
||||||
fun foo() : Int = bazz()
|
fun foo() : Int = bazz()
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ fun demo() {
|
|||||||
val a = ""
|
val a = ""
|
||||||
val asd = 1
|
val asd = 1
|
||||||
val bar = 5
|
val bar = 5
|
||||||
fun map(f : fun () : Any?) : Int = 1
|
fun map(f : () -> Any?) : Int = 1
|
||||||
fun buzz(f : fun () : Any?) : Int = 1
|
fun buzz(f : () -> Any?) : Int = 1
|
||||||
val sdf = 1
|
val sdf = 1
|
||||||
val foo = 3;
|
val foo = 3;
|
||||||
"$abc"
|
"$abc"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
namespace unresolved
|
package unresolved
|
||||||
|
|
||||||
fun testGenericArgumentsCount() {
|
fun testGenericArgumentsCount() {
|
||||||
val <warning>p1</warning>: Tuple2<error><Int></error> = (2, 2)
|
val <warning>p1</warning>: Tuple2<error><Int></error> = #(2, 2)
|
||||||
val <warning>p2</warning>: <error>Tuple2</error> = (2, 2)
|
val <warning>p2</warning>: <error>Tuple2</error> = #(2, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testUnresolved() {
|
fun testUnresolved() {
|
||||||
@@ -16,8 +16,8 @@ fun testUnresolved() {
|
|||||||
s.<error>foo</error>()
|
s.<error>foo</error>()
|
||||||
|
|
||||||
when(<error>a</error>) {
|
when(<error>a</error>) {
|
||||||
is Int => <error>a</error>
|
is Int -> <error>a</error>
|
||||||
is String => <error>a</error>
|
is String -> <error>a</error>
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
|||||||
@@ -4,25 +4,25 @@ fun foo() : Int {
|
|||||||
val s = ""
|
val s = ""
|
||||||
val x = 1
|
val x = 1
|
||||||
when (x) {
|
when (x) {
|
||||||
is * => 1
|
is * -> 1
|
||||||
is <error>String</error> => 1
|
is <error>String</error> -> 1
|
||||||
!is Int => 1
|
!is Int -> 1
|
||||||
is Any? => 1
|
is Any? -> 1
|
||||||
<error>s</error> => 1
|
<error>s</error> -> 1
|
||||||
1 => 1
|
1 -> 1
|
||||||
1 + <error>a</error> => 1
|
1 + <error>a</error> -> 1
|
||||||
in 1..<error>a</error> => 1
|
in 1..<error>a</error> -> 1
|
||||||
!in 1..<error>a</error> => 1
|
!in 1..<error>a</error> -> 1
|
||||||
// Commented for KT-621 .<!error>a</!error> => 1
|
// Commented for KT-621 .<!error>a</!error> -> 1
|
||||||
// Commented for KT-621 .equals(1).<!error>a</!error> => 1
|
// Commented for KT-621 .equals(1).<!error>a</!error> -> 1
|
||||||
// Commented for KT-621 <!warning>?.</!warning>equals(1) => 1
|
// Commented for KT-621 <!warning>?.</!warning>equals(1) -> 1
|
||||||
else => 1
|
else -> 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commented for KT-621
|
// Commented for KT-621
|
||||||
// return when (<!warning>x</!warning>?:null) {
|
// return when (<!warning>x</!warning>?:null) {
|
||||||
// <!error>.</!error>foo() => 1
|
// <!error>.</!error>foo() -> 1
|
||||||
// ?.equals(1).equals(2) => 1
|
// ?.equals(1).equals(2) -> 1
|
||||||
// }
|
// }
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -34,33 +34,33 @@ fun test() {
|
|||||||
val s = "";
|
val s = "";
|
||||||
|
|
||||||
when (x) {
|
when (x) {
|
||||||
<error>s</error> => 1
|
<error>s</error> -> 1
|
||||||
is <error>""</error> => 1
|
is <error>""</error> -> 1
|
||||||
x => 1
|
x -> 1
|
||||||
is 1 => 1
|
is 1 -> 1
|
||||||
is <error>(1, 1)</error> => 1
|
is <error>#(1, 1)</error> -> 1
|
||||||
}
|
}
|
||||||
|
|
||||||
val z = (1, 1)
|
val z = #(1, 1)
|
||||||
|
|
||||||
when (z) {
|
when (z) {
|
||||||
is (*, *) => 1
|
is #(*, *) -> 1
|
||||||
is (*, 1) => 1
|
is #(*, 1) -> 1
|
||||||
is (1, 1) => 1
|
is #(1, 1) -> 1
|
||||||
is (1, <error>"1"</error>) => 1
|
is #(1, <error>"1"</error>) -> 1
|
||||||
is <error>(1, "1", *)</error> => 1
|
is <error>#(1, "1", *)</error> -> 1
|
||||||
is boo @ (1, <error>"a"</error>, *) => 1
|
is boo #(1, <error>"a"</error>, *) -> 1
|
||||||
is boo @ <error>(1, *)</error> => 1
|
is boo <error>#(1, *)</error> -> 1
|
||||||
}
|
}
|
||||||
|
|
||||||
when (z) {
|
when (z) {
|
||||||
<error>else => 1</error>
|
<error>else -> 1</error>
|
||||||
(1, 1) => 2
|
#(1, 1) -> 2
|
||||||
}
|
}
|
||||||
|
|
||||||
when (z) {
|
when (z) {
|
||||||
else => 1
|
else -> 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val (Int, Int).boo : (Int, Int, Int) = (1, 1, 1)
|
val #(Int, Int).boo : #(Int, Int, Int) = #(1, 1, 1)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ fun f9(a : A?) {
|
|||||||
a?.<error descr="Unresolved reference: bar">bar</error>()
|
a?.<error descr="Unresolved reference: bar">bar</error>()
|
||||||
a?.foo()
|
a?.foo()
|
||||||
}
|
}
|
||||||
if (!(a is B) || <info descr="Automatically cast to B">a</info>.bar() == ()) {
|
if (!(a is B) || <info descr="Automatically cast to B">a</info>.bar() == #()) {
|
||||||
a?.<error descr="Unresolved reference: bar">bar</error>()
|
a?.<error descr="Unresolved reference: bar">bar</error>()
|
||||||
}
|
}
|
||||||
if (!(a is B)) {
|
if (!(a is B)) {
|
||||||
@@ -52,24 +52,24 @@ fun f101(a : A?) {
|
|||||||
|
|
||||||
fun f11(a : A?) {
|
fun f11(a : A?) {
|
||||||
when (a) {
|
when (a) {
|
||||||
is B => <info descr="Automatically cast to B">a</info>.bar()
|
is B -> <info descr="Automatically cast to B">a</info>.bar()
|
||||||
is A => <info descr="Automatically cast to A">a</info>.foo()
|
is A -> <info descr="Automatically cast to A">a</info>.foo()
|
||||||
is Any => <info descr="Automatically cast to A">a</info>.foo()
|
is Any -> <info descr="Automatically cast to A">a</info>.foo()
|
||||||
is Any? => a.<error descr="Unresolved reference: bar">bar</error>()
|
is Any? -> a.<error descr="Unresolved reference: bar">bar</error>()
|
||||||
else => a?.foo()
|
else -> a?.foo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun f12(a : A?) {
|
fun f12(a : A?) {
|
||||||
when (a) {
|
when (a) {
|
||||||
is B => <info descr="Automatically cast to B">a</info>.bar()
|
is B -> <info descr="Automatically cast to B">a</info>.bar()
|
||||||
is A => <info descr="Automatically cast to A">a</info>.foo()
|
is A -> <info descr="Automatically cast to A">a</info>.foo()
|
||||||
is Any => <info descr="Automatically cast to A">a</info>.foo();
|
is Any -> <info descr="Automatically cast to A">a</info>.foo();
|
||||||
is Any? => a.<error descr="Unresolved reference: bar">bar</error>()
|
is Any? -> a.<error descr="Unresolved reference: bar">bar</error>()
|
||||||
is val c : <error descr="[TYPE_MISMATCH_IN_BINDING_PATTERN] B must be a supertype of A?. Use is to match against B">B</error> => c.foo()
|
is val c : <error descr="[TYPE_MISMATCH_IN_BINDING_PATTERN] B must be a supertype of A?. Use is to match against B">B</error> -> c.foo()
|
||||||
is val c is C => <info descr="Automatically cast to C">c</info>.bar()
|
is val c is C -> <info descr="Automatically cast to C">c</info>.bar()
|
||||||
is val c is C => <info descr="Automatically cast to C">a</info>.bar()
|
is val c is C -> <info descr="Automatically cast to C">a</info>.bar()
|
||||||
else => a?.foo()
|
else -> a?.foo()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a is val b) {
|
if (a is val b) {
|
||||||
@@ -104,7 +104,7 @@ fun f13(a : A?) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
a?.foo()
|
a?.foo()
|
||||||
if (a is val c is B && <info descr="Automatically cast to A">a</info>.foo() == () && <info descr="Automatically cast to B">c</info>.bar() == ()) {
|
if (a is val c is B && <info descr="Automatically cast to A">a</info>.foo() == #() && <info descr="Automatically cast to B">c</info>.bar() == #()) {
|
||||||
<info descr="Automatically cast to A">c</info>.foo()
|
<info descr="Automatically cast to A">c</info>.foo()
|
||||||
<info descr="Automatically cast to B">c</info>.bar()
|
<info descr="Automatically cast to B">c</info>.bar()
|
||||||
}
|
}
|
||||||
@@ -152,18 +152,18 @@ fun getStringLength(obj : Any) : Char? {
|
|||||||
|
|
||||||
fun toInt(i: Int?): Int = if (i != null) <info descr="Automatically cast to Int">i</info> else 0
|
fun toInt(i: Int?): Int = if (i != null) <info descr="Automatically cast to Int">i</info> else 0
|
||||||
fun illegalWhenBody(a: Any): Int = when(a) {
|
fun illegalWhenBody(a: Any): Int = when(a) {
|
||||||
is Int => <info descr="Automatically cast to Int">a</info>
|
is Int -> <info descr="Automatically cast to Int">a</info>
|
||||||
is String => <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any but Int was expected">a</error>
|
is String -> <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any but Int was expected">a</error>
|
||||||
}
|
}
|
||||||
fun illegalWhenBlock(a: Any): Int {
|
fun illegalWhenBlock(a: Any): Int {
|
||||||
when(a) {
|
when(a) {
|
||||||
is Int => return <info descr="Automatically cast to Int">a</info>
|
is Int -> return <info descr="Automatically cast to Int">a</info>
|
||||||
is String => return <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any but Int was expected">a</error>
|
is String -> return <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any but Int was expected">a</error>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fun declarations(a: Any?) {
|
fun declarations(a: Any?) {
|
||||||
if (a is String) {
|
if (a is String) {
|
||||||
val <warning>p4</warning>: (Int, String) = (2, <info descr="Automatically cast to String">a</info>)
|
val <warning>p4</warning>: #(Int, String) = #(2, <info descr="Automatically cast to String">a</info>)
|
||||||
}
|
}
|
||||||
if (a is String?) {
|
if (a is String?) {
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
@@ -184,21 +184,21 @@ fun vars(a: Any?) {
|
|||||||
}
|
}
|
||||||
fun tuples(a: Any?) {
|
fun tuples(a: Any?) {
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
val <warning>s</warning>: (Any, String) = (<info descr="Automatically cast to Any">a</info>, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but String was expected">a</error>)
|
val <warning>s</warning>: #(Any, String) = #(<info descr="Automatically cast to Any">a</info>, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but String was expected">a</error>)
|
||||||
}
|
}
|
||||||
if (a is String) {
|
if (a is String) {
|
||||||
val <warning>s</warning>: (Any, String) = (<info descr="Automatically cast to Any">a</info>, <info descr="Automatically cast to String">a</info>)
|
val <warning>s</warning>: #(Any, String) = #(<info descr="Automatically cast to Any">a</info>, <info descr="Automatically cast to String">a</info>)
|
||||||
}
|
}
|
||||||
fun illegalTupleReturnType(): (Any, String) = (<error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Any was expected">a</error>, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but String was expected">a</error>)
|
fun illegalTupleReturnType(): #(Any, String) = #(<error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Any was expected">a</error>, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but String was expected">a</error>)
|
||||||
if (a is String) {
|
if (a is String) {
|
||||||
fun legalTupleReturnType(): (Any, String) = (<info descr="Automatically cast to Any">a</info>, <info descr="Automatically cast to String">a</info>)
|
fun legalTupleReturnType(): #(Any, String) = #(<info descr="Automatically cast to Any">a</info>, <info descr="Automatically cast to String">a</info>)
|
||||||
}
|
}
|
||||||
val <warning>illegalFunctionLiteral</warning>: Function0<Int> = <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Function0<Any?> but Function0<Int> was expected">{ <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Int was expected">a</error> }</error>
|
val <warning>illegalFunctionLiteral</warning>: Function0<Int> = <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Function0<Any?> but Function0<Int> was expected">{ <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Int was expected">a</error> }</error>
|
||||||
val <warning>illegalReturnValueInFunctionLiteral</warning>: Function0<Int> = { (): Int => <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Int was expected">a</error> }
|
val <warning>illegalReturnValueInFunctionLiteral</warning>: Function0<Int> = { (): Int -> <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any? but Int was expected">a</error> }
|
||||||
|
|
||||||
if (a is Int) {
|
if (a is Int) {
|
||||||
val <warning>legalFunctionLiteral</warning>: Function0<Int> = { <info descr="Automatically cast to Int">a</info> }
|
val <warning>legalFunctionLiteral</warning>: Function0<Int> = { <info descr="Automatically cast to Int">a</info> }
|
||||||
val <warning>alsoLegalFunctionLiteral</warning>: Function0<Int> = { (): Int => <info descr="Automatically cast to Int">a</info> }
|
val <warning>alsoLegalFunctionLiteral</warning>: Function0<Int> = { (): Int -> <info descr="Automatically cast to Int">a</info> }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fun returnFunctionLiteralBlock(a: Any?): Function0<Int> {
|
fun returnFunctionLiteralBlock(a: Any?): Function0<Int> {
|
||||||
@@ -206,12 +206,12 @@ fun returnFunctionLiteralBlock(a: Any?): Function0<Int> {
|
|||||||
else return { 1 }
|
else return { 1 }
|
||||||
}
|
}
|
||||||
fun returnFunctionLiteral(a: Any?): Function0<Int> =
|
fun returnFunctionLiteral(a: Any?): Function0<Int> =
|
||||||
if (a is Int) { (): Int => <info descr="Automatically cast to Int">a</info> }
|
if (a is Int) { (): Int -> <info descr="Automatically cast to Int">a</info> }
|
||||||
else { () => 1 }
|
else { () -> 1 }
|
||||||
|
|
||||||
fun illegalTupleReturnType(a: Any): (Any, String) = (a, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any but String was expected">a</error>)
|
fun illegalTupleReturnType(a: Any): #(Any, String) = #(a, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is Any but String was expected">a</error>)
|
||||||
|
|
||||||
fun declarationInsidePattern(x: (Any, Any)): String = when(x) { is (val a is String, *) => <info descr="Automatically cast to String">a</info>; else => "something" }
|
fun declarationInsidePattern(x: #(Any, Any)): String = when(x) { is #(val a is String, *) -> <info descr="Automatically cast to String">a</info>; else -> "something" }
|
||||||
|
|
||||||
fun mergeAutocasts(a: Any?) {
|
fun mergeAutocasts(a: Any?) {
|
||||||
if (a is String || a is Int) {
|
if (a is String || a is Int) {
|
||||||
@@ -222,7 +222,7 @@ fun mergeAutocasts(a: Any?) {
|
|||||||
a.<error descr="Unresolved reference: compareTo">compareTo</error>("")
|
a.<error descr="Unresolved reference: compareTo">compareTo</error>("")
|
||||||
}
|
}
|
||||||
when (a) {
|
when (a) {
|
||||||
is String, is Any => a.<error descr="Unresolved reference: compareTo">compareTo</error>("")
|
is String, is Any -> a.<error descr="Unresolved reference: compareTo">compareTo</error>("")
|
||||||
}
|
}
|
||||||
if (a is String && a is Any) {
|
if (a is String && a is Any) {
|
||||||
val <warning>i</warning>: Int = <info descr="Automatically cast to String">a</info>.compareTo("")
|
val <warning>i</warning>: Int = <info descr="Automatically cast to String">a</info>.compareTo("")
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ fun foo(<warning>u</warning> : Unit) : Int = 1
|
|||||||
|
|
||||||
fun test() : Int {
|
fun test() : Int {
|
||||||
foo(<error>1</error>)
|
foo(<error>1</error>)
|
||||||
val <warning>a</warning> : fun() : Unit = {
|
val <warning>a</warning> : () -> Unit = {
|
||||||
foo(<error>1</error>)
|
foo(<error>1</error>)
|
||||||
}
|
}
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace jet121 {
|
package jet121 {
|
||||||
fun box() : String {
|
fun box() : String {
|
||||||
val answer = apply("OK") { String.() : Int =>
|
val answer = apply("OK") { String.() : Int ->
|
||||||
get(0)
|
get(0)
|
||||||
length
|
length
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ namespace jet121 {
|
|||||||
return if (answer == 2) "OK" else "FAIL"
|
return if (answer == 2) "OK" else "FAIL"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun apply(arg:String, f : fun String.() : Int) : Int {
|
fun apply(arg:String, f : String.() -> Int) : Int {
|
||||||
return arg.f()
|
return arg.f()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
fun foo1() : fun (Int) : Int = { (x: Int) => x }
|
fun foo1() : (Int) -> Int = { (x: Int) -> x }
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val h : fun (Int) : Int = foo1();
|
val h : (Int) -> Int = foo1();
|
||||||
h(1)
|
h(1)
|
||||||
val m : fun (Int) : Int = {(a : Int) => 1}//foo1()
|
val m : (Int) -> Int = {(a : Int) -> 1}//foo1()
|
||||||
m(1)
|
m(1)
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
fun set(<warning>key</warning> : String, <warning>value</warning> : String) {
|
fun set(<warning>key</warning> : String, <warning>value</warning> : String) {
|
||||||
val a : String? = ""
|
val a : String? = ""
|
||||||
when (a) {
|
when (a) {
|
||||||
"" => a<error>.</error>get(0)
|
"" -> a<error>.</error>get(0)
|
||||||
is String, is Any => a.compareTo("")
|
is String, is Any -> a.compareTo("")
|
||||||
else => a.toString()
|
else -> a.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user