Fix "Extract variable" for anonymous object suggests name "nonameprovided" (KT-4813)

#KT-4813 Fixed
This commit is contained in:
Nikolay Krasko
2014-04-04 22:11:45 +04:00
parent 43b41f6db9
commit dd45da01d1
5 changed files with 46 additions and 3 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
* Copyright 2010-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -182,7 +182,9 @@ public class JetNameSuggester {
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(jetType);
if (classDescriptor != null) {
Name className = classDescriptor.getName();
addCamelNames(result, className.asString(), validator);
if (!className.isSpecial()) {
addCamelNames(result, className.asString(), validator);
}
}
}
@@ -0,0 +1,9 @@
// KT-4813
fun foo() {
<selection>object {}</selection>
}
/*
value
*/
@@ -0,0 +1,11 @@
// KT-4813
trait A
fun foo() {
<selection>object: A {}</selection>
}
/*
value
*/
@@ -0,0 +1,9 @@
fun test() = array(object {})
fun foo() {
<selection>test()</selection>
}
/*
test
*/
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
* Copyright 2010-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,6 +66,18 @@ public class JetNameSuggesterTest extends LightCodeInsightFixtureTestCase {
doTest();
}
public void testAnonymousObject() {
doTest();
}
public void testAnonymousObjectWithSuper() {
doTest();
}
public void testArrayOfObjectsType() {
doTest();
}
@Override
protected void setUp() throws Exception {
super.setUp();