IDEADEV-41362
authorMaxim Medvedev <maxim.medvedev@jetbrains.com>
Mon, 16 Nov 2009 17:33:59 +0000 (20:33 +0300)
committerMaxim Medvedev <maxim.medvedev@jetbrains.com>
Mon, 16 Nov 2009 17:33:59 +0000 (20:33 +0300)
plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/expressions/TypesUtil.java
plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.java
plugins/groovy/test/org/jetbrains/plugins/groovy/lang/resolve/ResolveMethodTest.java
plugins/groovy/testdata/highlighting/GstringAssignableToString.groovy [new file with mode: 0644]

index b280f86159cf566997d644fa96c148ac40445f0e..281c919ff8f500f94857f080a95886f0fae00afc 100644 (file)
@@ -216,6 +216,8 @@ public class TypesUtil {
   public static boolean isAssignableByMethodCallConversion(PsiType lType, PsiType rType, PsiManager manager, GlobalSearchScope scope) {
     if (lType == null || rType == null) return false;
 
+    if (lType.equalsToText(JAVA_LANG_STRING)) return true;
+    
     if (isNumericType(lType) && isNumericType(rType)) {
       lType = unboxPrimitiveTypeWrapper(lType);
       if (lType.equalsToText(JAVA_MATH_BIG_DECIMAL)) lType = PsiType.DOUBLE;
index 971ba82df0e177ab16422c01198899ccd652c005..4bc7ae93ff5a37fb074e36438c09b74a2369cc02 100644 (file)
@@ -187,4 +187,6 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase {
   public void testFQNJavaClassesUsages() throws Exception {
     doTest();
   }
+
+  public void testGstringAssignableToString() throws Exception{doTest();} 
 }
\ No newline at end of file
index 4756cfd7f1389e8ad569f4acec88712adaa0a13f..d566a056d4ad0e233f7bce9d9cb9a859bd4c9387 100644 (file)
@@ -393,7 +393,7 @@ public class ResolveMethodTest extends GroovyResolveTestCase {
     PsiReference ref = configureByFile("unboxBigDecimal/A.groovy");
     PsiElement resolved = ref.resolve();
     assertTrue(resolved instanceof PsiMethod);
-    assertEquals(((PsiMethod) resolved).getReturnType(), PsiType.DOUBLE);
+    assertEquals(PsiType.DOUBLE, ((PsiMethod) resolved).getReturnType());
   }
 
   public void testGrvy1157() throws Exception {
diff --git a/plugins/groovy/testdata/highlighting/GstringAssignableToString.groovy b/plugins/groovy/testdata/highlighting/GstringAssignableToString.groovy
new file mode 100644 (file)
index 0000000..d424fd8
--- /dev/null
@@ -0,0 +1,7 @@
+def foo(Date d, int x) {}
+
+def foo(String s, double x) {}
+
+def bar = 10
+
+foo "$bar", 2
\ No newline at end of file