From 20427a6e4df22944d915a2c8b5a9a8d7fa92c586 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Fri, 16 Sep 2011 13:30:59 +0400 Subject: [PATCH] Redeclaration diagnostics work properly --- .../RedeclarationDiagnosticFactory.java | 19 +- .../jet/lang/types/JetTypeInferrer.java | 6 +- .../jet/plugin/annotations/JetPsiChecker.java | 18 +- .../checkerTestUtil/test.jet | 0 .../full/Constructors.jet | 51 ++++ .../full/Redeclarations.jet | 16 + .../full/infos/Autocasts.jet | 255 ++++++++++++++++ .../infos/PropertiesWithBackingFields.jet | 57 ++++ .../full/regression/Jet11.jet | 4 + .../checkerWithErrorTypes/quick/Abstract.jet | 241 --------------- .../quick/AnonymousInitializers.jet | 34 --- .../quick/BinaryCallsOnNullableValues.jet | 41 --- .../checkerWithErrorTypes/quick/Bounds.jet | 40 --- .../quick/BreakContinue.jet | 28 -- .../checkerWithErrorTypes/quick/Builders.jet | 121 -------- .../checkerWithErrorTypes/quick/Casts.jet | 16 - .../quick/ClassObjects.jet | 30 -- .../checkerWithErrorTypes/quick/Constants.jet | 8 - .../quick/CyclicHierarchy.jet | 30 -- .../checkerWithErrorTypes/quick/Enums.jet | 10 - .../quick/ExtensionFunctions.jet | 71 ----- .../quick/ForRangeConventions.jet | 80 ----- .../quick/FunctionReturnTypes.jet | 166 ----------- .../quick/GenericArgumentConsistency.jet | 42 --- .../checkerWithErrorTypes/quick/IncDec.jet | 46 --- .../quick/IsExpressions.jet | 7 - .../quick/MultipleBounds.jet | 72 ----- .../quick/NamespaceAsExpression.jet | 8 - .../quick/NamespaceQualified.jet | 63 ---- .../quick/Nullability.jet | 280 ------------------ .../checkerWithErrorTypes/quick/Objects.jet | 83 ------ .../checkerWithErrorTypes/quick/Override.jet | 76 ----- .../quick/PrimaryConstructors.jet | 14 - .../quick/ProjectionsInSupertypes.jet | 6 - .../quick/Properties.jet | 28 -- .../quick/QualifiedExpressions.jet | 11 - .../quick/QualifiedThis.jet | 41 --- .../quick/RecursiveTypeInference.jet | 42 --- .../quick/ResolveToJava.jet | 52 ---- .../quick/StringTemplates.jet | 21 -- .../quick/SupertypeListChecks.jet | 50 ---- .../quick/TraitSupertypeList.jet | 11 - .../quick/UnreachableCode.jet | 161 ---------- .../quick/Unresolved.jet | 30 -- .../checkerWithErrorTypes/quick/Variance.jet | 40 --- .../checkerWithErrorTypes/quick/When.jet | 61 ---- .../AmbiguityOnLazyTypeComputation.jet | 12 - .../regression/AssignmentsUnderOperators.jet | 6 - .../quick/regression/CoercionToUnit.jet | 9 - .../quick/regression/DoubleDefine.jet | 66 ----- .../quick/regression/Jet121.jet | 14 - .../quick/regression/Jet124.jet | 8 - .../quick/regression/Jet169.jet | 8 - .../quick/regression/Jet17.jet | 6 - .../quick/regression/Jet183-1.jet | 21 -- .../quick/regression/Jet183.jet | 22 -- .../quick/regression/Jet53.jet | 4 - .../quick/regression/Jet67.jet | 4 - .../quick/regression/Jet68.jet | 11 - .../quick/regression/Jet69.jet | 10 - .../quick/regression/Jet72.jet | 17 -- .../quick/regression/Jet81.jet | 22 -- .../quick/regression/OverrideResolution.jet | 16 - .../ScopeForSecondaryConstructors.jet | 17 -- .../regression/SpecififcityByReceiver.jet | 9 - .../ThisConstructorInGenericClass.jet | 3 - .../regression/WrongTraceInCallResolver.jet | 9 - .../quick/regression/kt251.jet | 33 --- .../quick/regression/kt303.jet | 11 - .../jet/checkers/CheckerTestUtilTest.java | 2 +- .../jet/checkers/FullJetPsiCheckerTest.java | 62 ++-- 71 files changed, 436 insertions(+), 2553 deletions(-) rename idea/testData/{ => checkerWithErrorTypes}/checkerTestUtil/test.jet (100%) create mode 100644 idea/testData/checkerWithErrorTypes/full/Constructors.jet create mode 100644 idea/testData/checkerWithErrorTypes/full/Redeclarations.jet create mode 100644 idea/testData/checkerWithErrorTypes/full/infos/Autocasts.jet create mode 100644 idea/testData/checkerWithErrorTypes/full/infos/PropertiesWithBackingFields.jet create mode 100644 idea/testData/checkerWithErrorTypes/full/regression/Jet11.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/Abstract.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/AnonymousInitializers.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/BinaryCallsOnNullableValues.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/Bounds.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/BreakContinue.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/Builders.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/Casts.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/ClassObjects.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/Constants.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/CyclicHierarchy.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/Enums.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/ExtensionFunctions.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/ForRangeConventions.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/FunctionReturnTypes.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/GenericArgumentConsistency.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/IncDec.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/IsExpressions.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/MultipleBounds.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/NamespaceAsExpression.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/NamespaceQualified.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/Nullability.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/Objects.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/Override.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/PrimaryConstructors.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/ProjectionsInSupertypes.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/Properties.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/QualifiedExpressions.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/QualifiedThis.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/RecursiveTypeInference.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/ResolveToJava.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/StringTemplates.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/SupertypeListChecks.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/TraitSupertypeList.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/UnreachableCode.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/Unresolved.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/Variance.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/When.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/AmbiguityOnLazyTypeComputation.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/AssignmentsUnderOperators.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/CoercionToUnit.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/DoubleDefine.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/Jet121.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/Jet124.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/Jet169.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/Jet17.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/Jet183-1.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/Jet183.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/Jet53.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/Jet67.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/Jet68.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/Jet69.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/Jet72.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/Jet81.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/OverrideResolution.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/ScopeForSecondaryConstructors.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/SpecififcityByReceiver.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/ThisConstructorInGenericClass.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/WrongTraceInCallResolver.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/kt251.jet delete mode 100644 idea/testData/checkerWithErrorTypes/quick/regression/kt303.jet diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/RedeclarationDiagnosticFactory.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/RedeclarationDiagnosticFactory.java index a44f5dfad57..c9303288d18 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/RedeclarationDiagnosticFactory.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/RedeclarationDiagnosticFactory.java @@ -2,15 +2,15 @@ package org.jetbrains.jet.lang.diagnostics; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor; +import org.jetbrains.jet.lang.psi.JetNamedDeclaration; import org.jetbrains.jet.lang.resolve.BindingContext; /** * @author abreslav */ -public class RedeclarationDiagnosticFactory implements DiagnosticFactory { +public class RedeclarationDiagnosticFactory extends AbstractDiagnosticFactory { public static final RedeclarationDiagnosticFactory INSTANCE = new RedeclarationDiagnosticFactory(); @@ -27,13 +27,14 @@ public class RedeclarationDiagnosticFactory implements DiagnosticFactory { @NotNull @Override public TextRange getTextRange(@NotNull Diagnostic diagnostic) { - throw new UnsupportedOperationException(); // TODO - } - - @NotNull - @Override - public PsiFile getPsiFile(@NotNull Diagnostic diagnostic) { - throw new UnsupportedOperationException(); // TODO + PsiElement redeclaration = ((RedeclarationDiagnostic) diagnostic).getPsiElement(); + if (redeclaration instanceof JetNamedDeclaration) { + PsiElement nameIdentifier = ((JetNamedDeclaration) redeclaration).getNameIdentifier(); + if (nameIdentifier != null) { + return nameIdentifier.getTextRange(); + } + } + return redeclaration.getTextRange(); } @NotNull diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/JetTypeInferrer.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/JetTypeInferrer.java index 0427ba0b237..cb2611a1ed0 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/JetTypeInferrer.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/JetTypeInferrer.java @@ -974,7 +974,11 @@ public class JetTypeInferrer { @Override public JetType visitParenthesizedExpression(JetParenthesizedExpression expression, TypeInferenceContext context) { - return context.services.checkType(getType(expression.getExpression(), context.replaceScope(context.scope)), expression, context); + JetExpression innerExpression = expression.getExpression(); + if (innerExpression == null) { + return null; + } + return context.services.checkType(getType(innerExpression, context.replaceScope(context.scope)), expression, context); } @Override diff --git a/idea/src/org/jetbrains/jet/plugin/annotations/JetPsiChecker.java b/idea/src/org/jetbrains/jet/plugin/annotations/JetPsiChecker.java index 75fae7ffed9..9dd958ceee2 100644 --- a/idea/src/org/jetbrains/jet/plugin/annotations/JetPsiChecker.java +++ b/idea/src/org/jetbrains/jet/plugin/annotations/JetPsiChecker.java @@ -71,7 +71,7 @@ public class JetPsiChecker implements Annotator { } else if (diagnostic instanceof RedeclarationDiagnostic) { RedeclarationDiagnostic redeclarationDiagnostic = (RedeclarationDiagnostic) diagnostic; - markRedeclaration(redeclarations, redeclarationDiagnostic.getPsiElement(), holder); + annotation = markRedeclaration(redeclarations, redeclarationDiagnostic, holder); } else { annotation = holder.createErrorAnnotation(diagnostic.getFactory().getTextRange(diagnostic), getMessage(diagnostic)); @@ -133,18 +133,10 @@ public class JetPsiChecker implements Annotator { return diagnostic.getMessage(); } - private void markRedeclaration(Set redeclarations, @NotNull PsiElement redeclaration, AnnotationHolder holder) { - if (!redeclarations.add(redeclaration)) return; - if (redeclaration instanceof JetNamedDeclaration) { - PsiElement nameIdentifier = ((JetNamedDeclaration) redeclaration).getNameIdentifier(); - if (nameIdentifier != null) { - holder.createErrorAnnotation(nameIdentifier, "Redeclaration"); - } - } - else { - holder.createErrorAnnotation(redeclaration, "Redeclaration"); - } - } + private Annotation markRedeclaration(Set redeclarations, RedeclarationDiagnostic diagnostic, AnnotationHolder holder) { + if (!redeclarations.add(diagnostic.getPsiElement())) return null; + return holder.createErrorAnnotation(diagnostic.getFactory().getTextRange(diagnostic), getMessage(diagnostic)); + } private void highlightBackingFields(final AnnotationHolder holder, JetFile file, final BindingContext bindingContext) { diff --git a/idea/testData/checkerTestUtil/test.jet b/idea/testData/checkerWithErrorTypes/checkerTestUtil/test.jet similarity index 100% rename from idea/testData/checkerTestUtil/test.jet rename to idea/testData/checkerWithErrorTypes/checkerTestUtil/test.jet diff --git a/idea/testData/checkerWithErrorTypes/full/Constructors.jet b/idea/testData/checkerWithErrorTypes/full/Constructors.jet new file mode 100644 index 00000000000..c6adf21f4b9 --- /dev/null +++ b/idea/testData/checkerWithErrorTypes/full/Constructors.jet @@ -0,0 +1,51 @@ + +open class NoC +class NoC1 : NoC + +class WithC0() : NoC() +open class WithC1() : NoC +class NoC2 : WithC1 +class NoC3 : WithC1() +class WithC2() : WithC1 + +class NoPC { + this() {} +} + +class WithPC0() { + this(a : Int) : this() {} +} + +class WithPC1(a : Int) { + this() {} + + this(b : Long) : this("") {} + + this(s : String) : this(1) {} + + this(b : Char) : this("", 2) {} + + this(b : Byte) : this(""), this(1) {} +} + + +class Foo() : WithPC0, this() { + +} + +class WithCPI_Dup(x : Int) { + var x : Int +} + +class WithCPI(x : Int) { + val a = 1 + val b : Int = $a + val xy : Int = x +} + +class NoCPI { + val a = 1 + var ab = 1 + get() = 1 + set(v) {} +} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/full/Redeclarations.jet b/idea/testData/checkerWithErrorTypes/full/Redeclarations.jet new file mode 100644 index 00000000000..3068a16b54d --- /dev/null +++ b/idea/testData/checkerWithErrorTypes/full/Redeclarations.jet @@ -0,0 +1,16 @@ +namespace redeclarations { + object A { + val x : Int = 0 + + val A = 1 + } + + namespace A { + class A {} + } + + class A {} + + val A = 1 + +} diff --git a/idea/testData/checkerWithErrorTypes/full/infos/Autocasts.jet b/idea/testData/checkerWithErrorTypes/full/infos/Autocasts.jet new file mode 100644 index 00000000000..ff7066a34f5 --- /dev/null +++ b/idea/testData/checkerWithErrorTypes/full/infos/Autocasts.jet @@ -0,0 +1,255 @@ +open class A() { + fun foo() {} +} + +class B() : A() { + fun bar() {} +} + +fun f9() { + val a : A? + a?.foo() + a?.bar() + if (a is B) { + a.bar() + a.foo() + } + a?.foo() + a?.bar() + if (!(a is B)) { + a?.bar() + a?.foo() + } + if (!(a is B) || a.bar() == ()) { + a?.bar() + } + if (!(a is B)) { + return; + } + a.bar() + a.foo() +} + +fun f10() { + val a : A? + if (!(a is B)) { + return; + } + if (!(a is B)) { + return; + } +} + +class C() : A() { + fun bar() { + + } +} + +fun f10(a : A?) { + if (a is B) { + if (a is C) { + a.bar(); + } + } +} + +fun f11(a : A?) { + when (a) { + is B => a.bar() + is A => a.foo() + is Any => a.foo() + is Any? => a.bar() + else => a?.foo() + } +} + +fun f12(a : A?) { + when (a) { + is B => a.bar() + is A => a.foo() + is Any => a.foo(); + is Any? => a.bar() + is val c : B => c.foo() + is val c is C => c.bar() + is val c is C => a.bar() + else => a?.foo() + } + + if (a is val b) { + a?.bar() + b?.foo() + } + if (a is val b is B) { + b.foo() + a.bar() + b.bar() + } +} + +fun f13(a : A?) { + if (a is val c is B) { + c.foo() + c.bar() + } + else { + a?.foo() + c.bar() + } + + a?.foo() + if (!(a is val c is B)) { + a?.foo() + c.bar() + } + else { + a.foo() + c.bar() + } + + a?.foo() + if (a is val c is B && a.foo() == () && c.bar() == ()) { + c.foo() + c.bar() + } + else { + a?.foo() + c.bar() + } + + if (!(a is val c is B) || !(a is val x is C)) { + x + c + } + else { + x + c + } + + if (!(a is val c is B) || !(a is val c is C)) { + } + + if (!(a is val c is B)) return + a.bar() + c.foo() + c.bar() +} + +fun f14(a : A?) { + while (!(a is val c is B)) { + } + a.bar() + c.bar() +} +fun f15(a : A?) { + do { + } while (!(a is val c is B)) + a.bar() + c.bar() +} + +fun getStringLength(obj : Any) : Char? { + if (obj !is String) + return null + return obj.get(0) // no cast to String is needed +} + +fun toInt(i: Int?): Int = if (i != null) i else 0 +fun illegalWhenBody(a: Any): Int = when(a) { + is Int => a + is String => a +} +fun illegalWhenBlock(a: Any): Int { + when(a) { + is Int => return a + is String => return a + } +} +fun declarations(a: Any?) { + if (a is String) { + val p4: (Int, String) = (2, a) + } + if (a is String?) { + if (a != null) { + val s: String = a + } + } + if (a != null) { + if (a is String?) { + val s: String = a + } + } +} +fun vars(a: Any?) { + var b: Int = 0 + if (a is Int) { + b = a + } +} +fun tuples(a: Any?) { + if (a != null) { + val s: (Any, String) = (a, a) + } + if (a is String) { + val s: (Any, String) = (a, a) + } + fun illegalTupleReturnType(): (Any, String) = (a, a) + if (a is String) { + fun legalTupleReturnType(): (Any, String) = (a, a) + } + val illegalFunctionLiteral: Function0 = { a } + val illegalReturnValueInFunctionLiteral: Function0 = { (): Int => a } + + if (a is Int) { + val legalFunctionLiteral: Function0 = { a } + val alsoLegalFunctionLiteral: Function0 = { (): Int => a } + } +} +fun returnFunctionLiteralBlock(a: Any?): Function0 { + if (a is Int) return { a } + else return { 1 } +} +fun returnFunctionLiteral(a: Any?): Function0 = + if (a is Int) { (): Int => a } + else { () => 1 } + +fun illegalTupleReturnType(a: Any): (Any, String) = (a, a) + +fun declarationInsidePattern(x: (Any, Any)): String = when(x) { is (val a is String, *) => a; else => "something" } + +fun mergeAutocasts(a: Any?) { + if (a is String || a is Int) { + a.compareTo("") + a.toString() + } + if (a is Int || a is String) { + a.compareTo("") + } + when (a) { + is String, is Any => a.compareTo("") + } + if (a is String && a is Any) { + val i: Int = a.compareTo("") + } + if (a is String && a.compareTo("") == 0) {} + if (a is String || a.compareTo("") == 0) {} +} + +//mutability +fun f(): String { + var a: Any = 11 + if (a is String) { + val i: String = a + a.compareTo("f") + val f: Function0 = { a } + return a + } + return "" +} + +fun foo(var a: Any): Int { + if (a is Int) { + return a + } + return 1 +} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/full/infos/PropertiesWithBackingFields.jet b/idea/testData/checkerWithErrorTypes/full/infos/PropertiesWithBackingFields.jet new file mode 100644 index 00000000000..8bdd70dd54a --- /dev/null +++ b/idea/testData/checkerWithErrorTypes/full/infos/PropertiesWithBackingFields.jet @@ -0,0 +1,57 @@ +abstract class Test() { + abstract val x : Int + abstract val x1 : Int get + abstract val x2 : Int get() = 1 + + val a : Int + val b : Int get + val c = 1 + + val c1 = 1 + get + val c2 : Int + get() = 1 + val c3 : Int + get() { return 1 } + val c4 : Int + get() = 1 + val c5 : Int + get() = $c5 + 1 + + abstract var y : Int + abstract var y1 : Int get + abstract var y2 : Int set + abstract var y3 : Int set get + abstract var y4 : Int set get() = 1 + abstract var y5 : Int set(x) {} get() = 1 + abstract var y6 : Int set(x) {} + + var v : Int + var v1 : Int get + var v2 : Int get set + var v3 : Int get() = 1; set + var v4 : Int get() = 1; set(x){} + + var v5 : Int get() = 1; set(x){$v5 = x} + var v6 : Int get() = $v6 + 1; set(x){} + + val v7 : Int abstract get + var v8 : Int abstract get abstract set + var v9 : Int abstract set + var v10 : Int abstract get + +} + +open class Super(i : Int) + +class TestPCParameters(w : Int, x : Int, val y : Int, var z : Int) : Super(w) { + + val xx = w + + { + w + 1 + } + + fun foo() = x + +} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/full/regression/Jet11.jet b/idea/testData/checkerWithErrorTypes/full/regression/Jet11.jet new file mode 100644 index 00000000000..eb42b6f2427 --- /dev/null +++ b/idea/testData/checkerWithErrorTypes/full/regression/Jet11.jet @@ -0,0 +1,4 @@ +// JET-11 Redeclaration & Forward reference for classes cause an exception +open class NoC +class NoC1 : NoC +open class NoC diff --git a/idea/testData/checkerWithErrorTypes/quick/Abstract.jet b/idea/testData/checkerWithErrorTypes/quick/Abstract.jet deleted file mode 100644 index 113ff0a34d6..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/Abstract.jet +++ /dev/null @@ -1,241 +0,0 @@ -namespace abstract - -class MyClass() { - //properties - val a: Int - val a1: Int = 1 - abstract val a2: Int - abstract val a3: Int = 1 - - var b: Int private set - var b1: Int = 0; private set - abstract var b2: Int private set - abstract var b3: Int = 0; private set - - var c: Int set(v: Int) { $c = v } - var c1: Int = 0; set(v: Int) { $c1 = v } - abstract var c2: Int set(v: Int) { $c2 = v } - abstract var c3: Int = 0; set(v: Int) { $c3 = v } - - val e: Int get() = a - val e1: Int = 0; get() = a - abstract val e2: Int get() = a - abstract val e3: Int = 0; get() = a - - //methods - fun f() - fun g() {} - abstract fun h() - abstract fun j() {} - - //property accessors - var i: Int abstract get abstract set - var i1: Int = 0; abstract get abstract set - - var j: Int get() = i; abstract set - var j1: Int = 0; get() = i; abstract set - - var k: Int abstract set - var k1: Int = 0; abstract set - - var l: Int abstract get abstract set - var l1: Int = 0; abstract get abstract set - - var n: Int abstract get abstract set(v: Int) {} -} - -abstract class MyAbstractClass() { - //properties - val a: Int - val a1: Int = 1 - abstract val a2: Int - abstract val a3: Int = 1 - - var b: Int private set - var b1: Int = 0; private set - abstract var b2: Int private set - abstract var b3: Int = 0; private set - - var c: Int set(v: Int) { $c = v } - var c1: Int = 0; set(v: Int) { $c1 = v } - abstract var c2: Int set(v: Int) { $c2 = v } - abstract var c3: Int = 0; set(v: Int) { $c3 = v } - - val e: Int get() = a - val e1: Int = 0; get() = a - abstract val e2: Int get() = a - abstract val e3: Int = 0; get() = a - - //methods - fun f() - fun g() {} - abstract fun h() - abstract fun j() {} - - //property accessors - var i: Int abstract get abstract set - var i1: Int = 0; abstract get abstract set - - var j: Int get() = i; abstract set - var j1: Int get() = i; abstract set - - var k: Int abstract set - var k1: Int = 0; abstract set - - var l: Int abstract get abstract set - var l1: Int = 0; abstract get abstract set - - var n: Int abstract get abstract set(v: Int) {} -} - -trait MyTrait { - //properties - val a: Int - val a1: Int = 1 - abstract val a2: Int - abstract val a3: Int = 1 - - var b: Int private set - var b1: Int = 0; private set - abstract var b2: Int private set - abstract var b3: Int = 0; private set - - var c: Int set(v: Int) { $c = v } - var c1: Int = 0; set(v: Int) { $c1 = v } - abstract var c2: Int set(v: Int) { $c2 = v } - abstract var c3: Int = 0; set(v: Int) { $c3 = v } - - val e: Int get() = a - val e1: Int = 0; get() = a - abstract val e2: Int get() = a - abstract val e3: Int = 0; get() = a - - //methods - fun f() - fun g() {} - abstract fun h() - abstract fun j() {} - - //property accessors - var i: Int abstract get abstract set - var i1: Int = 0; abstract get abstract set - - var j: Int get() = i; abstract set - var j1: Int = 0; get() = i; abstract set - - var k: Int abstract set - var k1: Int = 0; abstract set - - var l: Int abstract get abstract set - var l1: Int = 0; abstract get abstract set - - var n: Int abstract get abstract set(v: Int) {} -} - -enum class MyEnum() { - //properties - val a: Int - val a1: Int = 1 - abstract val a2: Int - abstract val a3: Int = 1 - - var b: Int private set - var b1: Int = 0; private set - abstract var b2: Int private set - abstract var b3: Int = 0; private set - - var c: Int set(v: Int) { $c = v } - var c1: Int = 0; set(v: Int) { $c1 = v } - abstract var c2: Int set(v: Int) { $c2 = v } - abstract var c3: Int = 0; set(v: Int) { $c3 = v } - - val e: Int get() = a - val e1: Int = 0; get() = a - abstract val e2: Int get() = a - abstract val e3: Int = 0; get() = a - - //methods - fun f() - fun g() {} - abstract fun h() - abstract fun j() {} - - //property accessors - var i: Int abstract get abstract set - var i1: Int = 0; abstract get abstract set - - var j: Int get() = i; abstract set - var j1: Int = 0; get() = i; abstract set - - var k: Int abstract set - var k1: Int = 0; abstract set - - var l: Int abstract get abstract set - var l1: Int = 0; abstract get abstract set - - var n: Int abstract get abstract set(v: Int) {} -} - -abstract enum class MyAbstractEnum() {} - -namespace MyNamespace { - //properties - val a: Int - val a1: Int = 1 - abstract val a2: Int - abstract val a3: Int = 1 - - var b: Int private set - var b1: Int = 0; private set - abstract var b2: Int private set - abstract var b3: Int = 0; private set - - var c: Int set(v: Int) { $c = v } - var c1: Int = 0; set(v: Int) { $c1 = v } - abstract var c2: Int set(v: Int) { $c2 = v } - abstract var c3: Int = 0; set(v: Int) { $c3 = v } - - val e: Int get() = a - val e1: Int = 0; get() = a - abstract val e2: Int get() = a - abstract val e3: Int = 0; get() = a - - //methods - fun f() - fun g() {} - abstract fun h() - abstract fun j() {} - - //property accessors - var i: Int abstract get abstract set - var i1: Int = 0; abstract get abstract set - - var j: Int get() = i; abstract set - var j1: Int = 0; get() = i; abstract set - - var k: Int abstract set - var k1: Int = 0; abstract set - - var l: Int abstract get abstract set - var l1: Int = 0; abstract get abstract set - - var n: Int abstract get abstract set(v: Int) {} -} - -//creating an instance -abstract class B1( - val i: Int, - val s: String -) { -} - -class B2() : B1(1, "r") {} - -abstract class B3(i: Int) { - this(): this(1) -} - -fun foo(a: B3) { - val a = B3() - val b = B1(2, "s") -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/AnonymousInitializers.jet b/idea/testData/checkerWithErrorTypes/quick/AnonymousInitializers.jet deleted file mode 100644 index 955798a7a9c..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/AnonymousInitializers.jet +++ /dev/null @@ -1,34 +0,0 @@ -class NoC { - { - - } - - val a : Int get() = 1 - - { - - } -} - -class WithC() { - val x : Int - { - $x = 1 - $y = 2 - val b = x - - } - - val a : Int get() = 1 - - { - val z = b - val zz = x - val zzz = $a - } - - this(a : Int) : this() { - val b = x - } - -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/BinaryCallsOnNullableValues.jet b/idea/testData/checkerWithErrorTypes/quick/BinaryCallsOnNullableValues.jet deleted file mode 100644 index 86d34c881be..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/BinaryCallsOnNullableValues.jet +++ /dev/null @@ -1,41 +0,0 @@ -class A() { - fun equals(a : Any?) : Boolean = false -} - -class B() { - fun equals(a : Any?) : Boolean? = false -} - -class C() { - fun equals(a : Any?) : Int = 0 -} - -fun f(): Unit { - var x: Int? = 1 - x = 1 - x + 1 - x plus 1 - x < 1 - x += 1 - - x == 1 - x != 1 - - A() == 1 - B() == 1 - C() == 1 - - x === "1" - x !== "1" - - x === 1 - x !== 1 - - x..2 - x in 1..2 - - val y : Boolean? = true - false || y - y && true - y && 1 -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/Bounds.jet b/idea/testData/checkerWithErrorTypes/quick/Bounds.jet deleted file mode 100644 index 48eea1e3d6e..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/Bounds.jet +++ /dev/null @@ -1,40 +0,0 @@ -namespace boundsWithSubstitutors { - open class A - class B>() - - class C : A - - val a = B() - val a1 = B<Int>() - - class X() - - val b = X, C>> - val b0 = XAny?> - val b1 = X, String>> - -} - - open class A {} - open class B() - - abstract class CInt>, X : fun (B<Char>) : (B<Any>, B)>() : B<Any>() { // 2 errors - val a = B<Char>() // error - - abstract val x : fun (B<Char>) : B<Any> - } - - -fun test() { - foo<Int?>() - foo() - bar() - bar() - bar<Double?>() - bar<Double>() - 1.buzz<Double>() -} - -fun foo() {} -fun bar() {} -fun Int> Int.buzz() : Unit {} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/BreakContinue.jet b/idea/testData/checkerWithErrorTypes/quick/BreakContinue.jet deleted file mode 100644 index 2bf691799e0..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/BreakContinue.jet +++ /dev/null @@ -1,28 +0,0 @@ -class C { - - fun f (a : Boolean, b : Boolean) { - @b (while (true) - @a { - break@f - break - break@b - break@a - }) - - continue - - @b (while (true) - @a { - continue@f - continue - continue@b - continue@a - }) - - break - - continue@f - break@f - } - -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/Builders.jet b/idea/testData/checkerWithErrorTypes/quick/Builders.jet deleted file mode 100644 index 0405b3fe398..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/Builders.jet +++ /dev/null @@ -1,121 +0,0 @@ -import java.util.* - -namespace html { - - abstract class Factory { - abstract fun create() : T - } - - abstract class Element - - class TextElement(val text : String) : Element - - abstract class Tag(val name : String) : Element { - val children = ArrayList() - val attributes = HashMap() - - protected fun initTag(init : fun T.() : Unit) : T - where class object T : Factory{ - val tag = T.create() - tag.init() - children.add(tag) - return tag - } - } - - abstract class TagWithText(name : String) : Tag(name) { - fun String.plus() { - children.add(TextElement(this)) - } - } - - class HTML() : TagWithText("html") { - class object : Factory { - override fun create() = HTML() - } - - fun head(init : fun Head.() : Unit) = initTag(init) - - fun body(init : fun Body.() : Unit) = initTag(init) - } - - class Head() : TagWithText("head") { - class object : Factory { - override fun create() = Head() - } - - fun title(init : fun Title.() : Unit) = initTag(init)<!> - } - - class Title() : TagWithText("title") - - abstract class BodyTag(name : String) : TagWithText(name) { - } - - class Body() : BodyTag("body") { - class object : Factory<Body> { - override fun create() = <!OVERLOAD_RESOLUTION_AMBIGUITY!>Body()<!> - } - - fun b(init : fun B.() : Unit) = <!OVERLOAD_RESOLUTION_AMBIGUITY!>initTag<B>(init)<!> - fun p(init : fun P.() : Unit) = <!OVERLOAD_RESOLUTION_AMBIGUITY!>initTag<P>(init)<!> - fun h1(init : fun H1.() : Unit) = <!OVERLOAD_RESOLUTION_AMBIGUITY!>initTag<H1>(init)<!> - fun a(href : String, init : fun A.() : Unit) { - val a = <!OVERLOAD_RESOLUTION_AMBIGUITY!>initTag<A>(init)<!> - a.href = href - } - } - - class B() : BodyTag("b") - class P() : BodyTag("p") - class H1() : BodyTag("h1") - class A() : BodyTag("a") { - var href : String - get() = attributes["href"] - set(value) { attributes["href"] = value } - } - - fun Map<String, String>.set(key : String, value : String) = this.put(key, value) - - fun html(init : fun HTML.() : Unit) : HTML { - val html = <!OVERLOAD_RESOLUTION_AMBIGUITY!>HTML()<!> - html.init() - return html - } - -} - -namespace foo { - -import html.* - -fun result(args : Array<String>) = - <!OVERLOAD_RESOLUTION_AMBIGUITY!>html { - <!OVERLOAD_RESOLUTION_AMBIGUITY!>head { - <!OVERLOAD_RESOLUTION_AMBIGUITY!>title {<!NO_VALUE_FOR_PARAMETER!>+<!>"XML encoding with Groovy"}<!> - }<!> - <!OVERLOAD_RESOLUTION_AMBIGUITY!>body { - <!OVERLOAD_RESOLUTION_AMBIGUITY!>h1 {<!NO_VALUE_FOR_PARAMETER!>+<!>"XML encoding with Groovy"}<!> - <!OVERLOAD_RESOLUTION_AMBIGUITY!>p {<!NO_VALUE_FOR_PARAMETER!>+<!>"this format can be used as an alternative markup to XML"}<!> - - // an element with attributes and text content - <!OVERLOAD_RESOLUTION_AMBIGUITY!>a(href = "http://groovy.codehaus.org") {<!NO_VALUE_FOR_PARAMETER!>+<!>"Groovy"}<!> - - // mixed content - <!OVERLOAD_RESOLUTION_AMBIGUITY!>p { - <!NO_VALUE_FOR_PARAMETER!>+<!>"This is some" - <!OVERLOAD_RESOLUTION_AMBIGUITY!>b {<!NO_VALUE_FOR_PARAMETER!>+<!>"mixed"}<!> - <!NO_VALUE_FOR_PARAMETER!>+<!>"text. For more see the" - <!OVERLOAD_RESOLUTION_AMBIGUITY!>a(href = "http://groovy.codehaus.org") {<!NO_VALUE_FOR_PARAMETER!>+<!>"Groovy"}<!> - <!NO_VALUE_FOR_PARAMETER!>+<!>"project" - }<!> - <!OVERLOAD_RESOLUTION_AMBIGUITY!>p {<!NO_VALUE_FOR_PARAMETER!>+<!>"some text"}<!> - - // content generated by - <!OVERLOAD_RESOLUTION_AMBIGUITY!>p { - for (arg in args) - <!NO_VALUE_FOR_PARAMETER!>+<!>arg - }<!> - }<!> - }<!> -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/Casts.jet b/idea/testData/checkerWithErrorTypes/quick/Casts.jet deleted file mode 100644 index 163619fd4d0..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/Casts.jet +++ /dev/null @@ -1,16 +0,0 @@ -fun test() : Unit { - var x : Int? = 0 - var y : Int = 0 - - x : Int? - y : Int - x as Int : Int - y <!USELESS_CAST!>as<!> Int : Int - x <!USELESS_CAST!>as<!> Int? : Int? - y <!USELESS_CAST_STATIC_ASSERT_IS_FINE!>as<!> Int? : Int? - x as? Int : Int? - y <!USELESS_CAST!>as?<!> Int : Int? - x <!USELESS_CAST!>as?<!> Int? : Int? - y <!USELESS_CAST_STATIC_ASSERT_IS_FINE!>as?<!> Int? : Int? - () -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/ClassObjects.jet b/idea/testData/checkerWithErrorTypes/quick/ClassObjects.jet deleted file mode 100644 index 9937c5ab453..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/ClassObjects.jet +++ /dev/null @@ -1,30 +0,0 @@ -namespace Jet86 - -class A { - class object { - val x = 1 - } - <!MANY_CLASS_OBJECTS!>class object { // error - val x = 1 - }<!> -} - -class B() { - val x = 12 -} - -object b { - <!CLASS_OBJECT_NOT_ALLOWED!>class object { - val x = 1 - }<!> // error -} - -val a = A.x -val c = <!NO_CLASS_OBJECT!>B<!>.x -val d = b.<!UNRESOLVED_REFERENCE!>x<!> - -val s = <!UNRESOLVED_REFERENCE!>System<!> // error -fun test() { - <!UNRESOLVED_REFERENCE!>System<!>.out<!UNNECESSARY_SAFE_CALL!>?.<!>println() - <!UNRESOLVED_REFERENCE!>java<!>.lang.System.out<!UNNECESSARY_SAFE_CALL!>?.<!>println() -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/Constants.jet b/idea/testData/checkerWithErrorTypes/quick/Constants.jet deleted file mode 100644 index cc908e189f0..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/Constants.jet +++ /dev/null @@ -1,8 +0,0 @@ -fun test() { - 1 : Byte - 1 : Int - <!TYPE_MISMATCH, TYPE_MISMATCH!>1<!> : Double - 1 <!USELESS_CAST!>as<!> Byte - 1 <!USELESS_CAST!>as<!> Int - <!ERROR_COMPILE_TIME_VALUE!>1<!> <!CAST_NEVER_SUCCEEDS!>as<!> Double -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/CyclicHierarchy.jet b/idea/testData/checkerWithErrorTypes/quick/CyclicHierarchy.jet deleted file mode 100644 index ff99017a12b..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/CyclicHierarchy.jet +++ /dev/null @@ -1,30 +0,0 @@ -open trait A { - fun foo() {} -} -open trait B : A, <!CYCLIC_INHERITANCE_HIERARCHY!>E<!> {} -open trait C : B {} -open trait D : <!CYCLIC_INHERITANCE_HIERARCHY!>B<!> {} -open trait E : <!CYCLIC_INHERITANCE_HIERARCHY!>F<!> {} -open trait F : <!CYCLIC_INHERITANCE_HIERARCHY!>D<!>, C {} -open trait G : F {} -open trait H : F {} - -val a : A? = null -val b : B? = null -val c : C? = null -val d : D? = null -val e : E? = null -val f : F? = null -val g : G? = null -val h : H? = null - -fun test() { - a?.foo() - b?.foo() - c?.foo() - d?.foo() - e?.<!UNRESOLVED_REFERENCE!>foo<!>() - f?.foo() - g?.foo() - h?.foo() -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/Enums.jet b/idea/testData/checkerWithErrorTypes/quick/Enums.jet deleted file mode 100644 index 0ef400fda22..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/Enums.jet +++ /dev/null @@ -1,10 +0,0 @@ -enum class List<out T>(val size : Int) { - Nil : List<Nothing>(0) { - val a = 1 - } - Cons<out T>(val head : T, val tail : List<T>) : List<T>(tail.size + 1) - -} - -val foo = List.Nil -val foo1 = foo.a \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/ExtensionFunctions.jet b/idea/testData/checkerWithErrorTypes/quick/ExtensionFunctions.jet deleted file mode 100644 index 50544c581c8..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/ExtensionFunctions.jet +++ /dev/null @@ -1,71 +0,0 @@ -fun Int?.optint() : Unit {} -val Int?.optval : Unit = () - -fun <T, E> T.foo(x : E, y : A) : T { - y.plus(1) - y plus 1 - y + 1.0 - - this<!UNNECESSARY_SAFE_CALL!>?.<!>minus<T>(this) - - return this -} - -class A - -fun A.plus(a : Any) { - - 1.foo() - true.<!NONE_APPLICABLE!>foo()<!> - - 1 -} - -fun A.plus(a : Int) { - 1 -} - -fun <T> T.minus(t : T) : Int = 1 - -fun test() { - val y = 1.abs -} -val Int.abs : Int - get() = if (this > 0) this else -this; - -val <T> T.<!MUST_BE_INITIALIZED!>foo<!> : T - -fun Int.foo() = this - -namespace null_safety { - - fun parse(cmd: String): Command? { return null } - class Command() { - // fun equals(other : Any?) : Boolean - val foo : Int = 0 - } - - fun Any.equals(other : Any?) : Boolean = true - fun Any?.equals1(other : Any?) : Boolean = true - fun Any.equals2(other : Any?) : Boolean = true - - fun main(args: Array<String>) { - - <!UNRESOLVED_REFERENCE!>System<!>.out<!UNNECESSARY_SAFE_CALL!>?.<!>print(1) - - val command = parse("") - - command<!UNSAFE_CALL!>.<!>foo - - command.equals(null) - command<!UNNECESSARY_SAFE_CALL!>?.<!>equals(null) - command.equals1(null) - command<!UNNECESSARY_SAFE_CALL!>?.<!>equals1(null) - - val c = Command() - c<!UNNECESSARY_SAFE_CALL!>?.<!>equals2(null) - - if (command == null) 1 - } - -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/ForRangeConventions.jet b/idea/testData/checkerWithErrorTypes/quick/ForRangeConventions.jet deleted file mode 100644 index 61c797c6282..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/ForRangeConventions.jet +++ /dev/null @@ -1,80 +0,0 @@ -import <!UNRESOLVED_REFERENCE!>java<!>.util.*; - -class NotRange1() { - -} - -abstract class NotRange2() { - abstract fun iterator() : Unit -} - -abstract class ImproperIterator1 { - abstract fun hasNext() : Boolean -} - -abstract class NotRange3() { - abstract fun iterator() : ImproperIterator1 -} - -abstract class ImproperIterator2 { - abstract fun next() : Boolean -} - -abstract class NotRange4() { - abstract fun iterator() : ImproperIterator2 -} - -abstract class ImproperIterator3 { - abstract fun hasNext() : Int - abstract fun next() : Int -} - -abstract class NotRange5() { - abstract fun iterator() : ImproperIterator3 -} - -abstract class AmbiguousHasNextIterator { - abstract fun hasNext() : Boolean - val hasNext : Boolean get() = false - abstract fun next() : Int -} - -abstract class NotRange6() { - abstract fun iterator() : AmbiguousHasNextIterator -} - -abstract class ImproperIterator4 { - val hasNext : Int get() = 1 - abstract fun next() : Int -} - -abstract class NotRange7() { - abstract fun iterator() : ImproperIterator3 -} - -abstract class GoodIterator { - abstract fun hasNext() : Boolean - abstract fun next() : Int -} - -abstract class Range0() { - abstract fun iterator() : GoodIterator -} - -abstract class Range1() { - abstract fun iterator() : Iterator<Int> -} - -fun test(notRange1: NotRange1, notRange2: NotRange2, notRange3: NotRange3, notRange4: NotRange4, notRange5: NotRange5, notRange6: NotRange6, notRange7: NotRange7, range0: Range0, range1: Range1) { - for (i in <!ITERATOR_MISSING!>notRange1<!>); - for (i in <!HAS_NEXT_MISSING, NEXT_MISSING!>notRange2<!>); - for (i in <!NEXT_MISSING!>notRange3<!>); - for (i in <!HAS_NEXT_MISSING!>notRange4<!>); - for (i in <!HAS_NEXT_FUNCTION_TYPE_MISMATCH!>notRange5<!>); - for (i in <!HAS_NEXT_PROPERTY_AND_FUNCTION_AMBIGUITY!>notRange6<!>); - for (i in <!HAS_NEXT_FUNCTION_TYPE_MISMATCH!>notRange7<!>); - for (i in range0); - for (i in range1); - - for (i in (ArrayList<Int>() : List<Int>)); -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/FunctionReturnTypes.jet b/idea/testData/checkerWithErrorTypes/quick/FunctionReturnTypes.jet deleted file mode 100644 index 428c84ab0f1..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/FunctionReturnTypes.jet +++ /dev/null @@ -1,166 +0,0 @@ -fun none() {} - -fun unitEmptyInfer() {} -fun unitEmpty() : Unit {} -fun unitEmptyReturn() : Unit {return} -fun unitIntReturn() : Unit {return <!TYPE_MISMATCH!>1<!>} -fun unitUnitReturn() : Unit {return ()} -fun test1() : Any = {<!RETURN_NOT_ALLOWED, RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY!>return<!>} -fun test2() : Any = @a {return@a 1} -fun test3() : Any { <!RETURN_TYPE_MISMATCH!>return<!> } - -fun bbb() { - return <!TYPE_MISMATCH!>1<!> -} - -fun foo(expr: <!UNRESOLVED_REFERENCE!>StringBuilder<!>): Int { - val c = 'a' - when(c) { - 0.chr => throw <!UNRESOLVED_REFERENCE!>Exception<!>("zero") - else => throw <!UNRESOLVED_REFERENCE!>Exception<!>("nonzero" + c) - } -} - - -fun unitShort() : Unit = () -fun unitShortConv() : Unit = <!TYPE_MISMATCH!>1<!> -fun unitShortNull() : Unit = <!TYPE_MISMATCH!>null<!> - -fun intEmpty() : Int <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>{}<!> -fun intShortInfer() = 1 -fun intShort() : Int = 1 -//fun intBlockInfer() {1} -fun intBlock() : Int {return 1} -fun intBlock() : Int {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>1<!>} - -fun intString(): Int = <!TYPE_MISMATCH!>"s"<!> -fun intFunctionLiteral(): Int = <!TYPE_MISMATCH!>{ 10 }<!> - -fun blockReturnUnitMismatch() : Int {<!RETURN_TYPE_MISMATCH!>return<!>} -fun blockReturnValueTypeMismatch() : Int {return <!ERROR_COMPILE_TIME_VALUE!>3.4<!>} -fun blockReturnValueTypeMatch() : Int {return 1} -fun blockReturnValueTypeMismatchUnit() : Int {return <!TYPE_MISMATCH!>()<!>} - -fun blockAndAndMismatch() : Int { - <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>true && false<!> -} -fun blockAndAndMismatch() : Int { - return <!TYPE_MISMATCH!>true && false<!> -} -fun blockAndAndMismatch() : Int { - <!UNREACHABLE_CODE!>(return <!ERROR_COMPILE_TIME_VALUE!>true<!>) && (return <!ERROR_COMPILE_TIME_VALUE!>false<!>)<!> -} - -fun blockAndAndMismatch() : Int { - <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>true || false<!> -} -fun blockAndAndMismatch() : Int { - return <!TYPE_MISMATCH!>true || false<!> -} -fun blockAndAndMismatch() : Int { - <!UNREACHABLE_CODE!>(return <!ERROR_COMPILE_TIME_VALUE!>true<!>) || (return <!ERROR_COMPILE_TIME_VALUE!>false<!>)<!> -} -fun blockReturnValueTypeMatch() : Int { - return if (1 > 2) <!ERROR_COMPILE_TIME_VALUE!>1.0<!> else <!ERROR_COMPILE_TIME_VALUE!>2.0<!> -} -fun blockReturnValueTypeMatch() : Int { - return <!TYPE_MISMATCH!>if (1 > 2) 1<!> -} -fun blockReturnValueTypeMatch() : Int { - return <!TYPE_MISMATCH!>if (1 > 2) else 1<!> -} -fun blockReturnValueTypeMatch() : Int { - if (1 > 2) - return <!ERROR_COMPILE_TIME_VALUE!>1.0<!> - else return <!ERROR_COMPILE_TIME_VALUE!>2.0<!> -} -fun blockReturnValueTypeMatch() : Int { - if (1 > 2) - return <!ERROR_COMPILE_TIME_VALUE!>1.0<!> - return <!ERROR_COMPILE_TIME_VALUE!>2.0<!> -} -fun blockReturnValueTypeMatch() : Int { - if (1 > 2) - else return <!ERROR_COMPILE_TIME_VALUE!>1.0<!> - return <!ERROR_COMPILE_TIME_VALUE!>2.0<!> -} -fun blockReturnValueTypeMatch() : Int { - if (1 > 2) - <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>1.0<!> - else <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>2.0<!> -} -fun blockReturnValueTypeMatch() : Int { - if (1 > 2) - 1.0 - else 2.0 - return 1 -} -fun blockReturnValueTypeMatch() : Int { - <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>if (1 > 2) - <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>1.0<!><!> -} -fun blockReturnValueTypeMatch() : Int { - return <!TYPE_MISMATCH!>if (1 > 2) - 1<!> -} -fun blockReturnValueTypeMatch() : Int { - <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>if (1 > 2) - else <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>1.0<!><!> -} -fun blockReturnValueTypeMatch() : Int { - if (1 > 2) - return 1 - else return <!ERROR_COMPILE_TIME_VALUE!>1.0<!> -} -fun blockNoReturnIfValDeclaration(): Int { - <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>val x = 1<!> -} -fun blockNoReturnIfEmptyIf(): Int { - if (1 < 2) <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>{}<!> else <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>{}<!> -} -fun blockNoReturnIfUnitInOneBranch(): Int { - if (1 < 2) { - return 1 - } else { - if (3 < 4) <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>{ - }<!> else { - return 2 - } - } -} -fun nonBlockReturnIfEmptyIf(): Int = if (1 < 2) <!TYPE_MISMATCH!>{}<!> else <!TYPE_MISMATCH!>{}<!> -fun nonBlockNoReturnIfUnitInOneBranch(): Int = if (1 < 2) <!TYPE_MISMATCH!>{}<!> else 2 - -val a = <!RETURN_NOT_ALLOWED!>return 1<!> - -class A() { - this(a : Int) : this() { - if (a == 1) - return - return <!TYPE_MISMATCH!>1<!> - } - -} -fun illegalConstantBody(): Int = <!TYPE_MISMATCH!>"s"<!> -fun illegalConstantBlock(): String { - return <!ERROR_COMPILE_TIME_VALUE!>1<!> -} -fun illegalIfBody(): Int = - if (1 < 2) <!ERROR_COMPILE_TIME_VALUE!>'a'<!> else { <!ERROR_COMPILE_TIME_VALUE!>1.0<!> } -fun illegalIfBlock(): Boolean { - if (1 < 2) - return false - else { return <!ERROR_COMPILE_TIME_VALUE!>1<!> } -} -fun illegalReturnIf(): Char { - return if (1 < 2) 'a' else { <!ERROR_COMPILE_TIME_VALUE!>1<!> } -} - -fun returnNothing(): Nothing { - throw 1 -} -fun f(): Int { - if (1 < 2) { return 1 } else returnNothing() -} - -fun f(): Int = if (1 < 2) 1 else returnNothing() \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/GenericArgumentConsistency.jet b/idea/testData/checkerWithErrorTypes/quick/GenericArgumentConsistency.jet deleted file mode 100644 index fafd2cf98c8..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/GenericArgumentConsistency.jet +++ /dev/null @@ -1,42 +0,0 @@ -trait A<in T> {} -trait B<T> : A<Int> {} -trait C<T> : <!INCONSISTENT_TYPE_PARAMETER_VALUES!>B<T>, A<T><!> {} -trait C1<T> : B<T>, A<Any> {} -trait D : <!INCONSISTENT_TYPE_PARAMETER_VALUES, INCONSISTENT_TYPE_PARAMETER_VALUES!>C<Boolean>, B<Double><!>{} - -trait A1<out T> {} -trait B1 : A1<Int> {} -trait B2 : A1<Any>, B1 {} - -trait BA1<T> {} -trait BB1 : BA1<Int> {} -trait BB2 : <!INCONSISTENT_TYPE_PARAMETER_VALUES!>BA1<Any>, BB1<!> {} - - -namespace x { - trait AA1<out T> {} - trait AB1 : AA1<Int> {} - trait AB3 : AA1<Comparable<Int>> {} - trait AB2 : AA1<Number>, AB1, AB3 {} -} - -namespace x2 { - trait AA1<out T> {} - trait AB1 : AA1<Any> {} - trait AB3 : AA1<Comparable<Int>> {} - trait AB2 : <!INCONSISTENT_TYPE_PARAMETER_VALUES!>AA1<Number>, AB1, AB3<!> {} -} - -namespace x3 { - trait AA1<in T> {} - trait AB1 : AA1<Any> {} - trait AB3 : AA1<Comparable<Int>> {} - trait AB2 : AA1<Number>, AB1, AB3 {} -} - -namespace sx2 { - trait AA1<in T> {} - trait AB1 : AA1<Int> {} - trait AB3 : AA1<Comparable<Int>> {} - trait AB2 : <!INCONSISTENT_TYPE_PARAMETER_VALUES!>AA1<Number>, AB1, AB3<!> {} -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/IncDec.jet b/idea/testData/checkerWithErrorTypes/quick/IncDec.jet deleted file mode 100644 index 5b7143f3eef..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/IncDec.jet +++ /dev/null @@ -1,46 +0,0 @@ -class IncDec() { - fun inc() : IncDec = this - fun dec() : IncDec = this -} - -fun testIncDec() { - var x = IncDec() - x++ - ++x - x-- - --x - x = x++ - x = x-- - x = ++x - x = --x -} - -class WrongIncDec() { - fun inc() : Int = 1 - fun dec() : Int = 1 -} - -fun testWrongIncDec() { - var x = WrongIncDec() - x<!RESULT_TYPE_MISMATCH!>++<!> - <!RESULT_TYPE_MISMATCH!>++<!>x - x<!RESULT_TYPE_MISMATCH!>--<!> - <!RESULT_TYPE_MISMATCH!>--<!>x -} - -class UnitIncDec() { - fun inc() : Unit {} - fun dec() : Unit {} -} - -fun testUnitIncDec() { - var x = UnitIncDec() - x++ - ++x - x-- - --x - x = <!TYPE_MISMATCH!>x++<!> - x = <!TYPE_MISMATCH!>x--<!> - x = <!TYPE_MISMATCH!>++x<!> - x = <!TYPE_MISMATCH!>--x<!> -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/IsExpressions.jet b/idea/testData/checkerWithErrorTypes/quick/IsExpressions.jet deleted file mode 100644 index 960f3711e37..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/IsExpressions.jet +++ /dev/null @@ -1,7 +0,0 @@ -fun test() { - if (1 is Int) { - if (1 is <!INCOMPATIBLE_TYPES!>Boolean<!>) { - - } - } -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/MultipleBounds.jet b/idea/testData/checkerWithErrorTypes/quick/MultipleBounds.jet deleted file mode 100644 index 942d7f1630f..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/MultipleBounds.jet +++ /dev/null @@ -1,72 +0,0 @@ -namespace Jet87 - -open class A() { - fun foo() : Int = 1 -} - -trait B { - fun bar() : Double = 1.0; -} - -class C() : A(), B - -class D() { - class object : A(), B {} -} - -class Test1<T : A>() - where - T : B, - <!NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER!>B<!> : T, // error - class object T : A, - class object T : B, - class object <!NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER!>B<!> : T - { - - fun test(t : T) { - T.foo() - T.bar() - t.foo() - t.bar() - } -} - -fun test() { - Test1<<!UPPER_BOUND_VIOLATED!>B<!>>() - Test1<<!UPPER_BOUND_VIOLATED!>A<!>>() - Test1<C>() -} - -class Foo() {} - -class Bar<T : <!FINAL_UPPER_BOUND!>Foo<!>> - -class Buzz<T> where T : <!FINAL_UPPER_BOUND!>Bar<<!UPPER_BOUND_VIOLATED!>Int<!>><!>, T : <!UNRESOLVED_REFERENCE!>nioho<!> - -class X<T : <!FINAL_UPPER_BOUND!>Foo<!>> -class Y<<!CONFLICTING_UPPER_BOUNDS!>T<!> : <!FINAL_UPPER_BOUND!>Foo<!>> where T : <!FINAL_UPPER_BOUND!>Bar<Foo><!> - -fun <T : A> test2(t : T) - where - T : B, - <!NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER!>B<!> : T, - class object <!NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER!>B<!> : T, - class object T : B, - class object T : A -{ - T.foo() - T.bar() - t.foo() - t.bar() -} - -val t1 = test2<<!UPPER_BOUND_VIOLATED!>A<!>>(A()) -val t2 = test2<<!UPPER_BOUND_VIOLATED!>B<!>>(C()) -val t3 = test2<C>(C()) - -class Test<<!CONFLICTING_CLASS_OBJECT_UPPER_BOUNDS!>T<!>> - where - class object T : <!FINAL_CLASS_OBJECT_UPPER_BOUND!>Foo<!>, - class object T : A {} - -val <T, B : T> x : Int = 0 \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/NamespaceAsExpression.jet b/idea/testData/checkerWithErrorTypes/quick/NamespaceAsExpression.jet deleted file mode 100644 index 4ef4bd01ced..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/NamespaceAsExpression.jet +++ /dev/null @@ -1,8 +0,0 @@ -namespace root - -namespace a { - -} - -val x = <!EXPRESSION_EXPECTED_NAMESPACE_FOUND, UNRESOLVED_REFERENCE!>a<!> -val y2 = <!NAMESPACE_IS_NOT_AN_EXPRESSION!>namespace<!> \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/NamespaceQualified.jet b/idea/testData/checkerWithErrorTypes/quick/NamespaceQualified.jet deleted file mode 100644 index 1b280e7a644..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/NamespaceQualified.jet +++ /dev/null @@ -1,63 +0,0 @@ -namespace foobar - -namespace a { - import <!UNRESOLVED_REFERENCE!>java<!>.* - - val a : <!UNRESOLVED_REFERENCE!>util<!>.List<Int>? = null - val a1 : <!UNRESOLVED_REFERENCE!>List<!><Int>? = null - -} - -abstract class Foo<T>() { - abstract val x : T<Int> -} - -namespace a { - import <!UNRESOLVED_REFERENCE!>java<!>.util.* - - val b : List<Int>? = a - val b1 : util.List<Int>? = a -} - -val x1 = a.a - -val y1 = a.b - - -///////////////////////////////////////////////////////////////////////// - -fun done<O>(result : O) : Iteratee<Any?, O> = StrangeIterateeImpl<Any?, O>(result) - -abstract class Iteratee<in I, out O> { - abstract fun process(item : I) : Iteratee<I, O> - abstract val isDone : Boolean - abstract val result : O - abstract fun done() : O -} - -class StrangeIterateeImpl<in I, out O>(val obj: O) : Iteratee<I, O> { - override fun process(item: I): Iteratee<I, O> = StrangeIterateeImpl<I, O>(obj) - override val isDone = true - override val result = obj - override fun done() = obj -} - -abstract class Sum() : Iteratee<Int, Int> { - override fun process(item : Int) : Iteratee<Int, Int> { - return foobar.done<Int>(item); - } - abstract override val isDone : Boolean - abstract override val result : Int - abstract override fun done() : Int -} - -abstract class Collection<E> : Iterable<E> { - fun iterate<O>(iteratee : Iteratee<E, O>) : O { - for (x in this) { - val it = iteratee.process(x) - if (it.isDone) return it.result - iteratee = it - } - return iteratee.done() - } -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/Nullability.jet b/idea/testData/checkerWithErrorTypes/quick/Nullability.jet deleted file mode 100644 index d803a36e15a..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/Nullability.jet +++ /dev/null @@ -1,280 +0,0 @@ -fun test() { - val a : Int? = 0 - if (a != null) { - a.plus(1) - } - else { - a?.plus(1) - } - - val out : <!UNRESOLVED_REFERENCE!>java<!>.io.PrintStream? = null//= System.out - val ins = <!UNRESOLVED_REFERENCE!>System<!>.`in` - - out?.println() - ins<!UNNECESSARY_SAFE_CALL!>?.<!>read() - - if (ins != null) { - ins.read() - out?.println() - if (out != null) { - ins.read(); - out.println(); - } - } - - if (out != null && ins != null) { - ins.read(); - out.println(); - } - - if (out == null) { - out?.println() - } else { - out.println() - } - - if (out != null && ins != null || out != null) { - ins<!UNNECESSARY_SAFE_CALL!>?.<!>read(); - out.println(); - } - - if (out == null || out.println(0) == ()) { - out?.println(1) - } - else { - out.println(2) - } - - if (out != null && out.println() == ()) { - out.println(); - } - else { - out?.println(); - } - - if (out == null || out != null && out.println() == ()) { - out?.println(); - } - else { - out.println(); - } - - if (1 == 2 || out != null && out.println(1) == ()) { - out?.println(2); - } - else { - out?.println(3) - } - - out?.println() - ins<!UNNECESSARY_SAFE_CALL!>?.<!>read() - - if (ins != null) { - ins.read() - out?.println() - if (out != null) { - ins.read(); - out.println(); - } - } - - if (out != null && ins != null) { - ins.read(); - out.println(); - } - - if (out == null) { - out?.println() - } else { - out.println() - } - - if (out != null && ins != null || out != null) { - ins<!UNNECESSARY_SAFE_CALL!>?.<!>read(); - out.println(); - } - - if (out == null || out.println(0) == ()) { - out?.println(1) - } - else { - out.println(2) - } - - if (out != null && out.println() == ()) { - out.println(); - } - else { - out?.println(); - } - - if (out == null || out != null && out.println() == ()) { - out?.println(); - } - else { - out.println(); - } - - if (1 == 2 || out != null && out.println(1) == ()) { - out?.println(2); - } - else { - out?.println(3) - } - - if (1 > 2) { - if (out == null) return; - out.println(); - } - out?.println(); - - while (out != null) { - out.println(); - } - out?.println(); - - while (out == null) { - out?.println(); - } - out.println() - -} - - -fun f(out : String?) { - out?.get(0) - if (out != null) else return; - out.get(0) -} - -fun f1(out : String?) { - out?.get(0) - if (out != null) else { - 1 + 2 - return; - } - out.get(0) -} - -fun f2(out : String?) { - out?.get(0) - if (out == null) { - 1 + 2 - return; - } - out.get(0) -} - -fun f3(out : String?) { - out?.get(0) - if (out == null) { - 1 + 2 - return; - } - else { - 1 + 2 - } - out.get(0) -} - -fun f4(s : String?) { - s?.get(0) - while (1 < 2 && s != null) { - s.get(0) - } - s?.get(0) - while (s == null || 1 < 2) { - s?.get(0) - } - s.get(0) -} - -fun f5(s : String?) { - s?.get(0) - while (1 < 2 && s != null) { - s.get(0) - } - s?.get(0) - while (s == null || 1 < 2) { - if (1 > 2) break - s?.get(0) - } - s?.get(0); -} - -fun f6(s : String?) { - s?.get(0) - do { - s?.get(0) - if (1 < 2) break; - } while (s == null) - s?.get(0) - do { - s?.get(0) - } while (s == null) - s.get(0) -} - -fun f7(s : String?, t : String?) { - s?.get(0) - if (!(s == null)) { - s.get(0) - } - s?.get(0) - if (!(s != null)) { - s?.get(0) - } - else { - s.get(0) - } - s?.get(0) - if (!!(s != null)) { - s.get(0) - } - else { - s?.get(0) - } - s?.get(0) - t?.get(0) - if (!(s == null || t == null)) { - s.get(0) - t.get(0) - } - else { - s?.get(0) - t?.get(0) - } - s?.get(0) - t?.get(0) - if (!(s == null && s == null)) { - s.get(0) - t?.get(0) - } - else { - s?.get(0) - t?.get(0) - } -} - -fun f8(b : String?, a : String) { - b?.get(0) - if (b == a) { - b.get(0); - } - b?.get(0) - if (a == b) { - b.get(0) - } - if (a != b) { - b?.get(0) - } - else { - b.get(0) - } -} - -fun f9(a : Int?) : Int { - if (a != null) - return a - return 1 -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/Objects.jet b/idea/testData/checkerWithErrorTypes/quick/Objects.jet deleted file mode 100644 index 378534ea4d3..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/Objects.jet +++ /dev/null @@ -1,83 +0,0 @@ -namespace toplevelObjectDeclarations { - open class Foo(y : Int) { - open fun foo() : Int = 1 - } - - class T : <!SUPERTYPE_NOT_INITIALIZED!>Foo<!> {} - - object A : <!SUPERTYPE_NOT_INITIALIZED!>Foo<!> { - val x : Int = 2 - - fun test() : Int { - return x + foo() - } - } - - object B : <!UNRESOLVED_REFERENCE!>A<!> {} - - val x = A.foo() - - val y = object : Foo(x) { - { - x + 12 - } - - override fun foo() : Int = 1 - } - - val z = y.foo() -} - -namespace nestedObejcts { - object A { - val b = B - val d = A.B.A - - object B { - val a = A - val e = B.A - - object A { - val a = A - val b = B - val x = nestedObejcts.A.B.A - val y = this<!AMBIGUOUS_LABEL!>@A<!> - } - } - - } - object B { - val b = B - val c = A.B - } - - val a = A - val b = B - val c = A.B - val d = A.B.A - val e = B.<!UNRESOLVED_REFERENCE!>A<!>.B -} - -namespace localObjects { - object A { - val x : Int = 0 - } - - open class Foo { - fun foo() : Int = 1 - } - - fun test() { - A.x - val b = object : Foo { - } - b.foo() - - object B { - fun foo() {} - } - B.foo() - } - - val bb = <!UNRESOLVED_REFERENCE!>B<!>.foo() -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/Override.jet b/idea/testData/checkerWithErrorTypes/quick/Override.jet deleted file mode 100644 index fecb1c72304..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/Override.jet +++ /dev/null @@ -1,76 +0,0 @@ -namespace override - -namespace normal { - trait MyTrait { - fun foo() - } - - abstract class MyAbstractClass { - abstract fun bar() - } - - open class MyClass : MyTrait, MyAbstractClass { - override fun foo() {} - override fun bar() {} - } - - class MyChildClass : MyClass {} - - class <!ABSTRACT_METHOD_NOT_IMPLEMENTED!>MyIllegalClass<!> : MyTrait, MyAbstractClass {} - - class <!ABSTRACT_METHOD_NOT_IMPLEMENTED!>MyIllegalClass2<!> : MyTrait, MyAbstractClass { - override fun foo() {} - } - - class <!ABSTRACT_METHOD_NOT_IMPLEMENTED!>MyIllegalClass3<!> : MyTrait, MyAbstractClass { - override fun bar() {} - } - - class <!ABSTRACT_METHOD_NOT_IMPLEMENTED!>MyIllegalClass4<!> : MyTrait, MyAbstractClass { - fun <!VIRTUAL_METHOD_HIDDEN!>foo<!>() {} - <!NOTHING_TO_OVERRIDE!>override<!> fun other() {} - } - - class MyChildClass1 : MyClass { - fun <!VIRTUAL_METHOD_HIDDEN!>foo<!>() {} - override fun bar() {} - } -} - -namespace generics { - trait MyTrait<T> { - fun foo(t: T) : T - } - - abstract class MyAbstractClass<T> { - abstract fun bar(t: T) : T - } - - open class MyGenericClass<T> : MyTrait<T>, MyAbstractClass<T> { - override fun foo(t: T) = t - override fun bar(t: T) = t - } - - class MyChildClass : MyGenericClass<Int> {} - class MyChildClass1<T> : MyGenericClass<T> {} - class MyChildClass2<T> : MyGenericClass<T> { - fun <!VIRTUAL_METHOD_HIDDEN!>foo<!>(t: T) = t - override fun bar(t: T) = t - } - - open class MyClass : MyTrait<Int>, MyAbstractClass<String> { - override fun foo(i: Int) = i - override fun bar(s: String) = s - } - - class <!ABSTRACT_METHOD_NOT_IMPLEMENTED!>MyIllegalGenericClass1<!><T> : MyTrait<T>, MyAbstractClass<T> {} - class <!ABSTRACT_METHOD_NOT_IMPLEMENTED!>MyIllegalGenericClass2<!><T, R> : MyTrait<T>, MyAbstractClass<R> { - <!NOTHING_TO_OVERRIDE!>override<!> fun foo(r: R) = r - } - class <!ABSTRACT_METHOD_NOT_IMPLEMENTED!>MyIllegalClass1<!> : MyTrait<Int>, MyAbstractClass<String> {} - - class <!ABSTRACT_METHOD_NOT_IMPLEMENTED!>MyIllegalClass2<!><T> : MyTrait<Int>, MyAbstractClass<Int> { - fun foo(t: T) = t - fun bar(t: T) = t - } -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/PrimaryConstructors.jet b/idea/testData/checkerWithErrorTypes/quick/PrimaryConstructors.jet deleted file mode 100644 index 8756860955f..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/PrimaryConstructors.jet +++ /dev/null @@ -1,14 +0,0 @@ -class <!PRIMARY_CONSTRUCTOR_MISSING_STATEFUL_PROPERTY!>X<!> { - val <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>x<!> : Int -} - -open class Y() { - val x : Int = 2 -} - -class Y1 { - val x : Int get() = 1 -} - -class Z : Y<!PRIMARY_CONSTRUCTOR_MISSING_SUPER_CONSTRUCTOR_CALL!>()<!> { -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/ProjectionsInSupertypes.jet b/idea/testData/checkerWithErrorTypes/quick/ProjectionsInSupertypes.jet deleted file mode 100644 index c02bb72b6a2..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/ProjectionsInSupertypes.jet +++ /dev/null @@ -1,6 +0,0 @@ -trait A<T> {} -trait B<T> {} -trait C<T> {} -trait D<T> {} - -trait Test : A<<!PROJECTION_IN_IMMEDIATE_ARGUMENT_TO_SUPERTYPE!>in<!> Int>, B<<!PROJECTION_IN_IMMEDIATE_ARGUMENT_TO_SUPERTYPE!>out<!> Int>, C<<!PROJECTION_IN_IMMEDIATE_ARGUMENT_TO_SUPERTYPE!>*<!>><!NULLABLE_SUPERTYPE!>?<!><!NULLABLE_SUPERTYPE!>?<!><!NULLABLE_SUPERTYPE!>?<!>, D<Int> {} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/Properties.jet b/idea/testData/checkerWithErrorTypes/quick/Properties.jet deleted file mode 100644 index a20950ac88a..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/Properties.jet +++ /dev/null @@ -1,28 +0,0 @@ -var x : Int = 1 + x - get() : Int = 1 - set(<!REF_SETTER_PARAMETER!>ref<!> value : <!WRONG_SETTER_PARAMETER_TYPE!>Long<!>) { - $x = value.int - $x = <!TYPE_MISMATCH!>1.lng<!> - } - - val xx : Int = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>1 + x<!> - get() : Int = 1 - <!VAL_WITH_SETTER!>set(value : Long) {}<!> - - val p : Int = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>1<!> - get() = 1 - -class Test() { - var a : Int = 111 - var b : Int get() = <!UNRESOLVED_REFERENCE!>$a<!>; set(x) {a = x; <!UNRESOLVED_REFERENCE!>$a<!> = x} - - this(i : Int) : this() { - <!NO_BACKING_FIELD!>$b<!> = $a - $a = <!NO_BACKING_FIELD!>$b<!> - a = <!NO_BACKING_FIELD!>$b<!> - } - fun f() { - <!UNRESOLVED_REFERENCE!>$b<!> = <!UNRESOLVED_REFERENCE!>$a<!> - a = <!UNRESOLVED_REFERENCE!>$b<!> - } -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/QualifiedExpressions.jet b/idea/testData/checkerWithErrorTypes/quick/QualifiedExpressions.jet deleted file mode 100644 index 67233fd840f..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/QualifiedExpressions.jet +++ /dev/null @@ -1,11 +0,0 @@ -namespace qualified_expressions - -fun test(s: String?) { - val a: Int = <!TYPE_MISMATCH!>s?.length<!> - val b: Int? = s?.length - val c: Int = s?.length ?: -11 - val d: Int = s?.length ?: <!TYPE_MISMATCH!>"empty"<!> - val e: String = <!TYPE_MISMATCH!>s?.length<!> ?: "empty" - val f: Int = s?.length ?: b ?: 1 - val g: Int? = e? startsWith("s")?.length -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/QualifiedThis.jet b/idea/testData/checkerWithErrorTypes/quick/QualifiedThis.jet deleted file mode 100644 index 33fdf5dd8f5..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/QualifiedThis.jet +++ /dev/null @@ -1,41 +0,0 @@ -class Dup { - fun Dup() : Unit { - this<!AMBIGUOUS_LABEL!>@Dup<!> - } -} - -class A() { - fun foo() : Unit { - this@A - this<!UNRESOLVED_REFERENCE!>@a<!> - this - } - - val x = this@A.foo() - val y = this.foo() - val z = foo() -} - -fun foo1() : Unit { - <!NO_THIS!>this<!> - this<!UNRESOLVED_REFERENCE!>@a<!> -} - -namespace closures { - class A(val a:Int) { - - class B() { - val x = this@B : B - val y = this@A : A - val z = this : B - val Int.xx = this : Int - fun Char.xx() : Any { - this : Char - val a = {Double.() => this : Double + this@xx : Char} - val b = @a{Double.() => this@a : Double + this@xx : Char} - val c = @a{() => <!NO_THIS!>this@a<!> + this@xx : Char} - return (@a{Double.() => this@a : Double + this@xx : Char}) - } - } - } -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/RecursiveTypeInference.jet b/idea/testData/checkerWithErrorTypes/quick/RecursiveTypeInference.jet deleted file mode 100644 index 11eb880a193..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/RecursiveTypeInference.jet +++ /dev/null @@ -1,42 +0,0 @@ -namespace a { - val foo = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>bar()<!> - - fun bar() = foo -} - -namespace b { - fun foo() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>bar()<!> - - fun bar() = foo() -} - -namespace c { - fun bazz() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>bar()<!> - - fun foo() = bazz() - - fun bar() = foo() -} - -namespace ok { - - namespace a { - val foo = bar() - - fun bar() : Int = foo - } - - namespace b { - fun foo() : Int = bar() - - fun bar() = foo() - } - - namespace c { - fun bazz() = bar() - - fun foo() : Int = bazz() - - fun bar() = foo() - } -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/ResolveToJava.jet b/idea/testData/checkerWithErrorTypes/quick/ResolveToJava.jet deleted file mode 100644 index dacaa387022..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/ResolveToJava.jet +++ /dev/null @@ -1,52 +0,0 @@ -import <!UNRESOLVED_REFERENCE!>java<!>.* -import <!UNRESOLVED_REFERENCE!>util<!>.* -import <!UNRESOLVED_REFERENCE!>utils<!>.* - -import <!UNRESOLVED_REFERENCE!>java<!>.io.PrintStream -import <!UNRESOLVED_REFERENCE!>java<!>.lang.Comparable as Com - -val l : <!UNRESOLVED_REFERENCE!>List<!><in Int> = <!UNRESOLVED_REFERENCE!>ArrayList<!><Int>() - -fun test(l : <!UNRESOLVED_REFERENCE!>java<!>.util.List<Int>) { - val x : <!UNRESOLVED_REFERENCE!>java<!>.List - val y : <!UNRESOLVED_REFERENCE!>java<!>.util.List<Int> - val b : <!UNRESOLVED_REFERENCE!>java<!>.lang.Object - val a : <!UNRESOLVED_REFERENCE!>util<!>.List<Int> - val z : <!UNRESOLVED_REFERENCE!>java<!>.utils.List<Int> - - val f : <!UNRESOLVED_REFERENCE!>java<!>.io.File? = null - - <!UNRESOLVED_REFERENCE!>Collections<!>.emptyList - <!UNRESOLVED_REFERENCE!>Collections<!>.emptyList<Int> - <!UNRESOLVED_REFERENCE!>Collections<!>.emptyList<Int>() - <!UNRESOLVED_REFERENCE!>Collections<!>.emptyList() - - <!UNRESOLVED_REFERENCE!>Collections<!>.singleton<Int>(1) : <!UNRESOLVED_REFERENCE!>Set<!><Int>? - <!UNRESOLVED_REFERENCE!>Collections<!>.singleton<Int>(1.0) - - <!UNRESOLVED_REFERENCE!>List<!><Int> - - - val o = "sdf" <!USELESS_CAST!>as<!> <!UNRESOLVED_REFERENCE!>Object<!> - - try { - // ... - } - catch(e: <!UNRESOLVED_REFERENCE!>Exception<!>) { - <!UNRESOLVED_REFERENCE!>System<!>.out<!UNNECESSARY_SAFE_CALL!>?.<!>println(e.getMessage()) - } - - <!UNRESOLVED_REFERENCE!>PrintStream<!>("sdf") - - val c : Com<Int>? = null - - c : <!UNRESOLVED_REFERENCE!>java<!>.lang.Comparable<Int>? - -// Collections.sort<Integer>(ArrayList<Integer>()) - xxx.<!UNRESOLVED_REFERENCE!>Class<!>() -} - - -namespace xxx { - import <!UNRESOLVED_REFERENCE!>java<!>.lang.Class; -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/StringTemplates.jet b/idea/testData/checkerWithErrorTypes/quick/StringTemplates.jet deleted file mode 100644 index 108ffe1d7dd..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/StringTemplates.jet +++ /dev/null @@ -1,21 +0,0 @@ -fun demo() { - val abc = 1 - val a = "" - val asd = 1 - val bar = 5 - fun map(f : fun () : Any?) : Int = 1 - fun buzz(f : fun () : Any?) : Int = 1 - val sdf = 1 - val foo = 3; - "$abc" - "$" - "$.$.asdf$\t" - "asd\$" - "asd$a<!ILLEGAL_ESCAPE_SEQUENCE!>\x<!>" - "asd$a$asd$ $<!UNRESOLVED_REFERENCE!>xxx<!>" - "fosdfasdo${1 + bar + 100}}sdsdfgdsfsdf" - "foo${bar + map {foo}}sdfsdf" - "foo${bar + map { "foo" }}sdfsdf" - "foo${bar + map { - "foo$sdf${ buzz{}}" }}sdfsdf" -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/SupertypeListChecks.jet b/idea/testData/checkerWithErrorTypes/quick/SupertypeListChecks.jet deleted file mode 100644 index 78050c67ae8..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/SupertypeListChecks.jet +++ /dev/null @@ -1,50 +0,0 @@ -// KT-286 Check supertype lists - -/* -In a supertype list: - Same type should not be mentioned twice - Same type should not be indirectly mentioned with incoherent type arguments - Every trait's required dependencies should be satisfied - No final types should appear - Only one class is allowed -*/ - -class C1() - -open class OC1() - -open class C2 {} - -open class C3 {} - -trait T1 {} - -trait T2<T> {} - -trait Test<!CONSTRUCTOR_IN_TRAIT!>()<!> { - <!CONSTRUCTOR_IN_TRAIT, SECONDARY_CONSTRUCTOR_NO_INITIALIZER_LIST!>this<!>(x : Int) {} -} - -trait Test1 : C2<!SUPERTYPE_INITIALIZED_IN_TRAIT!>()<!> {} - -trait Test2 : C2 {} - -trait Test3 : C2, <!MANY_CLASSES_IN_SUPERTYPE_LIST!>C3<!> {} - -trait Test4 : T1 {} - -trait Test5 : T1, <!SUPERTYPE_APPEARS_TWICE!>T1<!> {} - -trait Test6 : <!FINAL_SUPERTYPE!>C1<!> {} - -class CTest1() : OC1() {} - -class CTest2 : C2 {} - -class CTest3 : C2, <!MANY_CLASSES_IN_SUPERTYPE_LIST!>C3<!> {} - -class CTest4 : T1 {} - -class CTest5 : T1, <!SUPERTYPE_APPEARS_TWICE!>T1<!> {} - -class CTest6 : <!SUPERTYPE_NOT_INITIALIZED, FINAL_SUPERTYPE!>C1<!> {} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/TraitSupertypeList.jet b/idea/testData/checkerWithErrorTypes/quick/TraitSupertypeList.jet deleted file mode 100644 index 7f109773457..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/TraitSupertypeList.jet +++ /dev/null @@ -1,11 +0,0 @@ -open class bar() - -trait Foo<!CONSTRUCTOR_IN_TRAIT!>()<!> : bar<!SUPERTYPE_INITIALIZED_IN_TRAIT!>()<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!> { - <!CONSTRUCTOR_IN_TRAIT, SECONDARY_CONSTRUCTOR_NO_INITIALIZER_LIST!>this<!>(x : Int) {} -} - -trait Foo2 : bar, Foo { -} - -open class Foo1() : bar(), <!SUPERTYPE_NOT_INITIALIZED, MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!>, Foo, <!SUPERTYPE_APPEARS_TWICE!>Foo<!><!CONSTRUCTOR_IN_TRAIT!>()<!> {} -open class Foo12 : bar<!PRIMARY_CONSTRUCTOR_MISSING_SUPER_CONSTRUCTOR_CALL!>()<!>, <!SUPERTYPE_NOT_INITIALIZED, MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!> {} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/UnreachableCode.jet b/idea/testData/checkerWithErrorTypes/quick/UnreachableCode.jet deleted file mode 100644 index c5ecb1191de..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/UnreachableCode.jet +++ /dev/null @@ -1,161 +0,0 @@ -fun t1() : Int{ - return 0 - <!UNREACHABLE_CODE!>1<!> -} - -fun t1a() : Int { - <!RETURN_TYPE_MISMATCH!>return<!> - <!UNREACHABLE_CODE!>return 1<!> - <!UNREACHABLE_CODE!>1<!> -} - -fun t1b() : Int { - return 1 - <!UNREACHABLE_CODE!>return 1<!> - <!UNREACHABLE_CODE!>1<!> -} - -fun t1c() : Int { - return 1 - <!RETURN_TYPE_MISMATCH, UNREACHABLE_CODE!>return<!> - <!UNREACHABLE_CODE!>1<!> -} - -fun t2() : Int { - if (1 > 2) - return 1 - else return 1 - <!UNREACHABLE_CODE!>1<!> -} - -fun t2a() : Int { - if (1 > 2) { - return 1 - <!UNREACHABLE_CODE!>1<!> - } else { return 1 - <!UNREACHABLE_CODE!>2<!> - } - <!UNREACHABLE_CODE!>1<!> -} - -fun t3() : Any { - if (1 > 2) - return 2 - else return "" - <!UNREACHABLE_CODE!>1<!> -} - -fun t4(a : Boolean) : Int { - do { - return 1 - } - while (<!UNREACHABLE_CODE!>a<!>) - <!UNREACHABLE_CODE!>1<!> -} - -fun t4break(a : Boolean) : Int { - do { - break - } - while (<!UNREACHABLE_CODE!>a<!>) - return 1 -} - -fun t5() : Int { - do { - return 1 - <!UNREACHABLE_CODE!>2<!> - } - while (<!UNREACHABLE_CODE!>1 > 2<!>) - <!UNREACHABLE_CODE!>return 1<!> -} - -fun t6() : Int { - while (1 > 2) { - return 1 - <!UNREACHABLE_CODE!>2<!> - } - return 1 -} - -fun t6break() : Int { - while (1 > 2) { - break - <!UNREACHABLE_CODE!>2<!> - } - return 1 -} - -fun t7(b : Int) : Int { - for (i in 1..b) { - return 1 - <!UNREACHABLE_CODE!>2<!> - } - return 1 -} - -fun t7break(b : Int) : Int { - for (i in 1..b) { - return 1 - <!UNREACHABLE_CODE!>2<!> - } - return 1 -} - -fun t7() : Int { - try { - return 1 - <!UNREACHABLE_CODE!>2<!> - } - catch (e : Any) { - 2 - } - return 1 // this is OK, like in Java -} - -fun t8() : Int { - try { - return 1 - <!UNREACHABLE_CODE!>2<!> - } - catch (e : Any) { - return 1 - <!UNREACHABLE_CODE!>2<!> - } - <!UNREACHABLE_CODE!>return 1<!> -} - -fun blockAndAndMismatch() : Boolean { - <!UNREACHABLE_CODE!>(return true) || (return false)<!> - <!UNREACHABLE_CODE!>return true<!> -} - -fun tf() : Int { - try {<!UNREACHABLE_CODE!>return 1<!>} finally{return 1} - <!UNREACHABLE_CODE!>return 1<!> -} - -fun failtest(a : Int) : Int { - <!UNREACHABLE_BECAUSE_OF_NOTHING!>if (fail() || true) { - - }<!> - <!UNREACHABLE_BECAUSE_OF_NOTHING!>return 1<!> -} - -fun foo(a : Nothing) : Unit { - 1 - a - <!UNREACHABLE_BECAUSE_OF_NOTHING!>2<!> -} - -fun fail() : Nothing { - throw <!UNRESOLVED_REFERENCE!>java<!>.lang.RuntimeException() -} - -fun nullIsNotNothing() : Unit { - val x : Int? = 1 - if (x != null) { - return - } - fail() -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/Unresolved.jet b/idea/testData/checkerWithErrorTypes/quick/Unresolved.jet deleted file mode 100644 index 8770659c971..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/Unresolved.jet +++ /dev/null @@ -1,30 +0,0 @@ -namespace unresolved - -fun testGenericArgumentsCount() { - val p1: Tuple2<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!> = (2, 2) - val p2: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Tuple2<!> = (2, 2) -} - -fun testUnresolved() { - if (<!UNRESOLVED_REFERENCE!>a<!> is String) { - val s = <!UNRESOLVED_REFERENCE!>a<!> - } - <!UNRESOLVED_REFERENCE!>foo<!>(<!UNRESOLVED_REFERENCE!>a<!>) - val s = "s" - <!UNRESOLVED_REFERENCE!>foo<!>(s) - foo1(<!UNRESOLVED_REFERENCE!>i<!>) - s.<!UNRESOLVED_REFERENCE!>foo<!>() - - when(<!UNRESOLVED_REFERENCE!>a<!>) { - is Int => <!UNRESOLVED_REFERENCE!>a<!> - is String => <!UNRESOLVED_REFERENCE!>a<!> - } - - //TODO - for (j in <!UNRESOLVED_REFERENCE!>collection<!>) { - val i: Int = j - j += 1 - } -} - -fun foo1(i: Int) {} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/Variance.jet b/idea/testData/checkerWithErrorTypes/quick/Variance.jet deleted file mode 100644 index 5a23caa9275..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/Variance.jet +++ /dev/null @@ -1,40 +0,0 @@ -namespace variance - -abstract class Consumer<in T> {} - -abstract class Producer<out T> {} - -abstract class Usual<T> {} - -fun foo(c: Consumer<Int>, p: Producer<Int>, u: Usual<Int>) { - val c1: Consumer<Any> = <!TYPE_MISMATCH!>c<!> - val c2: Consumer<Int> = c1 - - val p1: Producer<Any> = p - val p2: Producer<Int> = <!TYPE_MISMATCH!>p1<!> - - val u1: Usual<Any> = <!TYPE_MISMATCH!>u<!> - val u2: Usual<Int> = <!TYPE_MISMATCH!>u1<!> -} - -//Arrays copy example -class Array<T>(val length : Int) { - fun get(index : Int) : T { return null } - fun set(index : Int, value : T) { /* ... */ } -} - -fun copy1(from : Array<Any>, to : Array<Any>) {} - -fun copy2(from : Array<out Any>, to : Array<in Any>) {} - -fun <T> copy3(from : Array<out T>, to : Array<in T>) {} - -fun copy4(from : Array<out Number>, to : Array<in Int>) {} - -fun f(ints: Array<Int>, any: Array<Any>, numbers: Array<Number>) { - copy1(<!TYPE_MISMATCH!>ints<!>, any) - copy2(ints, any) //ok - copy2(ints, <!TYPE_MISMATCH!>numbers<!>) - copy3<Int>(ints, numbers) - copy4(ints, numbers) //ok -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/When.jet b/idea/testData/checkerWithErrorTypes/quick/When.jet deleted file mode 100644 index 1a4b8aa96f6..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/When.jet +++ /dev/null @@ -1,61 +0,0 @@ -fun foo() : Int { - val s = "" - val x = 1 - when (x) { - is * => 1 - is <!INCOMPATIBLE_TYPES!>String<!> => 1 - !is Int => 1 - is Any? => 1 - <!INCOMPATIBLE_TYPES!>s<!> => 1 - 1 => 1 - 1 + <!UNRESOLVED_REFERENCE!>a<!> => 1 - in 1..<!UNRESOLVED_REFERENCE!>a<!> => 1 - !in 1..<!UNRESOLVED_REFERENCE!>a<!> => 1 - .<!UNRESOLVED_REFERENCE!>a<!> => 1 - .equals(1).<!UNRESOLVED_REFERENCE!>a<!> => 1 - <!UNNECESSARY_SAFE_CALL!>?.<!>equals(1) => 1 - else => 1 - } - return when (<!USELESS_ELVIS!>x<!>?:null) { - <!UNSAFE_CALL!>.<!>equals(1) => 1 - ?.equals(1).equals(2) => 1 - } -} - -val _type_test : Int = foo() // this is needed to ensure the inferred return type of foo() - -fun test() { - val x = 1; - val s = ""; - - when (x) { - <!INCOMPATIBLE_TYPES!>s<!> => 1 - is <!INCOMPATIBLE_TYPES!>""<!> => 1 - x => 1 - is 1 => 1 - is <!TYPE_MISMATCH_IN_TUPLE_PATTERN!>(1, 1)<!> => 1 - } - - val z = (1, 1) - - when (z) { - is (*, *) => 1 - is (*, 1) => 1 - is (1, 1) => 1 - is (1, <!INCOMPATIBLE_TYPES!>"1"<!>) => 1 - is <!TYPE_MISMATCH_IN_TUPLE_PATTERN!>(1, "1", *)<!> => 1 - is boo @ (1, <!INCOMPATIBLE_TYPES!>"a"<!>, *) => 1 - is boo @ <!TYPE_MISMATCH_IN_TUPLE_PATTERN!>(1, *)<!> => 1 - } - - when (z) { - <!ELSE_MISPLACED_IN_WHEN!>else => 1<!> - (1, 1) => 2 - } - - when (z) { - else => 1 - } -} - -val (Int, Int).boo : (Int, Int, Int) = (1, 1, 1) \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/AmbiguityOnLazyTypeComputation.jet b/idea/testData/checkerWithErrorTypes/quick/regression/AmbiguityOnLazyTypeComputation.jet deleted file mode 100644 index 6d519d6b10b..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/AmbiguityOnLazyTypeComputation.jet +++ /dev/null @@ -1,12 +0,0 @@ -// One of the two passes is making a scope and turning vals into functions -// See KT-76 - -namespace x - -val b : Foo = Foo() -val a1 = b.compareTo(2) - -class Foo() { - fun compareTo(other : Byte) : Int = 0 - fun compareTo(other : Char) : Int = 0 -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/AssignmentsUnderOperators.jet b/idea/testData/checkerWithErrorTypes/quick/regression/AssignmentsUnderOperators.jet deleted file mode 100644 index 5a7c24b7fd0..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/AssignmentsUnderOperators.jet +++ /dev/null @@ -1,6 +0,0 @@ -fun test() { - val a : Any? = null - if (a is Any) else a = null; - while (a is Any) a = null - while (true) a = null -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/CoercionToUnit.jet b/idea/testData/checkerWithErrorTypes/quick/regression/CoercionToUnit.jet deleted file mode 100644 index 6733ab3a31e..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/CoercionToUnit.jet +++ /dev/null @@ -1,9 +0,0 @@ -fun foo(u : Unit) : Int = 1 - -fun test() : Int { - foo(<!TYPE_MISMATCH!>1<!>) - val a : fun() : Unit = { - foo(<!TYPE_MISMATCH!>1<!>) - } - return 1 -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/DoubleDefine.jet b/idea/testData/checkerWithErrorTypes/quick/regression/DoubleDefine.jet deleted file mode 100644 index eb0616233bd..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/DoubleDefine.jet +++ /dev/null @@ -1,66 +0,0 @@ -import <!UNRESOLVED_REFERENCE!>java<!>.* -import <!UNRESOLVED_REFERENCE!>util<!>.* - -import <!UNRESOLVED_REFERENCE!>java<!>.io.* - -fun takeFirst(expr: StringBuilder): Char { - val c = expr.charAt(0) - expr.deleteCharAt(0) - return c -} - -fun evaluateArg(expr: AbstractStringBuilder, numbers: ArrayList<Int>): Int { - if (expr.length() == 0) throw Exception("Syntax error: Character expected"); - val c = <!OVERLOAD_RESOLUTION_AMBIGUITY!>takeFirst(expr)<!> - if (c <!COMPARE_TO_TYPE_MISMATCH!>>=<!> '0' && c <!COMPARE_TO_TYPE_MISMATCH!><=<!> '9') { - val n = c - '0' - if (!numbers.contains(n)) throw Exception("You used incorrect number: " + n) - numbers.remove(n) - return n - } - throw Exception("Syntax error: Unrecognized character " + c) -} - -fun evaluateAdd(expr: StringBuilder, numbers: ArrayList<Int>): Int { - val lhs = <!OVERLOAD_RESOLUTION_AMBIGUITY!>evaluateArg(expr, numbers)<!> - if (expr.length() <!COMPARE_TO_TYPE_MISMATCH!>><!> 0) { - - } - return lhs -} - -fun evaluate(expr: StringBuilder, numbers: ArrayList<Int>): Int { - val lhs = <!OVERLOAD_RESOLUTION_AMBIGUITY!>evaluateAdd(expr, numbers)<!> - if (expr.length() <!COMPARE_TO_TYPE_MISMATCH!>><!> 0) { - val c = expr.charAt(0) - expr.deleteCharAt(0) - } - return lhs -} - -fun main(args: Array<String>) { - System.out<!UNNECESSARY_SAFE_CALL!>?.<!>println("24 game") - val numbers = ArrayList<Int>(4) - val rnd = Random(); - val prompt = StringBuilder() - for(val i in 0..3) { - val n = rnd.nextInt(9) + 1 - numbers.add(n) - if (i > 0) prompt.append(" "); - prompt.append(n) - } - System.out<!UNNECESSARY_SAFE_CALL!>?.<!>println("Your numbers: " + prompt) - System.out<!UNNECESSARY_SAFE_CALL!>?.<!>println("Enter your expression:") - val reader = BufferedReader(InputStreamReader(System.`in`)) - val expr = StringBuilder(reader.readLine()) - try { - val result = <!OVERLOAD_RESOLUTION_AMBIGUITY!>evaluate(expr, numbers)<!> - if (result != 24) - System.out<!UNNECESSARY_SAFE_CALL!>?.<!>println("Sorry, that's " + result) - else - System.out<!UNNECESSARY_SAFE_CALL!>?.<!>println("You won!"); - } - catch(e: Throwable) { - System.out<!UNNECESSARY_SAFE_CALL!>?.<!>println(e.getMessage()) - } -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/Jet121.jet b/idea/testData/checkerWithErrorTypes/quick/regression/Jet121.jet deleted file mode 100644 index fc29dfe5293..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/Jet121.jet +++ /dev/null @@ -1,14 +0,0 @@ -namespace jet121 { - fun box() : String { - val answer = apply("OK") { String.() : Int => - get(0) - length - } - - return if (answer == 2) "OK" else "FAIL" - } - - fun apply(arg:String, f : fun String.() : Int) : Int { - return arg.f() - } -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/Jet124.jet b/idea/testData/checkerWithErrorTypes/quick/regression/Jet124.jet deleted file mode 100644 index 317b1438f41..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/Jet124.jet +++ /dev/null @@ -1,8 +0,0 @@ -fun foo1() : fun (Int) : Int = { (x: Int) => x } - -fun foo() { - val h : fun (Int) : Int = foo1(); - h(1) - val m : fun (Int) : Int = {(a : Int) => 1}//foo1() - m(1) -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/Jet169.jet b/idea/testData/checkerWithErrorTypes/quick/regression/Jet169.jet deleted file mode 100644 index 43f715647c0..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/Jet169.jet +++ /dev/null @@ -1,8 +0,0 @@ -fun set(key : String, value : String) { - val a : String? = "" - when (a) { - "" => a<!UNSAFE_CALL!>.<!>get(0) - is String, is Any => a.compareTo("") - else => a.toString() - } -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/Jet17.jet b/idea/testData/checkerWithErrorTypes/quick/regression/Jet17.jet deleted file mode 100644 index 32cf98cd2fc..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/Jet17.jet +++ /dev/null @@ -1,6 +0,0 @@ -// JET-17 Do not infer property types by the initializer before the containing scope is ready - -class WithC() { - val a = 1 - val b = $a // error here, but must not be -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/Jet183-1.jet b/idea/testData/checkerWithErrorTypes/quick/regression/Jet183-1.jet deleted file mode 100644 index 37c72d83ef6..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/Jet183-1.jet +++ /dev/null @@ -1,21 +0,0 @@ -abstract enum class ProtocolState { - WAITING { - override fun signal() = ProtocolState.TALKING - } - - TALKING { - override fun signal() = ProtocolState.WAITING - } - - abstract fun signal() : ProtocolState -} - - -fun box(): String { - val x: ProtocolState = ProtocolState.WAITING - x = x.signal() - if (x != ProtocolState.TALKING) return "fail 1" - x = x.signal() - if (x != ProtocolState.WAITING) return "fail 2" - return "OK" -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/Jet183.jet b/idea/testData/checkerWithErrorTypes/quick/regression/Jet183.jet deleted file mode 100644 index b6d9e309306..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/Jet183.jet +++ /dev/null @@ -1,22 +0,0 @@ -abstract enum class ProtocolState { - WAITING { - override fun signal() = ProtocolState.TALKING - } - - TALKING { - override fun signal() = ProtocolState.WAITING - } - - abstract fun signal() : ProtocolState -} - -enum class Foo<T> { - <!NO_GENERICS_IN_SUPERTYPE_SPECIFIER!>X<!> - -} - - - -fun box() { - val x: ProtocolState = ProtocolState.WAITING -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/Jet53.jet b/idea/testData/checkerWithErrorTypes/quick/regression/Jet53.jet deleted file mode 100644 index 34ccb13f7b3..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/Jet53.jet +++ /dev/null @@ -1,4 +0,0 @@ -import <!UNRESOLVED_REFERENCE!>java<!>.util.Collections -import <!UNRESOLVED_REFERENCE!>java<!>.util.List - -val ab = <!UNRESOLVED_REFERENCE!>Collections<!>.emptyList<Int>() : <!UNRESOLVED_REFERENCE!>List<!><Int>? \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/Jet67.jet b/idea/testData/checkerWithErrorTypes/quick/regression/Jet67.jet deleted file mode 100644 index 47123bfc16a..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/Jet67.jet +++ /dev/null @@ -1,4 +0,0 @@ -abstract class XXX { - val a : Int abstract get - -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/Jet68.jet b/idea/testData/checkerWithErrorTypes/quick/regression/Jet68.jet deleted file mode 100644 index 2d9cc4c7b21..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/Jet68.jet +++ /dev/null @@ -1,11 +0,0 @@ -class Foo() - -fun test() { - val f : Foo? = null - if (f == null) { - - } - if (f != null) { - - } -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/Jet69.jet b/idea/testData/checkerWithErrorTypes/quick/regression/Jet69.jet deleted file mode 100644 index 07232903a6a..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/Jet69.jet +++ /dev/null @@ -1,10 +0,0 @@ -class Command() {} - -fun parse(cmd: String): Command? { return null } - -fun Any.equals(other : Any?) : Boolean = this === other - -fun main(args: Array<String>) { - val command = parse("") - if (command == null) 1 // error on this line, but must be OK -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/Jet72.jet b/idea/testData/checkerWithErrorTypes/quick/regression/Jet72.jet deleted file mode 100644 index 7f1d4fc9386..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/Jet72.jet +++ /dev/null @@ -1,17 +0,0 @@ -// JET-72 Type inference doesn't work when iterating over ArrayList - -import <!UNRESOLVED_REFERENCE!>java<!>.util.ArrayList - -abstract class Item(val room: <!UNRESOLVED_REFERENCE!>Object<!>) { - abstract val name : String -} - -val items: <!UNRESOLVED_REFERENCE!>ArrayList<!><Item> = <!UNRESOLVED_REFERENCE!>ArrayList<!><Item> - -fun test(room : <!UNRESOLVED_REFERENCE!>Object<!>) { - for(val item: Item in items) { - if (item.room === room) { - <!UNRESOLVED_REFERENCE!>System<!>.out<!UNNECESSARY_SAFE_CALL!>?.<!>println("You see " + item.name) - } - } -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/Jet81.jet b/idea/testData/checkerWithErrorTypes/quick/regression/Jet81.jet deleted file mode 100644 index 71f79e56394..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/Jet81.jet +++ /dev/null @@ -1,22 +0,0 @@ -// JET-81 Assertion fails when processing self-referring anonymous objects - -val y = object { - val a = y; -} - -val z = y.a; - -object A { - val x = A -} - -val a = object { - { - b + 1 - } - val x = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>b<!> - val y = 1 -} - -val b = a.x -val c = a.y \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/OverrideResolution.jet b/idea/testData/checkerWithErrorTypes/quick/regression/OverrideResolution.jet deleted file mode 100644 index b545418dff3..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/OverrideResolution.jet +++ /dev/null @@ -1,16 +0,0 @@ -fun box() { - val a : C - a.foo() -} - -open class A { - open fun foo() {} -} - -open class B : A { - override fun foo() {} -} - -open class C : B { - override fun foo() {} -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/ScopeForSecondaryConstructors.jet b/idea/testData/checkerWithErrorTypes/quick/regression/ScopeForSecondaryConstructors.jet deleted file mode 100644 index 6c671ffe114..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/ScopeForSecondaryConstructors.jet +++ /dev/null @@ -1,17 +0,0 @@ -class Foo(var bar : Int, barr : Int, val barrr : Int) { - { - bar = 1 - barr = 1 - barrr = 1 - 1 : Int - this : Foo - } - - this(val bar : Int) : this(1, 1, 1) { - bar = 1 - this.bar - 1 : Int - val a : Int =1 - this : Foo - } - } \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/SpecififcityByReceiver.jet b/idea/testData/checkerWithErrorTypes/quick/regression/SpecififcityByReceiver.jet deleted file mode 100644 index bbca53527c8..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/SpecififcityByReceiver.jet +++ /dev/null @@ -1,9 +0,0 @@ -fun Any.equals(other : Any?) : Boolean = true - -fun main(args: Array<String>) { - - val command : Any = 1 - - command<!UNNECESSARY_SAFE_CALL!>?.<!>equals(null) - command.equals(null) -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/ThisConstructorInGenericClass.jet b/idea/testData/checkerWithErrorTypes/quick/regression/ThisConstructorInGenericClass.jet deleted file mode 100644 index cb4408bd600..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/ThisConstructorInGenericClass.jet +++ /dev/null @@ -1,3 +0,0 @@ -class Z() { - this(x : Int) : this() {} -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/WrongTraceInCallResolver.jet b/idea/testData/checkerWithErrorTypes/quick/regression/WrongTraceInCallResolver.jet deleted file mode 100644 index 952ac6c3dbe..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/WrongTraceInCallResolver.jet +++ /dev/null @@ -1,9 +0,0 @@ -open class Foo {} -open class Bar {} - -fun <T : Bar, T1> foo(x : Int) {} -fun <T1, T : Foo> foo(x : Long) {} - -fun f(): Unit { - foo<<!UPPER_BOUND_VIOLATED!>Int<!>, Int>(1) -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/kt251.jet b/idea/testData/checkerWithErrorTypes/quick/regression/kt251.jet deleted file mode 100644 index bfbc0784224..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/kt251.jet +++ /dev/null @@ -1,33 +0,0 @@ -class A() { - var x: Int = 0 - get() = <!TYPE_MISMATCH!>"s"<!> - set(value: <!WRONG_SETTER_PARAMETER_TYPE!>String<!>) { - $x = <!TYPE_MISMATCH!>value<!> - } - val y: Int - get(): <!WRONG_GETTER_RETURN_TYPE!>String<!> = "s" - val z: Int - get() { - return <!TYPE_MISMATCH!>"s"<!> - } - - var a: Any = 1 - set(v: <!WRONG_SETTER_PARAMETER_TYPE!>String<!>) { - $a = v - } - val b: Int - get(): <!WRONG_GETTER_RETURN_TYPE!>Any<!> = "s" - val c: Int - get() { - return 1 - } - val d = 1 - get() { - return $d - } - val e = 1 - get(): <!WRONG_GETTER_RETURN_TYPE!>String<!> { - return <!TYPE_MISMATCH!>$e<!> - } - -} \ No newline at end of file diff --git a/idea/testData/checkerWithErrorTypes/quick/regression/kt303.jet b/idea/testData/checkerWithErrorTypes/quick/regression/kt303.jet deleted file mode 100644 index ed38edc0bf0..00000000000 --- a/idea/testData/checkerWithErrorTypes/quick/regression/kt303.jet +++ /dev/null @@ -1,11 +0,0 @@ -// KT-303 Stack overflow on a cyclic class hierarchy - -open class Foo() : <!CYCLIC_INHERITANCE_HIERARCHY!>Bar<!>() { - val a : Int = 1 -} - -open class Bar() : <!CYCLIC_INHERITANCE_HIERARCHY!>Foo<!>() { - -} - -val x : Int = <!TYPE_MISMATCH!>Foo()<!> \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/checkers/CheckerTestUtilTest.java b/idea/tests/org/jetbrains/jet/checkers/CheckerTestUtilTest.java index b2d27a6d52b..319e0b06789 100644 --- a/idea/tests/org/jetbrains/jet/checkers/CheckerTestUtilTest.java +++ b/idea/tests/org/jetbrains/jet/checkers/CheckerTestUtilTest.java @@ -18,7 +18,7 @@ import java.util.List; public class CheckerTestUtilTest extends JetLiteFixture { public CheckerTestUtilTest() { - super("checkerTestUtil"); + super("checkerWithErrorTypes/checkerTestUtil"); } protected void doTest(TheTest theTest) throws Exception { diff --git a/idea/tests/org/jetbrains/jet/checkers/FullJetPsiCheckerTest.java b/idea/tests/org/jetbrains/jet/checkers/FullJetPsiCheckerTest.java index b8866a42e46..597eb5e2b95 100644 --- a/idea/tests/org/jetbrains/jet/checkers/FullJetPsiCheckerTest.java +++ b/idea/tests/org/jetbrains/jet/checkers/FullJetPsiCheckerTest.java @@ -15,8 +15,10 @@ import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.plugin.AnalyzerFacade; import java.io.File; +import java.io.FileWriter; import java.io.IOException; import java.util.List; +import java.util.regex.Pattern; /** * @author abreslav @@ -72,36 +74,36 @@ public class FullJetPsiCheckerTest extends JetTestCaseBase { return StringUtil.convertLineSeparators(fileText); } -// private void convert(File src, File dest) throws IOException { -// File[] files = src.listFiles(); -// for (File file : files) { -// try { -// if (file.isDirectory()) { -// File destDir = new File(dest, file.getName()); -// destDir.mkdir(); -// convert(file, destDir); -// continue; -// } -// if (!file.getName().endsWith(".jet")) continue; -// String text = loadFile(file.getAbsolutePath()); -// Pattern pattern = Pattern.compile("</?(error|warning)>"); -// String clearText = pattern.matcher(text).replaceAll(""); -// -// configureFromFileText(file.getName(), clearText); -// -// BindingContext bindingContext = AnalyzerFacade.analyzeFileWithCache((JetFile) myFile); -// String expectedText = CheckerTestUtil.addDiagnosticMarkersToText(myFile, bindingContext).toString(); -// -// File destFile = new File(dest, file.getName()); -// FileWriter fileWriter = new FileWriter(destFile); -// fileWriter.write(expectedText); -// fileWriter.close(); -// } -// catch (RuntimeException e) { -// e.printStackTrace(); -// } -// } -// } + private void convert(File src, File dest) throws IOException { + File[] files = src.listFiles(); + for (File file : files) { + try { + if (file.isDirectory()) { + File destDir = new File(dest, file.getName()); + destDir.mkdir(); + convert(file, destDir); + continue; + } + if (!file.getName().endsWith(".jet")) continue; + String text = loadFile(file.getAbsolutePath()); + Pattern pattern = Pattern.compile("</?(error|warning|info( descr=\"[\\w ]+\")?)>"); + String clearText = pattern.matcher(text).replaceAll(""); + + configureFromFileText(file.getName(), clearText); + + BindingContext bindingContext = AnalyzerFacade.analyzeFileWithCache((JetFile) myFile); + String expectedText = CheckerTestUtil.addDiagnosticMarkersToText(myFile, bindingContext).toString(); + + File destFile = new File(dest, file.getName()); + FileWriter fileWriter = new FileWriter(destFile); + fileWriter.write(expectedText); + fileWriter.close(); + } + catch (RuntimeException e) { + e.printStackTrace(); + } + } + } public static Test suite() { return JetTestCaseBase.suiteForDirectory(JetTestCaseBase.getTestDataPathBase(), "/checkerWithErrorTypes/full/", true, new JetTestCaseBase.NamedTestFactory() {