[VISUALIZER] Change rendering of equality operator
This commit is contained in:
committed by
TeamCityServer
parent
c678ad9eb9
commit
cc7d82ab7b
+1
-1
@@ -439,7 +439,7 @@ class FirVisualizer(private val firFile: FirFile) : BaseRenderer() {
|
||||
}
|
||||
|
||||
override fun visitEqualityOperatorCall(equalityOperatorCall: FirEqualityOperatorCall, data: StringBuilder) {
|
||||
data.append("equality operator call ${equalityOperatorCall.operation}")
|
||||
data.append("fun (Any).equals(Any?): Boolean")
|
||||
}
|
||||
|
||||
override fun visitSafeCallExpression(safeCallExpression: FirSafeCallExpression, data: StringBuilder) {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
class A(val a: Int) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
// Unit
|
||||
// │ A.equals.other: Any?
|
||||
// │ │ Boolean
|
||||
// │ │ │
|
||||
if (other !is A) return false
|
||||
// val (A).a: Int
|
||||
// │ fun (Any).equals(Any?): Boolean
|
||||
// │ │ A.equals.other: Any?
|
||||
// │ │ │ val (A).a: Int
|
||||
// │ │ │ │
|
||||
return this.a == other.a
|
||||
}
|
||||
}
|
||||
|
||||
open class B(val b: Int) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
// Unit
|
||||
// │ B.equals.other: Any?
|
||||
// │ │ Boolean
|
||||
// │ │ │
|
||||
if (other !is B) return false
|
||||
// val (B).b: Int
|
||||
// │ fun (Any).equals(Any?): Boolean
|
||||
// │ │ B.equals.other: Any?
|
||||
// │ │ │ val (B).b: Int
|
||||
// │ │ │ │
|
||||
return this.b == other.b
|
||||
}
|
||||
}
|
||||
|
||||
// constructor B(Int)
|
||||
// │ C.<init>.c: Int
|
||||
// │ │
|
||||
class C(c: Int): B(c) {}
|
||||
|
||||
// constructor A(Int)
|
||||
// │ fun (A).equals(Any?): Boolean
|
||||
// │ │ constructor A(Int)
|
||||
// Boolean │ Int │ │ Int
|
||||
// │ │ │ │ │ │
|
||||
val areEqual = A(10) == A(11)
|
||||
// constructor C(Int)
|
||||
// │ fun (B).equals(Any?): Boolean
|
||||
// │ │ constructor C(Int)
|
||||
// Boolean │ Int │ │ Int
|
||||
// │ │ │ │ │ │
|
||||
val areEqual2 = C(10) == C(11)
|
||||
// constructor A(Int)
|
||||
// │ fun (A).equals(Any?): Boolean
|
||||
// │ │ constructor C(Int)
|
||||
// Boolean │ Int │ │ Int
|
||||
// │ │ │ │ │ │
|
||||
val areEqual3 = A(10) == C(11)
|
||||
@@ -0,0 +1,19 @@
|
||||
class A(val a: Int) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other !is A) return false
|
||||
return this.a == other.a
|
||||
}
|
||||
}
|
||||
|
||||
open class B(val b: Int) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other !is B) return false
|
||||
return this.b == other.b
|
||||
}
|
||||
}
|
||||
|
||||
class C(c: Int): B(c) {}
|
||||
|
||||
val areEqual = A(10) == A(11)
|
||||
val areEqual2 = C(10) == C(11)
|
||||
val areEqual3 = A(10) == C(11)
|
||||
+5
-5
@@ -27,7 +27,7 @@ public class FirVisualizerForRawFirDataGenerated extends AbstractFirVisualizer {
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Declarations extends AbstractFirVisualizer {
|
||||
public class Declarations {
|
||||
@Test
|
||||
public void testAllFilesPresentInDeclarations() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
@@ -192,7 +192,7 @@ public class FirVisualizerForRawFirDataGenerated extends AbstractFirVisualizer {
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Contracts extends AbstractFirVisualizer {
|
||||
public class Contracts {
|
||||
@Test
|
||||
public void testAllFilesPresentInContracts() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
@@ -201,7 +201,7 @@ public class FirVisualizerForRawFirDataGenerated extends AbstractFirVisualizer {
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class NewSyntax extends AbstractFirVisualizer {
|
||||
public class NewSyntax {
|
||||
@Test
|
||||
public void testAllFilesPresentInNewSyntax() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
@@ -229,7 +229,7 @@ public class FirVisualizerForRawFirDataGenerated extends AbstractFirVisualizer {
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class OldSyntax extends AbstractFirVisualizer {
|
||||
public class OldSyntax {
|
||||
@Test
|
||||
public void testAllFilesPresentInOldSyntax() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
@@ -247,7 +247,7 @@ public class FirVisualizerForRawFirDataGenerated extends AbstractFirVisualizer {
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Expressions extends AbstractFirVisualizer {
|
||||
public class Expressions {
|
||||
@Test
|
||||
public void testAllFilesPresentInExpressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
|
||||
+6
@@ -48,6 +48,12 @@ public class FirVisualizerForUncommonCasesGenerated extends AbstractFirVisualize
|
||||
runTest("compiler/visualizer/testData/uncommonCases/testFiles/lists.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideEquals.kt")
|
||||
public void testOverrideEquals() throws Exception {
|
||||
runTest("compiler/visualizer/testData/uncommonCases/testFiles/overrideEquals.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("properties.kt")
|
||||
public void testProperties() throws Exception {
|
||||
|
||||
+5
-5
@@ -27,7 +27,7 @@ public class PsiVisualizerForRawFirDataGenerated extends AbstractPsiVisualizer {
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Declarations extends AbstractPsiVisualizer {
|
||||
public class Declarations {
|
||||
@Test
|
||||
public void testAllFilesPresentInDeclarations() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
@@ -192,7 +192,7 @@ public class PsiVisualizerForRawFirDataGenerated extends AbstractPsiVisualizer {
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Contracts extends AbstractPsiVisualizer {
|
||||
public class Contracts {
|
||||
@Test
|
||||
public void testAllFilesPresentInContracts() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
@@ -201,7 +201,7 @@ public class PsiVisualizerForRawFirDataGenerated extends AbstractPsiVisualizer {
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class NewSyntax extends AbstractPsiVisualizer {
|
||||
public class NewSyntax {
|
||||
@Test
|
||||
public void testAllFilesPresentInNewSyntax() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
@@ -229,7 +229,7 @@ public class PsiVisualizerForRawFirDataGenerated extends AbstractPsiVisualizer {
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class OldSyntax extends AbstractPsiVisualizer {
|
||||
public class OldSyntax {
|
||||
@Test
|
||||
public void testAllFilesPresentInOldSyntax() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
@@ -247,7 +247,7 @@ public class PsiVisualizerForRawFirDataGenerated extends AbstractPsiVisualizer {
|
||||
@Nested
|
||||
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Expressions extends AbstractPsiVisualizer {
|
||||
public class Expressions {
|
||||
@Test
|
||||
public void testAllFilesPresentInExpressions() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
|
||||
+6
@@ -48,6 +48,12 @@ public class PsiVisualizerForUncommonCasesGenerated extends AbstractPsiVisualize
|
||||
runTest("compiler/visualizer/testData/uncommonCases/testFiles/lists.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("overrideEquals.kt")
|
||||
public void testOverrideEquals() throws Exception {
|
||||
runTest("compiler/visualizer/testData/uncommonCases/testFiles/overrideEquals.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("properties.kt")
|
||||
public void testProperties() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user