removed incorrect code from resolve tests

Resolve tests had a functionality that for primary constructor parameters
 class A(val x: Int, y: Int)
 `$x` was resolved to property descriptor while `x` was resolved to value parameter descriptor.
But it worked incorrect (see tests changes) and was senseless because 'x' in code always resolves to property descriptor.
So it was dropped.
This commit is contained in:
Svetlana Isakova
2013-07-02 21:19:28 +04:00
parent 37e4402822
commit 54e1cf0879
3 changed files with 24 additions and 47 deletions
@@ -1,21 +1,25 @@
class C(~x~x : Int, ~y~val y : Int) : Base(`x`x /*parameter*/), Base1 by Base1(`x`x) {
var z = `x`x // parameter
get() = `$x`x // property
var zx = `x`x // parameter
get() = `!`x // inaccessible
var zy = `y`y // parameter
get() = `y`y // property
{
val z = `x`x // parameter
val wx = `x`x
val wy = `y`y
}
val foo = `$y`y
val fx = `x`x
val fy = `y`y
this() : this(1, 2) {
val z = x // inaccessible
val zz = `$y`y // property
}
fun f() : Int {
return `$x`x // property
fun test() {
val ux = `!`x // inaccessible
val uy = `y`y // property
}
}
class D(~a~a: Int) {
val a = `a`a
}
@@ -1,20 +1,20 @@
class A(~a~val a : Int) {
~b~val b = `$a`a
~f~fun f() = `$a`a
~b~val b = `a`a
~f~fun f() = `a`a
}
fun test() {
~va~val a = A()
`va`a.`$a`a`:kotlin::Int`
`va`a.`a`a`:kotlin::Int`
a.`b`b`:kotlin::Int`
a.`f`f()`:kotlin::Int`
}
class Foo(~bar~var bar : Int, ~barr~barr : Int, ~barrr~val barrr : Int) {
{
`$bar`bar = 1
`bar`bar = 1
`barr`barr = 1
`$barrr`barrr = 1
`barrr`barrr = 1
}
}
@@ -27,10 +27,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.analyzer.AnalyzeExhaust;
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils;
import org.jetbrains.jet.lang.diagnostics.Errors;
@@ -239,9 +236,6 @@ public abstract class ExpectedResolveData {
}
PsiElement expected = nameToDeclaration.get(name);
if (expected == null && name.startsWith("$")) {
expected = nameToDeclaration.get(name.substring(1));
}
if (expected == null) {
expected = nameToPsiElement.get(name);
}
@@ -281,30 +275,9 @@ public abstract class ExpectedResolveData {
}
assertNotNull(element.getText(), reference);
if (expected instanceof JetParameter || actual instanceof JetParameter) {
DeclarationDescriptor expectedDescriptor;
if (name.startsWith("$")) {
expectedDescriptor = bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, (JetParameter) expected);
}
else {
expectedDescriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, expected);
if (expectedDescriptor == null) {
expectedDescriptor = bindingContext.get(BindingContext.CONSTRUCTOR, (JetElement) expected);
}
}
DeclarationDescriptor actualDescriptor = bindingContext.get(REFERENCE_TARGET, reference);
assertEquals(
"Reference `" + name + "`" + renderReferenceInContext(reference) + " is resolved into " + actualName + ".",
expectedDescriptor, actualDescriptor);
}
else {
assertEquals(
"Reference `" + name + "`" + renderReferenceInContext(reference) + " is resolved into " + actualName + ".",
expected.getText(), actual != null ? actual.getText() : null);
}
assertEquals(
"Reference `" + name + "`" + renderReferenceInContext(reference) + " is resolved into " + actualName + ".",
expected, actual);
}
for (Map.Entry<Position, String> entry : positionToType.entrySet()) {