KT-377 Prohibit 'super' as a receiver argument to extension functions

+ SEVERITY_LEVELS added instead of hardcoding weak errors
+ commit() in temporary trace removed the data, so that double commit does not cause duplication of data
This commit is contained in:
Andrey Breslav
2011-10-21 21:43:08 +04:00
parent fb971ff7cb
commit a67b76d105
10 changed files with 152 additions and 53 deletions
@@ -0,0 +1,21 @@
trait T {
fun foo() {}
fun buzz() {}
fun buzz1(i : Int) {}
}
fun T.bar() {}
fun T.buzz() {}
fun T.buzz1() {}
class C : T {
fun test() {
fun T.buzz() {}
fun T.buzz1() {}
super.foo() // OK
<!SUPER_IS_NOT_AN_EXPRESSION!>super<!>.bar() // Error
super.buzz() // OK, resolved to a member
super.<!NO_VALUE_FOR_PARAMETER!>buzz1<!>() // Resolved to a member, but error: no parameter passed where required
}
}
@@ -1,5 +1,17 @@
namespace example;
fun any(a : Any) {}
fun notAnExpression() {
any(<!SUPER_IS_NOT_AN_EXPRESSION!>super<!>) // not an expression
if (<!SUPER_IS_NOT_AN_EXPRESSION!>super<!>) {} else {} // not an expression
val x = <!SUPER_IS_NOT_AN_EXPRESSION!>super<!> // not an expression
when (1) {
<!SUPER_IS_NOT_AN_EXPRESSION!>super<!> => 1 // not an expression
}
}
trait T {
fun foo() {}
}