Tests for issues fixed in ed95463

#KT-2831 Fixed
#KT-3286 Fixed
#KT-3863 Fixed
#KT-3976 Fixed
This commit is contained in:
Andrey Breslav
2013-10-25 17:17:20 +04:00
parent 6df469b66f
commit 46831b8d43
5 changed files with 84 additions and 0 deletions
@@ -0,0 +1,16 @@
// Exception in thread "main" java.lang.VerifyError: (class: org/jetbrains/kannotator/controlFlowBuilder/GraphBuilderInterpreter, method: binaryOperation signature: (Lorg/objectweb/asm/tree/AbstractInsnNode;Lorg/jetbrains/kannotator/controlFlowBuilder/AsmPossibleValues;Lorg/jetbrains/kannotator/controlFlowBuilder/AsmPossibleValues;)Lorg/jetbrains/kannotator/controlFlowBuilder/AsmPossibleValues;) Wrong return type in function
fun foo(): Nothing = throw Exception()
fun bar(x: Any): Int {
return when(x) {
is String -> 0
is Int -> 1
else -> foo()
}
}
fun box(): String {
bar(3)
return "OK"
}
@@ -0,0 +1,13 @@
fun test(x: Int): String = when(x) {
0 -> "zero"
1 -> "one"
2 -> "two"
else -> blowUpHorribly()
}
fun blowUpHorribly(): Nothing = throw RuntimeException("Blow up!")
fun box(): String {
test(1)
return "OK"
}
@@ -0,0 +1,17 @@
// java.lang.VerifyError: (class: org/jetbrains/jet/plugin/completion/handlers/NotImplemented, method: get signature: (Ljava/lang/Object;Ljet/PropertyMetadata;)Ljava/lang/Object;) Unable to pop operand off an empty stack
class NotImplemented<T>(){
fun get(thisRef: Any?, prop: PropertyMetadata): T = notImplemented()
fun set(thisRef: Any?, prop: PropertyMetadata, value: T) = notImplemented()
}
fun notImplemented() : Nothing = notImplemented()
class Test {
val x: Int by NotImplemented<Int>()
}
fun box(): String {
Test()
return "OK"
}
@@ -0,0 +1,18 @@
// java.lang.ClassNotFoundException: jet.Nothing
var currentAccountId: Int? by SessionAccessor()
class SessionAccessor<T> {
fun get(o : Nothing?, desc: jet.PropertyMetadata): T {
return null as T
}
fun set(o : Nothing?, desc: jet.PropertyMetadata, value: T) {
}
}
fun box(): String {
currentAccountId = 1
if (currentAccountId != null) return "Fail"
return "OK"
}