Add tests for cases when add and remove custom accessors for val with smartcasted usage

This commit is contained in:
Zalim Bashorov
2015-09-24 22:50:48 +03:00
parent c6409138d8
commit 79ac436b9f
10 changed files with 93 additions and 0 deletions
@@ -551,6 +551,18 @@ public class IncrementalJpsTestGenerated extends AbstractIncrementalJpsTest {
doTest(fileName);
}
@TestMetadata("valAddCustomAccessor")
public void testValAddCustomAccessor() throws Exception {
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/pureKotlin/valAddCustomAccessor/");
doTest(fileName);
}
@TestMetadata("valRemoveCustomAccessor")
public void testValRemoveCustomAccessor() throws Exception {
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/pureKotlin/valRemoveCustomAccessor/");
doTest(fileName);
}
}
@TestMetadata("jps-plugin/testData/incremental/withJava")
@@ -0,0 +1,5 @@
package test
class A() {
val x: Int? = 100
}
@@ -0,0 +1,6 @@
package test
class A() {
val x: Int? = 100
get() = field?.inc()
}
@@ -0,0 +1,16 @@
Cleaning output files:
out/production/module/test/A.class
End of files
Compiling files:
src/A.kt
End of files
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/test/TestPackage.class
out/production/module/test/UsageKt.class
End of files
Compiling files:
src/usage.kt
End of files
COMPILATION FAILED
Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type kotlin.Int?
@@ -0,0 +1,8 @@
package test
public fun usage() {
val a = A()
if (a.x != null) {
a.x.dec()
}
}
@@ -0,0 +1,6 @@
package test
class A() {
val x: Int? = 100
get() = field?.inc()
}
@@ -0,0 +1,5 @@
package test
class A() {
val x: Int? = 100
}
@@ -0,0 +1,19 @@
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/test/TestPackage.class
out/production/module/test/UsageKt.class
End of files
Compiling files:
src/usage.kt
End of files
COMPILATION FAILED
Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type kotlin.Int?
Cleaning output files:
out/production/module/test/A.class
End of files
Compiling files:
src/A.kt
src/usage.kt
End of files
@@ -0,0 +1,8 @@
package test
public fun usage() {
val a = A()
if (a.x != null) {
// a.x.dec()
}
}
@@ -0,0 +1,8 @@
package test
public fun usage() {
val a = A()
if (a.x != null) {
a.x.dec()
}
}