Tests: use errors dump instead of ALLOW_UNRESOLVED_REFERENCE

This commit is contained in:
Valentin Kipyatkov
2015-04-08 20:53:01 +03:00
parent 84a6f72ab3
commit ea7732883e
38 changed files with 76 additions and 80 deletions
@@ -1,3 +1,7 @@
// ERROR: Unresolved reference: s
// ERROR: Unresolved reference: s
// ERROR: Unresolved reference: s
// ERROR: Unresolved reference: s
fun foo() {
s.extensionFun()
for (i in s.indices) {
@@ -1,5 +1,4 @@
// RUNTIME
// ALLOW_UNRESOLVED
fun foo(s: String) {
<selection> s.extensionFun()
@@ -1,3 +1,4 @@
// ERROR: Type mismatch: inferred type is kotlin.Unit but a.A was expected
package to
import a.*
@@ -1,3 +1,7 @@
// ERROR: Unresolved reference: c
// ERROR: Unresolved reference: d
// ERROR: Unresolved reference: g
// ERROR: Unresolved reference: j
package to
fun f() = c + d + g + j()
@@ -1,7 +1,5 @@
package a
// ALLOW_UNRESOLVED
class A(val c: Int = 1) {
var d = 2
@@ -1,3 +1,4 @@
// ERROR: A 'return' expression required in a function with a block body ('{...}')
package to
import a.A
@@ -1,3 +1,4 @@
// ERROR: Unresolved reference: f
package to
fun g() {
@@ -1,6 +1,5 @@
package a
// ALLOW_UNRESOLVED
//NOTE: is is an unsupported case
class A {
<selection>fun g() {
@@ -1,7 +1,5 @@
package a
// ALLOW_UNRESOLVED
class C {
}
@@ -1,3 +1,4 @@
// ERROR: Unresolved reference: A
package to
val c = A()
@@ -1,5 +1,3 @@
// ALLOW_UNRESOLVED
class A {
}
@@ -1,3 +1,4 @@
// NO_ERRORS_DUMP
package a
trait T
@@ -1,3 +1,4 @@
// ERROR: Type mismatch: inferred type is kotlin.Unit but d.A was expected
package to
import d.A
@@ -1,3 +1,6 @@
// ERROR: Overload resolution ambiguity: internal fun a.A.ext(): kotlin.Unit defined in a internal fun a.A.ext(): kotlin.Unit defined in to
// ERROR: Overload resolution ambiguity: internal var a.A.p: kotlin.Int defined in a internal var a.A.p: kotlin.Int defined in to
// ERROR: Overload resolution ambiguity: internal var a.A.p: kotlin.Int defined in a internal var a.A.p: kotlin.Int defined in to
package to
import a.A
@@ -1,3 +1,8 @@
// ERROR: Overload resolution ambiguity: internal fun a.A.ext(): kotlin.Unit defined in a internal fun a.A.ext(): kotlin.Unit defined in to
// ERROR: Overload resolution ambiguity: internal fun a.A.plus(a: a.A): kotlin.Unit defined in a internal fun a.A.plus(a: a.A): kotlin.Unit defined in to
// ERROR: Overload resolution ambiguity: internal fun a.A.infix(a: a.A): kotlin.Unit defined in a internal fun a.A.infix(a: a.A): kotlin.Unit defined in to
// ERROR: Overload resolution ambiguity: internal fun a.A.minus(): kotlin.Unit defined in a internal fun a.A.minus(): kotlin.Unit defined in to
// ERROR: Overload resolution ambiguity: internal val a.A.p: kotlin.Int defined in a internal val a.A.p: kotlin.Int defined in to
package to
import a.A
@@ -1,3 +1,6 @@
// ERROR: Unresolved reference: T
// ERROR: Unresolved reference: b
// ERROR: Unresolved reference: c
package to
fun f() {
@@ -1,5 +1,4 @@
//RUNTIME
// ALLOW_UNRESOLVED
package a
@@ -1,3 +1,4 @@
// ERROR: Type mismatch: inferred type is kotlin.Unit but d.A was expected
package to
import d.A
@@ -1,5 +1,3 @@
package to
package a
import a.A
@@ -1,4 +1,4 @@
// ALLOW_UNRESOLVED
// NO_ERRORS_DUMP
<selection>package a
@@ -1,3 +1 @@
package to
<caret>
@@ -1,3 +1,4 @@
// ERROR: Nested class 'Nested' should be qualified as 'A.Nested'
package to
import a.ext
@@ -1,3 +1,9 @@
// ERROR: Unresolved reference: Inner
// ERROR: Unresolved reference: Nested
// ERROR: Unresolved reference: NestedEnum
// ERROR: Unresolved reference: NestedObj
// ERROR: Unresolved reference: NestedTrait
// ERROR: Unresolved reference: NestedAnnotation
package to
class Outer {
@@ -1,6 +1,5 @@
package a
// ALLOW_UNRESOLVED
//NOTE: This test shows a corner case which is not covered fully by current implementation
// All we do now is avoid inserting wrong imports (we do not import anything for declaration from copied block)
// To cover this case properly and insert good imports some other approach should be used (some sophisticated heuristic might do the job)
@@ -1,10 +1,10 @@
package a;
class JavaM {
static void staticMethod() {
public class JavaM {
public static void staticMethod() {
}
}
class JavaF {
static int staticField = 0;
public class JavaF {
public static int staticField = 0;
}
@@ -1,3 +1,4 @@
// ERROR: Expression 'staticField' of type 'kotlin.Int' cannot be invoked as a function. The function invoke() is not found
package to
import a.JavaF
@@ -1,3 +1,5 @@
// ERROR: Unresolved reference: A
// ERROR: Unresolved reference: g
package to
fun f() {
-2
View File
@@ -1,7 +1,5 @@
package a
// ALLOW_UNRESOLVED
fun f() {
fun g(): Int {
}
@@ -1,3 +1,7 @@
// ERROR: Cannot access 'd': it is 'private' in 'a'
// ERROR: Cannot access 'd': it is 'private' in 'a'
// ERROR: Cannot access 'b': it is 'private' in 'a'
// ERROR: Cannot access 'b': it is 'private' in 'a'
package to
import a.b
@@ -1,3 +1,4 @@
// ERROR: No value passed for parameter i
package a
fun f(p: A, t: T) {
@@ -1,3 +1,5 @@
// ERROR: Type mismatch: inferred type is kotlin.Unit but to.A was expected
// ERROR: Function 'ext' must have a body
package to
trait T
@@ -1,3 +1,4 @@
// ERROR: No supertypes are accessible in this context
package to
fun f() {
@@ -1,3 +1,4 @@
// ERROR: Function 'f' must have a body
package to
import a.A