Java: do not change too much on migrating expression type used in compound string assignment (IDEA-310441)

GitOrigin-RevId: d0c2bb8d47427f266c1b87c36bccb8e500dea366
This commit is contained in:
Bas Leijdekkers
2023-02-27 12:44:31 +01:00
committed by intellij-monorepo-bot
parent 2751538ed9
commit d40c54bbd2
5 changed files with 30 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.refactoring;
import com.intellij.application.options.CodeStyle;
@@ -39,6 +40,10 @@ public class TypeMigrationTest extends TypeMigrationTestBase {
super.tearDown();
}
public void testStringCompoundAssignment() {
doTestFirstParamType("x", PsiTypes.longType());
}
public void testT07() {
doTestFieldType("f",
myFactory.createTypeFromText("java.lang.Integer", null).createArrayType());

View File

@@ -0,0 +1,8 @@
Types:
PsiParameter:i : long
PsiReferenceExpression:i : long
Conversions:
New expression type changes:
Fails:

View File

@@ -0,0 +1,7 @@
class Test {
public void x(long i) {
String s = "";
s += i;
}
}

View File

@@ -0,0 +1,7 @@
class Test {
public void x(int i) {
String s = "";
s += i;
}
}